Skip to content

Commit c830ff2

Browse files
committed
Add test
1 parent 13ddd5a commit c830ff2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/test/CodeGen/AArch64/neon-sad.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,25 @@ entry:
6767
%7 = tail call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %6)
6868
ret i32 %7
6969
}
70+
71+
define i32 @test_sad_v16i8_two_step_sext(ptr noundef readonly %a, ptr noundef readonly %b) {
72+
; CHECK-LABEL: test_sad_v16i8_two_step_sext:
73+
; CHECK: // %bb.0: // %entry
74+
; CHECK-NEXT: ldr q0, [x0]
75+
; CHECK-NEXT: ldr q1, [x1]
76+
; CHECK-NEXT: sabdl v2.8h, v1.8b, v0.8b
77+
; CHECK-NEXT: sabal2 v2.8h, v1.16b, v0.16b
78+
; CHECK-NEXT: uaddlv s0, v2.8h
79+
; CHECK-NEXT: fmov w0, s0
80+
; CHECK-NEXT: ret
81+
entry:
82+
%0 = load <16 x i8>, ptr %a
83+
%1 = sext <16 x i8> %0 to <16 x i16>
84+
%2 = load <16 x i8>, ptr %b
85+
%3 = sext <16 x i8> %2 to <16 x i16>
86+
%4 = sub nsw <16 x i16> %3, %1
87+
%5 = tail call <16 x i16> @llvm.abs.v16i16(<16 x i16> %4, i1 false)
88+
%6 = zext <16 x i16> %5 to <16 x i32>
89+
%7 = tail call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %6)
90+
ret i32 %7
91+
}

0 commit comments

Comments
 (0)