[llvm] [AArch64] Improve index selection for histograms (PR #111150)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 06:11:17 PDT 2024


================
@@ -267,5 +267,79 @@ define void @histogram_i16_8_lane(ptr %base, <vscale x 8 x i32> %indices, i16 %i
   ret void
 }
 
+define void @histogram_i32_zextend(ptr %base, <vscale x 4 x i32> %indices, <vscale x 4 x i1> %mask) #0 {
----------------
MacDue wrote:

I'm concerned that maybe there's a reason for that (like `histcnt` only works for i32 or i64 indices -- I've not checked that myself). But maybe there's cases like below, where you may want to do something different if `i8` indices are not directly supported by `histcnt`. Maybe then you'd want to extend to the smallest legal type (so extend to i32 rather than i64).
```
%extended = zext <vscale x 4 x i8> %indices to <vscale x 4 x i64>
%buckets = getelementptr i32, ptr %base, <vscale x 4 x i64> %extended
call void @llvm.experimental.vector.histogram.add.nxv4p0.i32(<vscale x 4 x ptr> %buckets, i32 1, <vscale x 4 x i1> %mask)
```

https://github.com/llvm/llvm-project/pull/111150


More information about the llvm-commits mailing list