[llvm] [AArch64] Optimize lowering of i1 vector reduction (PR #187912)

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 02:16:26 PDT 2026


https://github.com/davemgreen commented:

Can you add a test case with i4 bitcasts:
```
 define i64 @match_any_byte(<4 x i8> %haystack, i8 %needle) {
 bb1:
   %0 = insertelement <4 x i8> poison, i8 %needle, i64 0
   %1 = shufflevector <4 x i8> %0, <4 x i8> poison, <4 x i32> zeroinitializer
   %2 = icmp eq <4 x i8> %haystack, %1
   %3 = bitcast <4 x i1> %2 to i4
   %4 = icmp ne i4 %3, 0
   %5 = select i1 %4, i64 777, i64 999
   ret i64 %5
 }
```
In general, because this is a combine that can happen before types are legalised, we need to deal with any weird and wonderful types. It can be good to be explicit about the types supported.

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


More information about the llvm-commits mailing list