1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple aarch64-none-linux-gnu < %s | FileCheck %s
4 declare <16 x i32> @llvm.abs.v16i32(<16 x i32>, i1 immarg)
5 declare i32 @llvm.vector.reduce.add.v16i32(<16 x i32>)
7 define i32 @test_sad_v16i8_zext(i8* nocapture readonly %a, i8* nocapture readonly %b) {
8 ; CHECK-LABEL: test_sad_v16i8_zext:
9 ; CHECK: // %bb.0: // %entry
10 ; CHECK-NEXT: ldr q0, [x0]
11 ; CHECK-NEXT: ldr q1, [x1]
12 ; CHECK-NEXT: uabdl v2.8h, v1.8b, v0.8b
13 ; CHECK-NEXT: uabal2 v2.8h, v1.16b, v0.16b
14 ; CHECK-NEXT: uaddlv s0, v2.8h
15 ; CHECK-NEXT: fmov w0, s0
18 %0 = bitcast i8* %a to <16 x i8>*
19 %1 = load <16 x i8>, <16 x i8>* %0
20 %2 = zext <16 x i8> %1 to <16 x i32>
21 %3 = bitcast i8* %b to <16 x i8>*
22 %4 = load <16 x i8>, <16 x i8>* %3
23 %5 = zext <16 x i8> %4 to <16 x i32>
24 %6 = sub nsw <16 x i32> %5, %2
25 %7 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %6, i1 true)
26 %8 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %7)
30 define i32 @test_sad_v16i8_sext(i8* nocapture readonly %a, i8* nocapture readonly %b) {
31 ; CHECK-LABEL: test_sad_v16i8_sext:
32 ; CHECK: // %bb.0: // %entry
33 ; CHECK-NEXT: ldr q0, [x0]
34 ; CHECK-NEXT: ldr q1, [x1]
35 ; CHECK-NEXT: sabdl v2.8h, v1.8b, v0.8b
36 ; CHECK-NEXT: sabal2 v2.8h, v1.16b, v0.16b
37 ; CHECK-NEXT: uaddlv s0, v2.8h
38 ; CHECK-NEXT: fmov w0, s0
41 %0 = bitcast i8* %a to <16 x i8>*
42 %1 = load <16 x i8>, <16 x i8>* %0
43 %2 = sext <16 x i8> %1 to <16 x i32>
44 %3 = bitcast i8* %b to <16 x i8>*
45 %4 = load <16 x i8>, <16 x i8>* %3
46 %5 = sext <16 x i8> %4 to <16 x i32>
47 %6 = sub nsw <16 x i32> %5, %2
48 %7 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %6, i1 true)
49 %8 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %7)