blob: e7ac594bcb540fa385cffd09e61220dce48a5655 [file] [log] [blame]
Matt Wala83b80362014-07-16 10:21:30 -07001; This file tests bitcasts of vector type. For most operations, these
2; should be lowered to a no-op on -O2.
3
John Porto7e6aa5a2016-03-02 15:10:19 -08004; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8632 --args -O2 \
5; RUN: | FileCheck --check-prefix=X86-O2 --check-prefix=X86 %s
6; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8632 --args -Om1 \
7; RUN: | FileCheck --check-prefix=X86 %s
8
9; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8664 --args -O2 \
10; RUN: | FileCheck --check-prefix=X86-O2 --check-prefix=X86 %s
11; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8664 --args -Om1 \
12; RUN: | FileCheck --check-prefix=X86 %s
13
14; RUN: %p2i -i %s --filetype=obj --disassemble --target=arm32 --args -O2 \
15; RUN: | FileCheck --check-prefix=ARM32-O2-O2 --check-prefix=ARM32 %s
16; RUN: %p2i -i %s --filetype=obj --disassemble --target=arm32 --args -Om1 \
17; RUN: | FileCheck --check-prefix=ARM32 %s
Matt Wala83b80362014-07-16 10:21:30 -070018
Karl Schimpf57d31ac2015-10-07 09:53:12 -070019define internal <16 x i8> @test_bitcast_v16i8_to_v16i8(<16 x i8> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070020entry:
21 %res = bitcast <16 x i8> %arg to <16 x i8>
22 ret <16 x i8> %res
23
John Porto7e6aa5a2016-03-02 15:10:19 -080024; X86-O2-LABEL: test_bitcast_v16i8_to_v16i8
25; X86-O2-NEXT: ret
26
27; ARM32-O2-LABEL: test_bitcast_v16i8_to_v16i8
28; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -070029}
30
Karl Schimpf57d31ac2015-10-07 09:53:12 -070031define internal <8 x i16> @test_bitcast_v16i8_to_v8i16(<16 x i8> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070032entry:
33 %res = bitcast <16 x i8> %arg to <8 x i16>
34 ret <8 x i16> %res
35
John Porto7e6aa5a2016-03-02 15:10:19 -080036; X86-O2-LABEL: test_bitcast_v16i8_to_v8i16
37; X86-O2-NEXT: ret
38
39; ARM32-O2-LABEL: test_bitcast_v16i8_to_v8i16
40; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -070041}
42
Karl Schimpf57d31ac2015-10-07 09:53:12 -070043define internal <4 x i32> @test_bitcast_v16i8_to_v4i32(<16 x i8> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070044entry:
45 %res = bitcast <16 x i8> %arg to <4 x i32>
46 ret <4 x i32> %res
47
John Porto7e6aa5a2016-03-02 15:10:19 -080048; X86-O2-LABEL: test_bitcast_v16i8_to_v4i32
49; X86-O2-NEXT: ret
50
51; ARM32-O2-LABEL: test_bitcast_v16i8_to_v4i32
52; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -070053}
54
Karl Schimpf57d31ac2015-10-07 09:53:12 -070055define internal <4 x float> @test_bitcast_v16i8_to_v4f32(<16 x i8> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070056entry:
57 %res = bitcast <16 x i8> %arg to <4 x float>
58 ret <4 x float> %res
59
John Porto7e6aa5a2016-03-02 15:10:19 -080060; X86-O2-LABEL: test_bitcast_v16i8_to_v4f32
61; X86-O2-NEXT: ret
62
63; ARM32-O2-LABEL: test_bitcast_v16i8_to_v4f32
64; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -070065}
66
Karl Schimpf57d31ac2015-10-07 09:53:12 -070067define internal <16 x i8> @test_bitcast_v8i16_to_v16i8(<8 x i16> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070068entry:
69 %res = bitcast <8 x i16> %arg to <16 x i8>
70 ret <16 x i8> %res
71
John Porto7e6aa5a2016-03-02 15:10:19 -080072; X86-O2-LABEL: test_bitcast_v8i16_to_v16i8
73; X86-O2-NEXT: ret
74
75; ARM32-O2-LABEL: test_bitcast_v8i16_to_v16i8
76; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -070077}
78
Karl Schimpf57d31ac2015-10-07 09:53:12 -070079define internal <8 x i16> @test_bitcast_v8i16_to_v8i16(<8 x i16> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070080entry:
81 %res = bitcast <8 x i16> %arg to <8 x i16>
82 ret <8 x i16> %res
83
John Porto7e6aa5a2016-03-02 15:10:19 -080084; X86-O2-LABEL: test_bitcast_v8i16_to_v8i16
85; X86-O2-NEXT: ret
86
87; ARM32-O2-LABEL: test_bitcast_v8i16_to_v8i16
88; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -070089}
90
Karl Schimpf57d31ac2015-10-07 09:53:12 -070091define internal <4 x i32> @test_bitcast_v8i16_to_v4i32(<8 x i16> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -070092entry:
93 %res = bitcast <8 x i16> %arg to <4 x i32>
94 ret <4 x i32> %res
95
John Porto7e6aa5a2016-03-02 15:10:19 -080096; X86-O2-LABEL: test_bitcast_v8i16_to_v4i32
97; X86-O2-NEXT: ret
98
99; ARM32-O2-LABEL: test_bitcast_v8i16_to_v4i32
100; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700101}
102
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700103define internal <4 x float> @test_bitcast_v8i16_to_v4f32(<8 x i16> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700104entry:
105 %res = bitcast <8 x i16> %arg to <4 x float>
106 ret <4 x float> %res
107
John Porto7e6aa5a2016-03-02 15:10:19 -0800108; X86-O2-LABEL: test_bitcast_v8i16_to_v4f32
109; X86-O2-NEXT: ret
110
111; ARM32-O2-LABEL: test_bitcast_v8i16_to_v4f32
112; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700113}
114
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700115define internal <16 x i8> @test_bitcast_v4i32_to_v16i8(<4 x i32> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700116entry:
117 %res = bitcast <4 x i32> %arg to <16 x i8>
118 ret <16 x i8> %res
119
John Porto7e6aa5a2016-03-02 15:10:19 -0800120; X86-O2-LABEL: test_bitcast_v4i32_to_v16i8
121; X86-O2-NEXT: ret
122
123; ARM32-O2-LABEL: test_bitcast_v4i32_to_v16i8
124; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700125}
126
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700127define internal <8 x i16> @test_bitcast_v4i32_to_v8i16(<4 x i32> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700128entry:
129 %res = bitcast <4 x i32> %arg to <8 x i16>
130 ret <8 x i16> %res
131
John Porto7e6aa5a2016-03-02 15:10:19 -0800132; X86-O2-LABEL: test_bitcast_v4i32_to_v8i16
133; X86-O2-NEXT: ret
134
135; ARM32-O2-LABEL: test_bitcast_v4i32_to_v8i16
136; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700137}
138
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700139define internal <4 x i32> @test_bitcast_v4i32_to_v4i32(<4 x i32> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700140entry:
141 %res = bitcast <4 x i32> %arg to <4 x i32>
142 ret <4 x i32> %res
143
John Porto7e6aa5a2016-03-02 15:10:19 -0800144; X86-O2-LABEL: test_bitcast_v4i32_to_v4i32
145; X86-O2-NEXT: ret
146
147; ARM32-O2-LABEL: test_bitcast_v4i32_to_v4i32
148; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700149}
150
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700151define internal <4 x float> @test_bitcast_v4i32_to_v4f32(<4 x i32> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700152entry:
153 %res = bitcast <4 x i32> %arg to <4 x float>
154 ret <4 x float> %res
155
John Porto7e6aa5a2016-03-02 15:10:19 -0800156; X86-O2-LABEL: test_bitcast_v4i32_to_v4f32
157; X86-O2-NEXT: ret
158
159; ARM32-O2-LABEL: test_bitcast_v4i32_to_v4f32
160; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700161}
162
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700163define internal <16 x i8> @test_bitcast_v4f32_to_v16i8(<4 x float> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700164entry:
165 %res = bitcast <4 x float> %arg to <16 x i8>
166 ret <16 x i8> %res
167
John Porto7e6aa5a2016-03-02 15:10:19 -0800168; X86-O2-LABEL: test_bitcast_v4f32_to_v16i8
169; X86-O2-NEXT: ret
170
171; ARM32-O2-LABEL: test_bitcast_v4f32_to_v16i8
172; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700173}
174
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700175define internal <8 x i16> @test_bitcast_v4f32_to_v8i16(<4 x float> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700176entry:
177 %res = bitcast <4 x float> %arg to <8 x i16>
178 ret <8 x i16> %res
179
John Porto7e6aa5a2016-03-02 15:10:19 -0800180; X86-O2-LABEL: test_bitcast_v4f32_to_v8i16
181; X86-O2-NEXT: ret
182
183; ARM32-O2-LABEL: test_bitcast_v4f32_to_v8i16
184; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700185}
186
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700187define internal <4 x i32> @test_bitcast_v4f32_to_v4i32(<4 x float> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700188entry:
189 %res = bitcast <4 x float> %arg to <4 x i32>
190 ret <4 x i32> %res
191
John Porto7e6aa5a2016-03-02 15:10:19 -0800192; X86-O2-LABEL: test_bitcast_v4f32_to_v4i32
193; X86-O2-NEXT: ret
194
195; ARM32-O2-LABEL: test_bitcast_v4f32_to_v4i32
196; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700197}
198
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700199define internal <4 x float> @test_bitcast_v4f32_to_v4f32(<4 x float> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700200entry:
201 %res = bitcast <4 x float> %arg to <4 x float>
202 ret <4 x float> %res
203
John Porto7e6aa5a2016-03-02 15:10:19 -0800204; X86-O2-LABEL: test_bitcast_v4f32_to_v4f32
205; X86-O2-NEXT: ret
206
207; ARM32-O2-LABEL: test_bitcast_v4f32_to_v4f32
208; ARM32-O2-NEXT: bx
Matt Wala83b80362014-07-16 10:21:30 -0700209}
210
David Sehrb19d39c2016-01-13 14:17:37 -0800211define internal i32 @test_bitcast_v8i1_to_i8(<8 x i1> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700212entry:
213 %res = bitcast <8 x i1> %arg to i8
David Sehrb19d39c2016-01-13 14:17:37 -0800214 %res.i32 = zext i8 %res to i32
215 ret i32 %res.i32
Matt Wala83b80362014-07-16 10:21:30 -0700216
John Porto7e6aa5a2016-03-02 15:10:19 -0800217; X86-LABEL: test_bitcast_v8i1_to_i8
218; X86: call {{.*}} R_{{.*}} __Sz_bitcast_8xi1_i8
Matt Wala83b80362014-07-16 10:21:30 -0700219
John Porto7e6aa5a2016-03-02 15:10:19 -0800220; ARM32-LABEL: test_bitcast_v8i1_to_i8
221; ARM32: bl {{.*}} __Sz_bitcast_8xi1_i8
Matt Wala83b80362014-07-16 10:21:30 -0700222}
223
David Sehrb19d39c2016-01-13 14:17:37 -0800224define internal i32 @test_bitcast_v16i1_to_i16(<16 x i1> %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700225entry:
226 %res = bitcast <16 x i1> %arg to i16
David Sehrb19d39c2016-01-13 14:17:37 -0800227 %res.i32 = zext i16 %res to i32
228 ret i32 %res.i32
Matt Wala83b80362014-07-16 10:21:30 -0700229
John Porto7e6aa5a2016-03-02 15:10:19 -0800230; X86-LABEL: test_bitcast_v16i1_to_i16
231; X86: call {{.*}} __Sz_bitcast_16xi1_i16
Matt Wala83b80362014-07-16 10:21:30 -0700232
John Porto7e6aa5a2016-03-02 15:10:19 -0800233; ARM32-LABEL: test_bitcast_v16i1_to_i16
234; ARM32: bl {{.*}} __Sz_bitcast_16xi1_i16
Matt Wala83b80362014-07-16 10:21:30 -0700235}
236
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700237define internal <8 x i1> @test_bitcast_i8_to_v8i1(i32 %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700238entry:
239 %arg.trunc = trunc i32 %arg to i8
240 %res = bitcast i8 %arg.trunc to <8 x i1>
241 ret <8 x i1> %res
242
John Porto7e6aa5a2016-03-02 15:10:19 -0800243; X86-LABEL: test_bitcast_i8_to_v8i1
244; X86: call {{.*}} R_{{.*}} __Sz_bitcast_i8_8xi1
Matt Wala83b80362014-07-16 10:21:30 -0700245
John Porto7e6aa5a2016-03-02 15:10:19 -0800246; ARM32-LABEL: test_bitcast_i8_to_v8i1
247; ARM32: bl {{.*}} __Sz_bitcast_i8_8xi1
Matt Wala83b80362014-07-16 10:21:30 -0700248}
249
Karl Schimpf57d31ac2015-10-07 09:53:12 -0700250define internal <16 x i1> @test_bitcast_i16_to_v16i1(i32 %arg) {
Matt Wala83b80362014-07-16 10:21:30 -0700251entry:
252 %arg.trunc = trunc i32 %arg to i16
253 %res = bitcast i16 %arg.trunc to <16 x i1>
254 ret <16 x i1> %res
255
John Porto7e6aa5a2016-03-02 15:10:19 -0800256; X86-LABEL: test_bitcast_i16_to_v16i1
257; X86: call {{.*}} R_{{.*}} __Sz_bitcast_i16_16xi1
Matt Wala83b80362014-07-16 10:21:30 -0700258
John Porto7e6aa5a2016-03-02 15:10:19 -0800259; ARM32-LABEL: test_bitcast_i16_to_v16i1
260; ARM32: bl {{.*}} __Sz_bitcast_i16_16xi1
Matt Wala83b80362014-07-16 10:21:30 -0700261}