1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
4 define i8 @shl_and(i8 %x, i8 %y) nounwind {
5 ; CHECK-LABEL: shl_and:
7 ; CHECK-NEXT: lsl w8, w0, #5
8 ; CHECK-NEXT: and w0, w8, w1, lsl #2
16 define i16 @shl_or(i16 %x, i16 %y) nounwind {
17 ; CHECK-LABEL: shl_or:
19 ; CHECK-NEXT: lsl w8, w0, #12
20 ; CHECK-NEXT: orr w0, w8, w1, lsl #7
28 define i32 @shl_xor(i32 %x, i32 %y) nounwind {
29 ; CHECK-LABEL: shl_xor:
31 ; CHECK-NEXT: lsl w8, w0, #12
32 ; CHECK-NEXT: eor w0, w8, w1, lsl #7
40 define i64 @lshr_and(i64 %x, i64 %y) nounwind {
41 ; CHECK-LABEL: lshr_and:
43 ; CHECK-NEXT: lsr x8, x0, #12
44 ; CHECK-NEXT: and x0, x8, x1, lsr #7
52 define <4 x i32> @lshr_or(<4 x i32> %x, <4 x i32> %y) nounwind {
53 ; CHECK-LABEL: lshr_or:
55 ; CHECK-NEXT: ushr v1.4s, v1.4s, #7
56 ; CHECK-NEXT: ushr v0.4s, v0.4s, #12
57 ; CHECK-NEXT: orr v0.16b, v0.16b, v1.16b
59 %sh0 = lshr <4 x i32> %x, <i32 5, i32 5, i32 5, i32 5>
60 %r = or <4 x i32> %sh0, %y
61 %sh1 = lshr <4 x i32> %r, <i32 7, i32 7, i32 7, i32 7>
65 define <8 x i16> @lshr_xor(<8 x i16> %x, <8 x i16> %y) nounwind {
66 ; CHECK-LABEL: lshr_xor:
68 ; CHECK-NEXT: ushr v1.8h, v1.8h, #7
69 ; CHECK-NEXT: ushr v0.8h, v0.8h, #12
70 ; CHECK-NEXT: eor v0.16b, v0.16b, v1.16b
72 %sh0 = lshr <8 x i16> %x, <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
73 %r = xor <8 x i16> %y, %sh0
74 %sh1 = lshr <8 x i16> %r, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
79 define <16 x i8> @ashr_and(<16 x i8> %x, <16 x i8> %y) nounwind {
80 ; CHECK-LABEL: ashr_and:
82 ; CHECK-NEXT: sshr v1.16b, v1.16b, #2
83 ; CHECK-NEXT: sshr v0.16b, v0.16b, #5
84 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
86 %sh0 = ashr <16 x i8> %x, <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>
87 %r = and <16 x i8> %y, %sh0
88 %sh1 = ashr <16 x i8> %r, <i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2>
92 define <2 x i64> @ashr_or(<2 x i64> %x, <2 x i64> %y) nounwind {
93 ; CHECK-LABEL: ashr_or:
95 ; CHECK-NEXT: sshr v1.2d, v1.2d, #7
96 ; CHECK-NEXT: sshr v0.2d, v0.2d, #12
97 ; CHECK-NEXT: orr v0.16b, v0.16b, v1.16b
99 %sh0 = ashr <2 x i64> %x, <i64 5, i64 5>
100 %r = or <2 x i64> %sh0, %y
101 %sh1 = ashr <2 x i64> %r, <i64 7, i64 7>
105 define i32 @ashr_xor(i32 %x, i32 %y) nounwind {
106 ; CHECK-LABEL: ashr_xor:
108 ; CHECK-NEXT: asr w8, w0, #12
109 ; CHECK-NEXT: eor w0, w8, w1, asr #7
111 %sh0 = ashr i32 %x, 5
112 %r = xor i32 %y, %sh0
113 %sh1 = ashr i32 %r, 7
117 define i32 @shr_mismatch_xor(i32 %x, i32 %y) nounwind {
118 ; CHECK-LABEL: shr_mismatch_xor:
120 ; CHECK-NEXT: eor w8, w1, w0, asr #5
121 ; CHECK-NEXT: lsr w0, w8, #7
123 %sh0 = ashr i32 %x, 5
124 %r = xor i32 %y, %sh0
125 %sh1 = lshr i32 %r, 7
129 define i32 @ashr_overshift_xor(i32 %x, i32 %y) nounwind {
130 ; CHECK-LABEL: ashr_overshift_xor:
132 ; CHECK-NEXT: eor w8, w1, w0, asr #15
133 ; CHECK-NEXT: asr w0, w8, #17
135 %sh0 = ashr i32 %x, 15
136 %r = xor i32 %y, %sh0
137 %sh1 = ashr i32 %r, 17
141 define i32 @lshr_or_extra_use(i32 %x, i32 %y, i32* %p) nounwind {
142 ; CHECK-LABEL: lshr_or_extra_use:
144 ; CHECK-NEXT: orr w8, w1, w0, lsr #5
145 ; CHECK-NEXT: lsr w0, w8, #7
146 ; CHECK-NEXT: str w8, [x2]
148 %sh0 = lshr i32 %x, 5
150 store i32 %r, i32* %p
151 %sh1 = lshr i32 %r, 7