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: fmov x8, d0
18 ; CHECK-GI-NEXT: fmov x9, d1
19 ; CHECK-GI-NEXT: fmov x10, d2
20 ; CHECK-GI-NEXT: bic w9, w9, w10
21 ; CHECK-GI-NEXT: and w8, w10, w8
22 ; CHECK-GI-NEXT: orr w8, w9, w8
23 ; CHECK-GI-NEXT: fmov s0, w8
25 %neg = xor <1 x i8> %C, <i8 -1>
26 %and = and <1 x i8> %neg, %B
27 %and1 = and <1 x i8> %C, %A
28 %or = or <1 x i8> %and, %and1
32 ; 16-bit vectors tests
34 define <1 x i16> @test_bitf_v1i16(<1 x i16> %A, <1 x i16> %B, <1 x i16> %C) {
35 ; CHECK-SD-LABEL: test_bitf_v1i16:
37 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
40 ; CHECK-GI-LABEL: test_bitf_v1i16:
42 ; CHECK-GI-NEXT: fmov x8, d0
43 ; CHECK-GI-NEXT: fmov x9, d1
44 ; CHECK-GI-NEXT: fmov x10, d2
45 ; CHECK-GI-NEXT: bic w9, w9, w10
46 ; CHECK-GI-NEXT: and w8, w10, w8
47 ; CHECK-GI-NEXT: orr w8, w9, w8
48 ; CHECK-GI-NEXT: fmov s0, w8
50 %neg = xor <1 x i16> %C, <i16 -1>
51 %and = and <1 x i16> %neg, %B
52 %and1 = and <1 x i16> %C, %A
53 %or = or <1 x i16> %and, %and1
57 ; 32-bit vectors tests
59 define <1 x i32> @test_bitf_v1i32(<1 x i32> %A, <1 x i32> %B, <1 x i32> %C) {
60 ; CHECK-SD-LABEL: test_bitf_v1i32:
62 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
65 ; CHECK-GI-LABEL: test_bitf_v1i32:
67 ; CHECK-GI-NEXT: fmov x8, d0
68 ; CHECK-GI-NEXT: fmov x9, d1
69 ; CHECK-GI-NEXT: fmov x10, d2
70 ; CHECK-GI-NEXT: bic w9, w9, w10
71 ; CHECK-GI-NEXT: and w8, w10, w8
72 ; CHECK-GI-NEXT: orr w8, w9, w8
73 ; CHECK-GI-NEXT: fmov s0, w8
74 ; CHECK-GI-NEXT: mov v0.s[1], w8
75 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
77 %neg = xor <1 x i32> %C, <i32 -1>
78 %and = and <1 x i32> %neg, %B
79 %and1 = and <1 x i32> %C, %A
80 %or = or <1 x i32> %and, %and1
84 ; 64-bit vectors tests
86 define <1 x i64> @test_bitf_v1i64(<1 x i64> %A, <1 x i64> %B, <1 x i64> %C) {
87 ; CHECK-SD-LABEL: test_bitf_v1i64:
89 ; CHECK-SD-NEXT: bif v0.8b, v1.8b, v2.8b
92 ; CHECK-GI-LABEL: test_bitf_v1i64:
94 ; CHECK-GI-NEXT: fmov x8, d2
95 ; CHECK-GI-NEXT: fmov x9, d1
96 ; CHECK-GI-NEXT: fmov x10, d0
97 ; CHECK-GI-NEXT: bic x9, x9, x8
98 ; CHECK-GI-NEXT: and x8, x8, x10
99 ; CHECK-GI-NEXT: orr x8, x9, x8
100 ; CHECK-GI-NEXT: fmov d0, x8
102 %neg = xor <1 x i64> %C, <i64 -1>
103 %and = and <1 x i64> %neg, %B
104 %and1 = and <1 x i64> %C, %A
105 %or = or <1 x i64> %and, %and1
109 define <2 x i32> @test_bitf_v2i32(<2 x i32> %A, <2 x i32> %B, <2 x i32> %C) {
110 ; CHECK-LABEL: test_bitf_v2i32:
112 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
114 %neg = xor <2 x i32> %C, <i32 -1, i32 -1>
115 %and = and <2 x i32> %neg, %B
116 %and1 = and <2 x i32> %C, %A
117 %or = or <2 x i32> %and, %and1
121 define <4 x i16> @test_bitf_v4i16(<4 x i16> %A, <4 x i16> %B, <4 x i16> %C) {
122 ; CHECK-LABEL: test_bitf_v4i16:
124 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
126 %neg = xor <4 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1>
127 %and = and <4 x i16> %neg, %B
128 %and1 = and <4 x i16> %C, %A
129 %or = or <4 x i16> %and, %and1
133 define <8 x i8> @test_bitf_v8i8(<8 x i8> %A, <8 x i8> %B, <8 x i8> %C) {
134 ; CHECK-LABEL: test_bitf_v8i8:
136 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
138 %neg = xor <8 x i8> %C, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
139 %and = and <8 x i8> %neg, %B
140 %and1 = and <8 x i8> %C, %A
141 %or = or <8 x i8> %and, %and1
145 ; 128-bit vectors tests
147 define <2 x i64> @test_bitf_v2i64(<2 x i64> %A, <2 x i64> %B, <2 x i64> %C) {
148 ; CHECK-LABEL: test_bitf_v2i64:
150 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
152 %neg = xor <2 x i64> %C, <i64 -1, i64 -1>
153 %and = and <2 x i64> %neg, %B
154 %and1 = and <2 x i64> %C, %A
155 %or = or <2 x i64> %and, %and1
159 define <4 x i32> @test_bitf_v4i32(<4 x i32> %A, <4 x i32> %B, <4 x i32> %C) {
160 ; CHECK-LABEL: test_bitf_v4i32:
162 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
164 %neg = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1>
165 %and = and <4 x i32> %neg, %B
166 %and1 = and <4 x i32> %C, %A
167 %or = or <4 x i32> %and, %and1
171 define <8 x i16> @test_bitf_v8i16(<8 x i16> %A, <8 x i16> %B, <8 x i16> %C) {
172 ; CHECK-LABEL: test_bitf_v8i16:
174 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
176 %neg = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
177 %and = and <8 x i16> %neg, %B
178 %and1 = and <8 x i16> %C, %A
179 %or = or <8 x i16> %and, %and1
183 define <16 x i8> @test_bitf_v16i8(<16 x i8> %A, <16 x i8> %B, <16 x i8> %C) {
184 ; CHECK-LABEL: test_bitf_v16i8:
186 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
188 %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>
189 %and = and <16 x i8> %neg, %B
190 %and1 = and <16 x i8> %C, %A
191 %or = or <16 x i8> %and, %and1