[llvm] [AArch64] Add patterns for constructive splice. (PR #113912)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 02:01:32 PDT 2024


================
@@ -406,17 +406,33 @@ define void @concat_v8i64(ptr %a, ptr %b, ptr %c) {
 ;
 
 define <4 x half> @concat_v4f16(<2 x half> %op1, <2 x half> %op2)  {
-; CHECK-LABEL: concat_v4f16:
-; CHECK:       // %bb.0:
-; CHECK-NEXT:    // kill: def $d1 killed $d1 def $z1
-; CHECK-NEXT:    // kill: def $d0 killed $d0 def $z0
-; CHECK-NEXT:    mov z2.h, z1.h[1]
-; CHECK-NEXT:    mov z3.h, z0.h[1]
-; CHECK-NEXT:    zip1 z1.h, z1.h, z2.h
-; CHECK-NEXT:    zip1 z0.h, z0.h, z3.h
-; CHECK-NEXT:    zip1 z0.s, z0.s, z1.s
-; CHECK-NEXT:    // kill: def $d0 killed $d0 killed $z0
-; CHECK-NEXT:    ret
+; SVE2-LABEL: concat_v4f16:
+; SVE2:       // %bb.0:
+; SVE2-NEXT:    cnth x8
+; SVE2-NEXT:    adrp x9, .LCPI15_0
+; SVE2-NEXT:    adrp x10, .LCPI15_1
+; SVE2-NEXT:    mov z2.h, w8
+; SVE2-NEXT:    ldr q3, [x9, :lo12:.LCPI15_0]
+; SVE2-NEXT:    ldr q4, [x10, :lo12:.LCPI15_1]
+; SVE2-NEXT:    ptrue p0.h, vl8
+; SVE2-NEXT:    // kill: def $d1 killed $d1 killed $z0_z1 def $z0_z1
+; SVE2-NEXT:    // kill: def $d0 killed $d0 killed $z0_z1 def $z0_z1
+; SVE2-NEXT:    mad z2.h, p0/m, z3.h, z4.h
+; SVE2-NEXT:    tbl z0.h, { z0.h, z1.h }, z2.h
+; SVE2-NEXT:    // kill: def $d0 killed $d0 killed $z0
----------------
sdesmalen-arm wrote:

Thanks for pointing out; that's due to changing the RUN line from +sve to +sve2, not the code change for splice.

It seems the lowering of shufflevector goes through the generic expansion code for +sve (which ends up resulting in the relatively neat zips), but chooses to use the TBL when it is available (i.e. with +sve2), which unfortunately end up being as nice.

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


More information about the llvm-commits mailing list