1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple aarch64-unknown-linux-gnu < %s | FileCheck %s
4 ; SABA from ADD(ABS(SUB NSW))
6 define <4 x i32> @saba_abs_4s(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) #0 {
7 ; CHECK-LABEL: saba_abs_4s:
9 ; CHECK-NEXT: saba v0.4s, v1.4s, v2.4s
11 %sub = sub nsw <4 x i32> %b, %c
12 %abs = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %sub, i1 true)
13 %add = add <4 x i32> %a, %abs
17 define <2 x i32> @saba_abs_2s(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c) #0 {
18 ; CHECK-LABEL: saba_abs_2s:
20 ; CHECK-NEXT: saba v0.2s, v1.2s, v2.2s
22 %sub = sub nsw <2 x i32> %b, %c
23 %abs = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %sub, i1 true)
24 %add = add <2 x i32> %a, %abs
28 define <8 x i16> @saba_abs_8h(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) #0 {
29 ; CHECK-LABEL: saba_abs_8h:
31 ; CHECK-NEXT: saba v0.8h, v1.8h, v2.8h
33 %sub = sub nsw <8 x i16> %b, %c
34 %abs = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %sub, i1 true)
35 %add = add <8 x i16> %a, %abs
39 define <4 x i16> @saba_abs_4h(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c) #0 {
40 ; CHECK-LABEL: saba_abs_4h:
42 ; CHECK-NEXT: saba v0.4h, v1.4h, v2.4h
44 %sub = sub nsw <4 x i16> %b, %c
45 %abs = call <4 x i16> @llvm.abs.v4i16(<4 x i16> %sub, i1 true)
46 %add = add <4 x i16> %a, %abs
50 define <16 x i8> @saba_abs_16b(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) #0 {
51 ; CHECK-LABEL: saba_abs_16b:
53 ; CHECK-NEXT: saba v0.16b, v1.16b, v2.16b
55 %sub = sub nsw <16 x i8> %b, %c
56 %abs = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %sub, i1 true)
57 %add = add <16 x i8> %a, %abs
61 define <8 x i8> @saba_abs_8b(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c) #0 {
62 ; CHECK-LABEL: saba_abs_8b:
64 ; CHECK-NEXT: saba v0.8b, v1.8b, v2.8b
66 %sub = sub nsw <8 x i8> %b, %c
67 %abs = call <8 x i8> @llvm.abs.v8i8(<8 x i8> %sub, i1 true)
68 %add = add <8 x i8> %a, %abs
74 define <4 x i32> @saba_sabd_4s(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) #0 {
75 ; CHECK-LABEL: saba_sabd_4s:
77 ; CHECK-NEXT: saba v0.4s, v1.4s, v2.4s
79 %sabd = call <4 x i32> @llvm.aarch64.neon.sabd.v4i32(<4 x i32> %b, <4 x i32> %c)
80 %add = add <4 x i32> %sabd, %a
84 define <2 x i32> @saba_sabd_2s(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c) #0 {
85 ; CHECK-LABEL: saba_sabd_2s:
87 ; CHECK-NEXT: saba v0.2s, v1.2s, v2.2s
89 %sabd = call <2 x i32> @llvm.aarch64.neon.sabd.v2i32(<2 x i32> %b, <2 x i32> %c)
90 %add = add <2 x i32> %sabd, %a
94 define <8 x i16> @saba_sabd_8h(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) #0 {
95 ; CHECK-LABEL: saba_sabd_8h:
97 ; CHECK-NEXT: saba v0.8h, v1.8h, v2.8h
99 %sabd = call <8 x i16> @llvm.aarch64.neon.sabd.v8i16(<8 x i16> %b, <8 x i16> %c)
100 %add = add <8 x i16> %sabd, %a
104 define <4 x i16> @saba_sabd_4h(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c) #0 {
105 ; CHECK-LABEL: saba_sabd_4h:
107 ; CHECK-NEXT: saba v0.4h, v1.4h, v2.4h
109 %sabd = call <4 x i16> @llvm.aarch64.neon.sabd.v4i16(<4 x i16> %b, <4 x i16> %c)
110 %add = add <4 x i16> %sabd, %a
114 define <16 x i8> @saba_sabd_16b(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) #0 {
115 ; CHECK-LABEL: saba_sabd_16b:
117 ; CHECK-NEXT: saba v0.16b, v1.16b, v2.16b
119 %sabd = call <16 x i8> @llvm.aarch64.neon.sabd.v16i8(<16 x i8> %b, <16 x i8> %c)
120 %add = add <16 x i8> %sabd, %a
124 define <8 x i8> @saba_sabd_8b(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c) #0 {
125 ; CHECK-LABEL: saba_sabd_8b:
127 ; CHECK-NEXT: saba v0.8b, v1.8b, v2.8b
129 %sabd = call <8 x i8> @llvm.aarch64.neon.sabd.v8i8(<8 x i8> %b, <8 x i8> %c)
130 %add = add <8 x i8> %sabd, %a
134 declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1)
135 declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1)
136 declare <8 x i16> @llvm.abs.v8i16(<8 x i16>, i1)
137 declare <4 x i16> @llvm.abs.v4i16(<4 x i16>, i1)
138 declare <16 x i8> @llvm.abs.v16i8(<16 x i8>, i1)
139 declare <8 x i8> @llvm.abs.v8i8(<8 x i8>, i1)
141 declare <4 x i32> @llvm.aarch64.neon.sabd.v4i32(<4 x i32>, <4 x i32>)
142 declare <2 x i32> @llvm.aarch64.neon.sabd.v2i32(<2 x i32>, <2 x i32>)
143 declare <8 x i16> @llvm.aarch64.neon.sabd.v8i16(<8 x i16>, <8 x i16>)
144 declare <4 x i16> @llvm.aarch64.neon.sabd.v4i16(<4 x i16>, <4 x i16>)
145 declare <16 x i8> @llvm.aarch64.neon.sabd.v16i8(<16 x i8>, <16 x i8>)
146 declare <8 x i8> @llvm.aarch64.neon.sabd.v8i8(<8 x i8>, <8 x i8>)