[llvm] [DAG] Add legalization handling for ABDS/ABDU (PR #92576)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 09:48:17 PDT 2024


================
@@ -24,9 +24,10 @@ define <vscale x 16 x i8> @saba_b(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b,
 define <vscale x 16 x i8> @saba_b_promoted_ops(<vscale x 16 x i8> %a, <vscale x 16 x i1> %b, <vscale x 16 x i1> %c) #0 {
 ; CHECK-LABEL: saba_b_promoted_ops:
 ; CHECK:       // %bb.0:
-; CHECK-NEXT:    mov z1.b, p0/z, #-1 // =0xffffffffffffffff
-; CHECK-NEXT:    mov z2.b, p1/z, #-1 // =0xffffffffffffffff
-; CHECK-NEXT:    saba z0.b, z1.b, z2.b
+; CHECK-NEXT:    ptrue p2.b
+; CHECK-NEXT:    mov z1.b, #1 // =0x1
+; CHECK-NEXT:    eor p0.b, p2/z, p0.b, p1.b
+; CHECK-NEXT:    add z0.b, p0/m, z0.b, z1.b
----------------
RKSimon wrote:

Vector code is the more common, but this has turned up in real world scalar code - some std::midpoint style implementations for instance end up with being canonicalized to the abd 'minmax' patterns I added tests for. Midpoint code quality originally started me on improving generic ISD::AVG* handling but I then ended up hitting this as well.

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


More information about the llvm-commits mailing list