OLD | NEW |
1 ; This file tests bitcasts of vector type. For most operations, these | 1 ; This file tests bitcasts of vector type. For most operations, these |
2 ; should be lowered to a no-op on -O2. | 2 ; should be lowered to a no-op on -O2. |
3 | 3 |
4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s | 4 ; TODO(jvoung): remove -ffunction-sections and the "Disassembly of section..." |
5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s --check-prefix=OPTM1 | 5 ; Sadly... diassembling some "ret" within a section are broken in |
| 6 ; llvm-objdump for LLVM 3.4, and 3.5. It was only fixed in 3.6. |
| 7 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer |
| 8 ; doesn't know how to symbolize non-section-local functions. |
| 9 ; The newer LLVM 3.6 one does work, but watch out for other bugs. |
| 10 |
6 ; RUN: %llvm2ice -O2 --verbose none %s \ | 11 ; RUN: %llvm2ice -O2 --verbose none %s \ |
7 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 12 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s |
8 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 13 ; RUN: %llvm2ice -O2 --verbose none -ffunction-sections %s \ |
9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 14 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 15 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 16 ; RUN: %llvm2ice -Om1 --verbose none -ffunction-sections %s \ |
| 17 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 18 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \ |
| 19 ; RUN: | FileCheck --check-prefix=OPTM1 %s |
10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 20 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 21 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 22 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
13 ; RUN: | FileCheck --check-prefix=DUMP %s | 23 ; RUN: | FileCheck --check-prefix=DUMP %s |
14 | 24 |
15 define <16 x i8> @test_bitcast_v16i8_to_v16i8(<16 x i8> %arg) { | 25 define <16 x i8> @test_bitcast_v16i8_to_v16i8(<16 x i8> %arg) { |
16 entry: | 26 entry: |
17 %res = bitcast <16 x i8> %arg to <16 x i8> | 27 %res = bitcast <16 x i8> %arg to <16 x i8> |
18 ret <16 x i8> %res | 28 ret <16 x i8> %res |
19 | 29 |
20 ; CHECK-LABEL: test_bitcast_v16i8_to_v16i8: | 30 ; CHECK-LABEL: Disassembly of section .text.test |
21 ; CHECK: .L{{.*}}entry: | 31 ; CHECK-LABEL: test_bitcast_v16i8_to_v16i8 |
22 ; CHECK-NEXT: ret | 32 ; CHECK-NEXT: ret |
23 } | 33 } |
24 | 34 |
25 define <8 x i16> @test_bitcast_v16i8_to_v8i16(<16 x i8> %arg) { | 35 define <8 x i16> @test_bitcast_v16i8_to_v8i16(<16 x i8> %arg) { |
26 entry: | 36 entry: |
27 %res = bitcast <16 x i8> %arg to <8 x i16> | 37 %res = bitcast <16 x i8> %arg to <8 x i16> |
28 ret <8 x i16> %res | 38 ret <8 x i16> %res |
29 | 39 |
30 ; CHECK-LABEL: test_bitcast_v16i8_to_v8i16: | 40 ; CHECK-LABEL: Disassembly of section .text.test |
31 ; CHECK: .L{{.*}}entry: | 41 ; CHECK-LABEL: test_bitcast_v16i8_to_v8i16 |
32 ; CHECK-NEXT: ret | 42 ; CHECK-NEXT: ret |
33 } | 43 } |
34 | 44 |
35 define <4 x i32> @test_bitcast_v16i8_to_v4i32(<16 x i8> %arg) { | 45 define <4 x i32> @test_bitcast_v16i8_to_v4i32(<16 x i8> %arg) { |
36 entry: | 46 entry: |
37 %res = bitcast <16 x i8> %arg to <4 x i32> | 47 %res = bitcast <16 x i8> %arg to <4 x i32> |
38 ret <4 x i32> %res | 48 ret <4 x i32> %res |
39 | 49 |
| 50 ; CHECK-LABEL: Disassembly of section .text.test |
40 ; CHECK-LABEL: test_bitcast_v16i8_to_v4i32: | 51 ; CHECK-LABEL: test_bitcast_v16i8_to_v4i32: |
41 ; CHECK: .L{{.*}}entry: | |
42 ; CHECK-NEXT: ret | 52 ; CHECK-NEXT: ret |
43 } | 53 } |
44 | 54 |
45 define <4 x float> @test_bitcast_v16i8_to_v4f32(<16 x i8> %arg) { | 55 define <4 x float> @test_bitcast_v16i8_to_v4f32(<16 x i8> %arg) { |
46 entry: | 56 entry: |
47 %res = bitcast <16 x i8> %arg to <4 x float> | 57 %res = bitcast <16 x i8> %arg to <4 x float> |
48 ret <4 x float> %res | 58 ret <4 x float> %res |
49 | 59 |
| 60 ; CHECK-LABEL: Disassembly of section .text.test |
50 ; CHECK-LABEL: test_bitcast_v16i8_to_v4f32: | 61 ; CHECK-LABEL: test_bitcast_v16i8_to_v4f32: |
51 ; CHECK: .L{{.*}}entry: | |
52 ; CHECK-NEXT: ret | 62 ; CHECK-NEXT: ret |
53 } | 63 } |
54 | 64 |
55 define <16 x i8> @test_bitcast_v8i16_to_v16i8(<8 x i16> %arg) { | 65 define <16 x i8> @test_bitcast_v8i16_to_v16i8(<8 x i16> %arg) { |
56 entry: | 66 entry: |
57 %res = bitcast <8 x i16> %arg to <16 x i8> | 67 %res = bitcast <8 x i16> %arg to <16 x i8> |
58 ret <16 x i8> %res | 68 ret <16 x i8> %res |
59 | 69 |
| 70 ; CHECK-LABEL: Disassembly of section .text.test |
60 ; CHECK-LABEL: test_bitcast_v8i16_to_v16i8: | 71 ; CHECK-LABEL: test_bitcast_v8i16_to_v16i8: |
61 ; CHECK: .L{{.*}}entry: | |
62 ; CHECK-NEXT: ret | 72 ; CHECK-NEXT: ret |
63 } | 73 } |
64 | 74 |
65 define <8 x i16> @test_bitcast_v8i16_to_v8i16(<8 x i16> %arg) { | 75 define <8 x i16> @test_bitcast_v8i16_to_v8i16(<8 x i16> %arg) { |
66 entry: | 76 entry: |
67 %res = bitcast <8 x i16> %arg to <8 x i16> | 77 %res = bitcast <8 x i16> %arg to <8 x i16> |
68 ret <8 x i16> %res | 78 ret <8 x i16> %res |
69 | 79 |
| 80 ; CHECK-LABEL: Disassembly of section .text.test |
70 ; CHECK-LABEL: test_bitcast_v8i16_to_v8i16: | 81 ; CHECK-LABEL: test_bitcast_v8i16_to_v8i16: |
71 ; CHECK: .L{{.*}}entry: | |
72 ; CHECK-NEXT: ret | 82 ; CHECK-NEXT: ret |
73 } | 83 } |
74 | 84 |
75 define <4 x i32> @test_bitcast_v8i16_to_v4i32(<8 x i16> %arg) { | 85 define <4 x i32> @test_bitcast_v8i16_to_v4i32(<8 x i16> %arg) { |
76 entry: | 86 entry: |
77 %res = bitcast <8 x i16> %arg to <4 x i32> | 87 %res = bitcast <8 x i16> %arg to <4 x i32> |
78 ret <4 x i32> %res | 88 ret <4 x i32> %res |
79 | 89 |
| 90 ; CHECK-LABEL: Disassembly of section .text.test |
80 ; CHECK-LABEL: test_bitcast_v8i16_to_v4i32: | 91 ; CHECK-LABEL: test_bitcast_v8i16_to_v4i32: |
81 ; CHECK: .L{{.*}}entry: | |
82 ; CHECK-NEXT: ret | 92 ; CHECK-NEXT: ret |
83 } | 93 } |
84 | 94 |
85 define <4 x float> @test_bitcast_v8i16_to_v4f32(<8 x i16> %arg) { | 95 define <4 x float> @test_bitcast_v8i16_to_v4f32(<8 x i16> %arg) { |
86 entry: | 96 entry: |
87 %res = bitcast <8 x i16> %arg to <4 x float> | 97 %res = bitcast <8 x i16> %arg to <4 x float> |
88 ret <4 x float> %res | 98 ret <4 x float> %res |
89 | 99 |
| 100 ; CHECK-LABEL: Disassembly of section .text.test |
90 ; CHECK-LABEL: test_bitcast_v8i16_to_v4f32: | 101 ; CHECK-LABEL: test_bitcast_v8i16_to_v4f32: |
91 ; CHECK: .L{{.*}}entry: | |
92 ; CHECK-NEXT: ret | 102 ; CHECK-NEXT: ret |
93 } | 103 } |
94 | 104 |
95 define <16 x i8> @test_bitcast_v4i32_to_v16i8(<4 x i32> %arg) { | 105 define <16 x i8> @test_bitcast_v4i32_to_v16i8(<4 x i32> %arg) { |
96 entry: | 106 entry: |
97 %res = bitcast <4 x i32> %arg to <16 x i8> | 107 %res = bitcast <4 x i32> %arg to <16 x i8> |
98 ret <16 x i8> %res | 108 ret <16 x i8> %res |
99 | 109 |
| 110 ; CHECK-LABEL: Disassembly of section .text.test |
100 ; CHECK-LABEL: test_bitcast_v4i32_to_v16i8: | 111 ; CHECK-LABEL: test_bitcast_v4i32_to_v16i8: |
101 ; CHECK: .L{{.*}}entry: | |
102 ; CHECK-NEXT: ret | 112 ; CHECK-NEXT: ret |
103 } | 113 } |
104 | 114 |
105 define <8 x i16> @test_bitcast_v4i32_to_v8i16(<4 x i32> %arg) { | 115 define <8 x i16> @test_bitcast_v4i32_to_v8i16(<4 x i32> %arg) { |
106 entry: | 116 entry: |
107 %res = bitcast <4 x i32> %arg to <8 x i16> | 117 %res = bitcast <4 x i32> %arg to <8 x i16> |
108 ret <8 x i16> %res | 118 ret <8 x i16> %res |
109 | 119 |
| 120 ; CHECK-LABEL: Disassembly of section .text.test |
110 ; CHECK-LABEL: test_bitcast_v4i32_to_v8i16: | 121 ; CHECK-LABEL: test_bitcast_v4i32_to_v8i16: |
111 ; CHECK: .L{{.*}}entry: | |
112 ; CHECK-NEXT: ret | 122 ; CHECK-NEXT: ret |
113 } | 123 } |
114 | 124 |
115 define <4 x i32> @test_bitcast_v4i32_to_v4i32(<4 x i32> %arg) { | 125 define <4 x i32> @test_bitcast_v4i32_to_v4i32(<4 x i32> %arg) { |
116 entry: | 126 entry: |
117 %res = bitcast <4 x i32> %arg to <4 x i32> | 127 %res = bitcast <4 x i32> %arg to <4 x i32> |
118 ret <4 x i32> %res | 128 ret <4 x i32> %res |
119 | 129 |
| 130 ; CHECK-LABEL: Disassembly of section .text.test |
120 ; CHECK-LABEL: test_bitcast_v4i32_to_v4i32: | 131 ; CHECK-LABEL: test_bitcast_v4i32_to_v4i32: |
121 ; CHECK: .L{{.*}}entry: | |
122 ; CHECK-NEXT: ret | 132 ; CHECK-NEXT: ret |
123 } | 133 } |
124 | 134 |
125 define <4 x float> @test_bitcast_v4i32_to_v4f32(<4 x i32> %arg) { | 135 define <4 x float> @test_bitcast_v4i32_to_v4f32(<4 x i32> %arg) { |
126 entry: | 136 entry: |
127 %res = bitcast <4 x i32> %arg to <4 x float> | 137 %res = bitcast <4 x i32> %arg to <4 x float> |
128 ret <4 x float> %res | 138 ret <4 x float> %res |
129 | 139 |
| 140 ; CHECK-LABEL: Disassembly of section .text.test |
130 ; CHECK-LABEL: test_bitcast_v4i32_to_v4f32: | 141 ; CHECK-LABEL: test_bitcast_v4i32_to_v4f32: |
131 ; CHECK: .L{{.*}}entry: | |
132 ; CHECK-NEXT: ret | 142 ; CHECK-NEXT: ret |
133 } | 143 } |
134 | 144 |
135 define <16 x i8> @test_bitcast_v4f32_to_v16i8(<4 x float> %arg) { | 145 define <16 x i8> @test_bitcast_v4f32_to_v16i8(<4 x float> %arg) { |
136 entry: | 146 entry: |
137 %res = bitcast <4 x float> %arg to <16 x i8> | 147 %res = bitcast <4 x float> %arg to <16 x i8> |
138 ret <16 x i8> %res | 148 ret <16 x i8> %res |
139 | 149 |
| 150 ; CHECK-LABEL: Disassembly of section .text.test |
140 ; CHECK-LABEL: test_bitcast_v4f32_to_v16i8: | 151 ; CHECK-LABEL: test_bitcast_v4f32_to_v16i8: |
141 ; CHECK: .L{{.*}}entry: | |
142 ; CHECK-NEXT: ret | 152 ; CHECK-NEXT: ret |
143 } | 153 } |
144 | 154 |
145 define <8 x i16> @test_bitcast_v4f32_to_v8i16(<4 x float> %arg) { | 155 define <8 x i16> @test_bitcast_v4f32_to_v8i16(<4 x float> %arg) { |
146 entry: | 156 entry: |
147 %res = bitcast <4 x float> %arg to <8 x i16> | 157 %res = bitcast <4 x float> %arg to <8 x i16> |
148 ret <8 x i16> %res | 158 ret <8 x i16> %res |
149 | 159 |
| 160 ; CHECK-LABEL: Disassembly of section .text.test |
150 ; CHECK-LABEL: test_bitcast_v4f32_to_v8i16: | 161 ; CHECK-LABEL: test_bitcast_v4f32_to_v8i16: |
151 ; CHECK: .L{{.*}}entry: | |
152 ; CHECK-NEXT: ret | 162 ; CHECK-NEXT: ret |
153 } | 163 } |
154 | 164 |
155 define <4 x i32> @test_bitcast_v4f32_to_v4i32(<4 x float> %arg) { | 165 define <4 x i32> @test_bitcast_v4f32_to_v4i32(<4 x float> %arg) { |
156 entry: | 166 entry: |
157 %res = bitcast <4 x float> %arg to <4 x i32> | 167 %res = bitcast <4 x float> %arg to <4 x i32> |
158 ret <4 x i32> %res | 168 ret <4 x i32> %res |
159 | 169 |
| 170 ; CHECK-LABEL: Disassembly of section .text.test |
160 ; CHECK-LABEL: test_bitcast_v4f32_to_v4i32: | 171 ; CHECK-LABEL: test_bitcast_v4f32_to_v4i32: |
161 ; CHECK: .L{{.*}}entry: | |
162 ; CHECK-NEXT: ret | 172 ; CHECK-NEXT: ret |
163 } | 173 } |
164 | 174 |
165 define <4 x float> @test_bitcast_v4f32_to_v4f32(<4 x float> %arg) { | 175 define <4 x float> @test_bitcast_v4f32_to_v4f32(<4 x float> %arg) { |
166 entry: | 176 entry: |
167 %res = bitcast <4 x float> %arg to <4 x float> | 177 %res = bitcast <4 x float> %arg to <4 x float> |
168 ret <4 x float> %res | 178 ret <4 x float> %res |
169 | 179 |
| 180 ; CHECK-LABEL: Disassembly of section .text.test |
170 ; CHECK-LABEL: test_bitcast_v4f32_to_v4f32: | 181 ; CHECK-LABEL: test_bitcast_v4f32_to_v4f32: |
171 ; CHECK: .L{{.*}}entry: | |
172 ; CHECK-NEXT: ret | 182 ; CHECK-NEXT: ret |
173 } | 183 } |
174 | 184 |
175 define i8 @test_bitcast_v8i1_to_i8(<8 x i1> %arg) { | 185 define i8 @test_bitcast_v8i1_to_i8(<8 x i1> %arg) { |
176 entry: | 186 entry: |
177 %res = bitcast <8 x i1> %arg to i8 | 187 %res = bitcast <8 x i1> %arg to i8 |
178 ret i8 %res | 188 ret i8 %res |
179 | 189 |
180 ; CHECK-LABEL: test_bitcast_v8i1_to_i8: | 190 ; CHECK-LABEL: test_bitcast_v8i1_to_i8: |
181 ; CHECK: call Sz_bitcast_v8i1_to_i8 | 191 ; CHECK: call -4 |
| 192 ; CALLTARGETS-LABEL: test_bitcast_v8i1_to_i8: |
| 193 ; CALLTARGETS: call Sz_bitcast_v8i1_to_i8 |
182 | 194 |
183 ; OPTM1-LABEL: test_bitcast_v8i1_to_i8: | 195 ; OPTM1-LABEL: test_bitcast_v8i1_to_i8: |
184 ; OPMT1: call Sz_bitcast_v8i1_to_i8 | 196 ; OPMT1: call -4 |
185 } | 197 } |
186 | 198 |
187 define i16 @test_bitcast_v16i1_to_i16(<16 x i1> %arg) { | 199 define i16 @test_bitcast_v16i1_to_i16(<16 x i1> %arg) { |
188 entry: | 200 entry: |
189 %res = bitcast <16 x i1> %arg to i16 | 201 %res = bitcast <16 x i1> %arg to i16 |
190 ret i16 %res | 202 ret i16 %res |
191 | 203 |
192 ; CHECK-LABEL: test_bitcast_v16i1_to_i16: | 204 ; CHECK-LABEL: test_bitcast_v16i1_to_i16: |
193 ; CHECK: call Sz_bitcast_v16i1_to_i16 | 205 ; CHECK: call -4 |
| 206 ; CALLTARGETS-LABEL: test_bitcast_v16i1_to_i16: |
| 207 ; CALLTARGETS: call Sz_bitcast_v16i1_to_i16 |
194 | 208 |
195 ; OPTM1-LABEL: test_bitcast_v16i1_to_i16: | 209 ; OPTM1-LABEL: test_bitcast_v16i1_to_i16: |
196 ; OPMT1: call Sz_bitcast_v16i1_to_i16 | 210 ; OPMT1: call -4 |
197 } | 211 } |
198 | 212 |
199 define <8 x i1> @test_bitcast_i8_to_v8i1(i32 %arg) { | 213 define <8 x i1> @test_bitcast_i8_to_v8i1(i32 %arg) { |
200 entry: | 214 entry: |
201 %arg.trunc = trunc i32 %arg to i8 | 215 %arg.trunc = trunc i32 %arg to i8 |
202 %res = bitcast i8 %arg.trunc to <8 x i1> | 216 %res = bitcast i8 %arg.trunc to <8 x i1> |
203 ret <8 x i1> %res | 217 ret <8 x i1> %res |
204 | 218 |
205 ; CHECK-LABEL: test_bitcast_i8_to_v8i1: | 219 ; CHECK-LABEL: test_bitcast_i8_to_v8i1: |
206 ; CHECK: call Sz_bitcast_i8_to_v8i1 | 220 ; CHECK: call -4 |
| 221 ; CALLTARGETS-LABEL: test_bitcast_i8_to_v8i1 |
| 222 ; CALLTARGETS: call Sz_bitcast_i8_to_v8i1 |
207 | 223 |
208 ; OPTM1-LABEL: test_bitcast_i8_to_v8i1: | 224 ; OPTM1-LABEL: test_bitcast_i8_to_v8i1: |
209 ; OPTM1: call Sz_bitcast_i8_to_v8i1 | 225 ; OPTM1: call -4 |
210 } | 226 } |
211 | 227 |
212 define <16 x i1> @test_bitcast_i16_to_v16i1(i32 %arg) { | 228 define <16 x i1> @test_bitcast_i16_to_v16i1(i32 %arg) { |
213 entry: | 229 entry: |
214 %arg.trunc = trunc i32 %arg to i16 | 230 %arg.trunc = trunc i32 %arg to i16 |
215 %res = bitcast i16 %arg.trunc to <16 x i1> | 231 %res = bitcast i16 %arg.trunc to <16 x i1> |
216 ret <16 x i1> %res | 232 ret <16 x i1> %res |
217 | 233 |
218 ; CHECK-LABEL: test_bitcast_i16_to_v16i1: | 234 ; CHECK-LABEL: test_bitcast_i16_to_v16i1: |
219 ; CHECK: call Sz_bitcast_i16_to_v16i1 | 235 ; CHECK: call -4 |
| 236 ; CALLTARGETS-LABEL: test_bitcast_i16_to_v16i1 |
| 237 ; CALLTARGETS: call Sz_bitcast_i16_to_v16i1 |
220 | 238 |
221 ; OPTM1-LABEL: test_bitcast_i16_to_v16i1: | 239 ; OPTM1-LABEL: test_bitcast_i16_to_v16i1: |
222 ; OPTM1: call Sz_bitcast_i16_to_v16i1 | 240 ; OPTM1: call -4 |
223 } | 241 } |
224 | 242 |
225 ; ERRORS-NOT: ICE translation error | 243 ; ERRORS-NOT: ICE translation error |
226 ; DUMP-NOT: SZ | 244 ; DUMP-NOT: SZ |
OLD | NEW |