1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-- -o - %s | FileCheck %s
4 declare i32 @llvm.fshl.i32(i32, i32, i32)
5 declare i16 @llvm.fshr.i16(i16, i16, i16)
6 declare i64 @llvm.fshr.i64(i64, i64, i64)
7 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
9 define i1 @fshl_or_eq_0(i32 %x, i32 %y) {
10 ; CHECK-LABEL: fshl_or_eq_0:
12 ; CHECK-NEXT: orr w8, w0, w1, lsl #5
13 ; CHECK-NEXT: cmp w8, #0
14 ; CHECK-NEXT: cset w0, eq
17 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 5)
18 %r = icmp eq i32 %f, 0
22 define i1 @fshl_or_commute_eq_0(i32 %x, i32 %y) {
23 ; CHECK-LABEL: fshl_or_commute_eq_0:
25 ; CHECK-NEXT: orr w8, w0, w1, lsl #5
26 ; CHECK-NEXT: cmp w8, #0
27 ; CHECK-NEXT: cset w0, eq
30 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 5)
31 %r = icmp eq i32 %f, 0
35 define <4 x i1> @fshl_or2_eq_0(<4 x i32> %x, <4 x i32> %y) {
36 ; CHECK-LABEL: fshl_or2_eq_0:
38 ; CHECK-NEXT: ushr v1.4s, v1.4s, #7
39 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
40 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
41 ; CHECK-NEXT: xtn v0.4h, v0.4s
43 %or = or <4 x i32> %x, %y
44 %f = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %or, <4 x i32> <i32 25, i32 25, i32 25, i32 25>)
45 %r = icmp eq <4 x i32> %f, zeroinitializer
49 define <4 x i1> @fshl_or2_commute_eq_0(<4 x i32> %x, <4 x i32> %y) {
50 ; CHECK-LABEL: fshl_or2_commute_eq_0:
52 ; CHECK-NEXT: ushr v1.4s, v1.4s, #7
53 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
54 ; CHECK-NEXT: cmeq v0.4s, v0.4s, #0
55 ; CHECK-NEXT: xtn v0.4h, v0.4s
57 %or = or <4 x i32> %y, %x
58 %f = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %or, <4 x i32> <i32 25, i32 25, i32 25, i32 25>)
59 %r = icmp eq <4 x i32> %f, zeroinitializer
63 define i1 @fshr_or_eq_0(i16 %x, i16 %y) {
64 ; CHECK-LABEL: fshr_or_eq_0:
66 ; CHECK-NEXT: orr w8, w0, w1, lsl #8
67 ; CHECK-NEXT: tst w8, #0xffff
68 ; CHECK-NEXT: cset w0, eq
71 %f = call i16 @llvm.fshr.i16(i16 %or, i16 %x, i16 8)
72 %r = icmp eq i16 %f, 0
76 define i1 @fshr_or_commute_eq_0(i16 %x, i16 %y) {
77 ; CHECK-LABEL: fshr_or_commute_eq_0:
79 ; CHECK-NEXT: orr w8, w0, w1, lsl #8
80 ; CHECK-NEXT: tst w8, #0xffff
81 ; CHECK-NEXT: cset w0, eq
84 %f = call i16 @llvm.fshr.i16(i16 %or, i16 %x, i16 8)
85 %r = icmp eq i16 %f, 0
89 define i1 @fshr_or2_eq_0(i64 %x, i64 %y) {
90 ; CHECK-LABEL: fshr_or2_eq_0:
92 ; CHECK-NEXT: orr x8, x0, x1, lsr #3
93 ; CHECK-NEXT: cmp x8, #0
94 ; CHECK-NEXT: cset w0, eq
97 %f = call i64 @llvm.fshr.i64(i64 %x, i64 %or, i64 3)
98 %r = icmp eq i64 %f, 0
102 define i1 @fshl_or_ne_0(i32 %x, i32 %y) {
103 ; CHECK-LABEL: fshl_or_ne_0:
105 ; CHECK-NEXT: orr w8, w0, w1, lsl #7
106 ; CHECK-NEXT: cmp w8, #0
107 ; CHECK-NEXT: cset w0, ne
110 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 7)
111 %r = icmp ne i32 %f, 0
115 define i1 @fshl_or_commute_ne_0(i32 %x, i32 %y) {
116 ; CHECK-LABEL: fshl_or_commute_ne_0:
118 ; CHECK-NEXT: orr w8, w0, w1, lsl #7
119 ; CHECK-NEXT: cmp w8, #0
120 ; CHECK-NEXT: cset w0, ne
123 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 7)
124 %r = icmp ne i32 %f, 0
128 define <4 x i1> @fshl_or2_ne_0(<4 x i32> %x, <4 x i32> %y) {
129 ; CHECK-LABEL: fshl_or2_ne_0:
131 ; CHECK-NEXT: ushr v1.4s, v1.4s, #27
132 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
133 ; CHECK-NEXT: cmtst v0.4s, v0.4s, v0.4s
134 ; CHECK-NEXT: xtn v0.4h, v0.4s
136 %or = or <4 x i32> %x, %y
137 %f = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %or, <4 x i32> <i32 5, i32 5, i32 5, i32 5>)
138 %r = icmp ne <4 x i32> %f, zeroinitializer
142 define <4 x i1> @fshl_or2_commute_ne_0(<4 x i32> %x, <4 x i32> %y) {
143 ; CHECK-LABEL: fshl_or2_commute_ne_0:
145 ; CHECK-NEXT: ushr v1.4s, v1.4s, #27
146 ; CHECK-NEXT: orr v0.16b, v1.16b, v0.16b
147 ; CHECK-NEXT: cmtst v0.4s, v0.4s, v0.4s
148 ; CHECK-NEXT: xtn v0.4h, v0.4s
150 %or = or <4 x i32> %y, %x
151 %f = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %or, <4 x i32> <i32 5, i32 5, i32 5, i32 5>)
152 %r = icmp ne <4 x i32> %f, zeroinitializer
156 define i1 @fshr_or_ne_0(i64 %x, i64 %y) {
157 ; CHECK-LABEL: fshr_or_ne_0:
159 ; CHECK-NEXT: orr x8, x0, x1, lsl #63
160 ; CHECK-NEXT: cmp x8, #0
161 ; CHECK-NEXT: cset w0, ne
164 %f = call i64 @llvm.fshr.i64(i64 %or, i64 %x, i64 1)
165 %r = icmp ne i64 %f, 0
169 define i1 @fshr_or_commute_ne_0(i64 %x, i64 %y) {
170 ; CHECK-LABEL: fshr_or_commute_ne_0:
172 ; CHECK-NEXT: orr x8, x0, x1, lsl #63
173 ; CHECK-NEXT: cmp x8, #0
174 ; CHECK-NEXT: cset w0, ne
177 %f = call i64 @llvm.fshr.i64(i64 %or, i64 %x, i64 1)
178 %r = icmp ne i64 %f, 0
182 define i1 @fshr_or2_ne_0(i16 %x, i16 %y) {
183 ; CHECK-LABEL: fshr_or2_ne_0:
185 ; CHECK-NEXT: and w8, w1, #0xfffc
186 ; CHECK-NEXT: orr w8, w0, w8, lsr #2
187 ; CHECK-NEXT: tst w8, #0xffff
188 ; CHECK-NEXT: cset w0, ne
191 %f = call i16 @llvm.fshr.i16(i16 %x, i16 %or, i16 2)
192 %r = icmp ne i16 %f, 0
196 define i1 @fshr_or2_commute_ne_0(i16 %x, i16 %y) {
197 ; CHECK-LABEL: fshr_or2_commute_ne_0:
199 ; CHECK-NEXT: and w8, w1, #0xfffc
200 ; CHECK-NEXT: orr w8, w0, w8, lsr #2
201 ; CHECK-NEXT: tst w8, #0xffff
202 ; CHECK-NEXT: cset w0, ne
205 %f = call i16 @llvm.fshr.i16(i16 %x, i16 %or, i16 2)
206 %r = icmp ne i16 %f, 0
210 define i1 @fshl_xor_eq_0(i32 %x, i32 %y) {
211 ; CHECK-LABEL: fshl_xor_eq_0:
213 ; CHECK-NEXT: eor w8, w0, w1
214 ; CHECK-NEXT: extr w8, w8, w0, #30
215 ; CHECK-NEXT: cmp w8, #0
216 ; CHECK-NEXT: cset w0, eq
219 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 2)
220 %r = icmp eq i32 %f, 0
224 define i1 @fshl_or_sgt_0(i32 %x, i32 %y) {
225 ; CHECK-LABEL: fshl_or_sgt_0:
227 ; CHECK-NEXT: orr w8, w0, w1
228 ; CHECK-NEXT: extr w8, w8, w0, #30
229 ; CHECK-NEXT: cmp w8, #0
230 ; CHECK-NEXT: cset w0, gt
233 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 2)
234 %r = icmp sgt i32 %f, 0
238 define i1 @fshl_or_ne_2(i32 %x, i32 %y) {
239 ; CHECK-LABEL: fshl_or_ne_2:
241 ; CHECK-NEXT: orr w8, w0, w1
242 ; CHECK-NEXT: extr w8, w8, w0, #30
243 ; CHECK-NEXT: cmp w8, #2
244 ; CHECK-NEXT: cset w0, ne
247 %f = call i32 @llvm.fshl.i32(i32 %or, i32 %x, i32 2)
248 %r = icmp ne i32 %f, 2