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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 07:03:42 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 think [here](https://github.com/llvm/llvm-project/blob/7c61336bbcb18f0c2bbda6979df13f3a81ef270d/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L24094) you want to check what the type of `ExtOp`:

- If it's an `i32`, you can use it directly as the source of the histogram operation, no worries
- If it's < `i32` (e.g. `i8`) and the target type is `i32`, do nothing
- If it's < `i32` (e.g. `i8`) and the target type is > `i32` replace it with a smaller extend (i.e. only extend to `i32`)

Maybe double check with @huntergr-arm though in case there's something else you could do :slightly_smiling_face:  

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


More information about the llvm-commits mailing list