blob: bfb77191a75f36dd100ade1a85a567ad51cb30ac [file] [log] [blame]
Nadav Rotem27b848a2011-02-13 15:45:34 +00001; RUN: opt < %s -instcombine -S | FileCheck %s
Nadav Rotem10134c32011-02-11 19:37:55 +00002
Stephen Linc1c7a132013-07-14 01:42:54 +00003; CHECK-LABEL: @a(
Nadav Rotem27b848a2011-02-13 15:45:34 +00004; CHECK-NOT: bitcast
5; CHECK: ret
Nadav Rotem10134c32011-02-11 19:37:55 +00006define <4 x i32> @a(<1 x i64> %y) {
7 %c = bitcast <2 x i64> <i64 0, i64 0> to <4 x i32>
8 ret <4 x i32> %c
9}
10
Stephen Linc1c7a132013-07-14 01:42:54 +000011; CHECK-LABEL: @b(
Nadav Rotem0e162c52011-02-13 16:13:16 +000012; CHECK-NOT: bitcast
Nadav Rotem27b848a2011-02-13 15:45:34 +000013; CHECK: ret
14
Nadav Rotem10134c32011-02-11 19:37:55 +000015define <4 x i32> @b(<1 x i64> %y) {
16 %c = bitcast <2 x i64> <i64 -1, i64 -1> to <4 x i32>
17 ret <4 x i32> %c
18}
19
Stephen Linc1c7a132013-07-14 01:42:54 +000020; CHECK-LABEL: @foo(
Nadav Rotem7cc6d122011-02-17 21:22:27 +000021; CHECK-NOT: bitcast
22; CHECK: ret
Nadav Rotem27b848a2011-02-13 15:45:34 +000023
24; from MultiSource/Benchmarks/Bullet
25define <2 x float> @foo() {
26 %cast = bitcast i64 -1 to <2 x float>
27 ret <2 x float> %cast
28}
29
Nadav Rotem10134c32011-02-11 19:37:55 +000030
Stephen Linc1c7a132013-07-14 01:42:54 +000031; CHECK-LABEL: @foo2(
Nadav Rotem7cc6d122011-02-17 21:22:27 +000032; CHECK-NOT: bitcast
33; CHECK: ret
34define <2 x double> @foo2() {
35 %cast = bitcast i128 -1 to <2 x double>
36 ret <2 x double> %cast
37}
Nadav Rotem10134c32011-02-11 19:37:55 +000038
Stephen Linc1c7a132013-07-14 01:42:54 +000039; CHECK-LABEL: @foo3(
Nadav Rotem7cc6d122011-02-17 21:22:27 +000040; CHECK-NOT: bitcast
41; CHECK: ret
42define <1 x float> @foo3() {
43 %cast = bitcast i32 -1 to <1 x float>
44 ret <1 x float> %cast
45}
46
Stephen Linc1c7a132013-07-14 01:42:54 +000047; CHECK-LABEL: @foo4(
Nadav Rotem7cc6d122011-02-17 21:22:27 +000048; CHECK-NOT: bitcast
49; CHECK: ret
50define float @foo4() {
51 %cast = bitcast <1 x i32 ><i32 -1> to float
52 ret float %cast
53}
54
Stephen Linc1c7a132013-07-14 01:42:54 +000055; CHECK-LABEL: @foo5(
Nadav Rotem7cc6d122011-02-17 21:22:27 +000056; CHECK-NOT: bitcast
57; CHECK: ret
58define double @foo5() {
59 %cast = bitcast <2 x i32 ><i32 -1, i32 -1> to double
60 ret double %cast
61}
62
63
Stephen Linc1c7a132013-07-14 01:42:54 +000064; CHECK-LABEL: @foo6(
Nadav Rotem7cc6d122011-02-17 21:22:27 +000065; CHECK-NOT: bitcast
66; CHECK: ret
67define <2 x double> @foo6() {
68 %cast = bitcast <4 x i32><i32 -1, i32 -1, i32 -1, i32 -1> to <2 x double>
69 ret <2 x double> %cast
70}