1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -global-isel < %s | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 ; BIF Bitwise Insert if False
9 define <1 x i8> @test_bitf_v1i8(<1 x i8> %A, <1 x i8> %B, <1 x i8> %C) {
10 ; CHECK-SD-LABEL: test_bitf_v1i8:
12 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
15 ; CHECK-GI-LABEL: test_bitf_v1i8:
17 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
18 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
19 ; CHECK-GI-NEXT: // kill: def $d2 killed $d2 def $q2
20 ; CHECK-GI-NEXT: umov w8, v2.b[0]
21 ; CHECK-GI-NEXT: umov w9, v1.b[0]
22 ; CHECK-GI-NEXT: umov w10, v0.b[0]
23 ; CHECK-GI-NEXT: bic w9, w9, w8
24 ; CHECK-GI-NEXT: and w8, w8, w10
25 ; CHECK-GI-NEXT: orr w8, w9, w8
26 ; CHECK-GI-NEXT: fmov s0, w8
28 %neg = xor <1 x i8> %C, <i8 -1>
29 %and = and <1 x i8> %neg, %B
30 %and1 = and <1 x i8> %C, %A
31 %or = or <1 x i8> %and, %and1
35 ; 16-bit vectors tests
37 define <1 x i16> @test_bitf_v1i16(<1 x i16> %A, <1 x i16> %B, <1 x i16> %C) {
38 ; CHECK-SD-LABEL: test_bitf_v1i16:
40 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
43 ; CHECK-GI-LABEL: test_bitf_v1i16:
45 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
46 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
47 ; CHECK-GI-NEXT: // kill: def $d2 killed $d2 def $q2
48 ; CHECK-GI-NEXT: umov w8, v2.h[0]
49 ; CHECK-GI-NEXT: umov w9, v1.h[0]
50 ; CHECK-GI-NEXT: umov w10, v0.h[0]
51 ; CHECK-GI-NEXT: bic w9, w9, w8
52 ; CHECK-GI-NEXT: and w8, w8, w10
53 ; CHECK-GI-NEXT: orr w8, w9, w8
54 ; CHECK-GI-NEXT: fmov s0, w8
56 %neg = xor <1 x i16> %C, <i16 -1>
57 %and = and <1 x i16> %neg, %B
58 %and1 = and <1 x i16> %C, %A
59 %or = or <1 x i16> %and, %and1
63 ; 32-bit vectors tests
65 define <1 x i32> @test_bitf_v1i32(<1 x i32> %A, <1 x i32> %B, <1 x i32> %C) {
66 ; CHECK-SD-LABEL: test_bitf_v1i32:
68 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
71 ; CHECK-GI-LABEL: test_bitf_v1i32:
73 ; CHECK-GI-NEXT: fmov w8, s2
74 ; CHECK-GI-NEXT: fmov w9, s1
75 ; CHECK-GI-NEXT: fmov w10, s0
76 ; CHECK-GI-NEXT: bic w9, w9, w8
77 ; CHECK-GI-NEXT: and w8, w8, w10
78 ; CHECK-GI-NEXT: orr w8, w9, w8
79 ; CHECK-GI-NEXT: mov v0.s[0], w8
80 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
82 %neg = xor <1 x i32> %C, <i32 -1>
83 %and = and <1 x i32> %neg, %B
84 %and1 = and <1 x i32> %C, %A
85 %or = or <1 x i32> %and, %and1
89 ; 64-bit vectors tests
91 define <1 x i64> @test_bitf_v1i64(<1 x i64> %A, <1 x i64> %B, <1 x i64> %C) {
92 ; CHECK-SD-LABEL: test_bitf_v1i64:
94 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
97 ; CHECK-GI-LABEL: test_bitf_v1i64:
99 ; CHECK-GI-NEXT: fmov x8, d2
100 ; CHECK-GI-NEXT: fmov x9, d1
101 ; CHECK-GI-NEXT: fmov x10, d0
102 ; CHECK-GI-NEXT: bic x9, x9, x8
103 ; CHECK-GI-NEXT: and x8, x8, x10
104 ; CHECK-GI-NEXT: orr x8, x9, x8
105 ; CHECK-GI-NEXT: fmov d0, x8
107 %neg = xor <1 x i64> %C, <i64 -1>
108 %and = and <1 x i64> %neg, %B
109 %and1 = and <1 x i64> %C, %A
110 %or = or <1 x i64> %and, %and1
114 define <2 x i32> @test_bitf_v2i32(<2 x i32> %A, <2 x i32> %B, <2 x i32> %C) {
115 ; CHECK-LABEL: test_bitf_v2i32:
117 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
119 %neg = xor <2 x i32> %C, <i32 -1, i32 -1>
120 %and = and <2 x i32> %neg, %B
121 %and1 = and <2 x i32> %C, %A
122 %or = or <2 x i32> %and, %and1
126 define <4 x i16> @test_bitf_v4i16(<4 x i16> %A, <4 x i16> %B, <4 x i16> %C) {
127 ; CHECK-LABEL: test_bitf_v4i16:
129 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
131 %neg = xor <4 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1>
132 %and = and <4 x i16> %neg, %B
133 %and1 = and <4 x i16> %C, %A
134 %or = or <4 x i16> %and, %and1
138 define <8 x i8> @test_bitf_v8i8(<8 x i8> %A, <8 x i8> %B, <8 x i8> %C) {
139 ; CHECK-LABEL: test_bitf_v8i8:
141 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
143 %neg = xor <8 x i8> %C, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
144 %and = and <8 x i8> %neg, %B
145 %and1 = and <8 x i8> %C, %A
146 %or = or <8 x i8> %and, %and1
150 ; 128-bit vectors tests
152 define <2 x i64> @test_bitf_v2i64(<2 x i64> %A, <2 x i64> %B, <2 x i64> %C) {
153 ; CHECK-LABEL: test_bitf_v2i64:
155 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
157 %neg = xor <2 x i64> %C, <i64 -1, i64 -1>
158 %and = and <2 x i64> %neg, %B
159 %and1 = and <2 x i64> %C, %A
160 %or = or <2 x i64> %and, %and1
164 define <4 x i32> @test_bitf_v4i32(<4 x i32> %A, <4 x i32> %B, <4 x i32> %C) {
165 ; CHECK-LABEL: test_bitf_v4i32:
167 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
169 %neg = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1>
170 %and = and <4 x i32> %neg, %B
171 %and1 = and <4 x i32> %C, %A
172 %or = or <4 x i32> %and, %and1
176 define <8 x i16> @test_bitf_v8i16(<8 x i16> %A, <8 x i16> %B, <8 x i16> %C) {
177 ; CHECK-LABEL: test_bitf_v8i16:
179 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
181 %neg = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
182 %and = and <8 x i16> %neg, %B
183 %and1 = and <8 x i16> %C, %A
184 %or = or <8 x i16> %and, %and1
188 define <16 x i8> @test_bitf_v16i8(<16 x i8> %A, <16 x i8> %B, <16 x i8> %C) {
189 ; CHECK-LABEL: test_bitf_v16i8:
191 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
193 %neg = xor <16 x i8> %C, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
194 %and = and <16 x i8> %neg, %B
195 %and1 = and <16 x i8> %C, %A
196 %or = or <16 x i8> %and, %and1