1 ; RUN: llc < %s -mtriple=armv7-apple-ios | FileCheck %s
3 @in = global float 0x400921FA00000000, align 4
4 @iin = global i32 -1023, align 4
5 @uin = global i32 1023, align 4
7 declare void @foo_int32x4_t(<4 x i32>)
9 ; Test signed conversion.
12 define void @t1() nounwind {
14 %tmp = load i32* @iin, align 4, !tbaa !3
15 %vecinit.i = insertelement <2 x i32> undef, i32 %tmp, i32 0
16 %vecinit2.i = insertelement <2 x i32> %vecinit.i, i32 %tmp, i32 1
17 %vcvt.i = sitofp <2 x i32> %vecinit2.i to <2 x float>
18 %div.i = fdiv <2 x float> %vcvt.i, <float 8.000000e+00, float 8.000000e+00>
19 tail call void @foo_float32x2_t(<2 x float> %div.i) nounwind
23 declare void @foo_float32x2_t(<2 x float>)
25 ; Test unsigned conversion.
28 define void @t2() nounwind {
30 %tmp = load i32* @uin, align 4, !tbaa !3
31 %vecinit.i = insertelement <2 x i32> undef, i32 %tmp, i32 0
32 %vecinit2.i = insertelement <2 x i32> %vecinit.i, i32 %tmp, i32 1
33 %vcvt.i = uitofp <2 x i32> %vecinit2.i to <2 x float>
34 %div.i = fdiv <2 x float> %vcvt.i, <float 8.000000e+00, float 8.000000e+00>
35 tail call void @foo_float32x2_t(<2 x float> %div.i) nounwind
39 ; Test which should not fold due to non-power of 2.
42 define void @t3() nounwind {
44 %tmp = load i32* @iin, align 4, !tbaa !3
45 %vecinit.i = insertelement <2 x i32> undef, i32 %tmp, i32 0
46 %vecinit2.i = insertelement <2 x i32> %vecinit.i, i32 %tmp, i32 1
47 %vcvt.i = sitofp <2 x i32> %vecinit2.i to <2 x float>
48 %div.i = fdiv <2 x float> %vcvt.i, <float 0x401B333340000000, float 0x401B333340000000>
49 tail call void @foo_float32x2_t(<2 x float> %div.i) nounwind
53 ; Test which should not fold due to power of 2 out of range.
56 define void @t4() nounwind {
58 %tmp = load i32* @iin, align 4, !tbaa !3
59 %vecinit.i = insertelement <2 x i32> undef, i32 %tmp, i32 0
60 %vecinit2.i = insertelement <2 x i32> %vecinit.i, i32 %tmp, i32 1
61 %vcvt.i = sitofp <2 x i32> %vecinit2.i to <2 x float>
62 %div.i = fdiv <2 x float> %vcvt.i, <float 0x4200000000000000, float 0x4200000000000000>
63 tail call void @foo_float32x2_t(<2 x float> %div.i) nounwind
67 ; Test case where const is max power of 2 (i.e., 2^32).
70 define void @t5() nounwind {
72 %tmp = load i32* @iin, align 4, !tbaa !3
73 %vecinit.i = insertelement <2 x i32> undef, i32 %tmp, i32 0
74 %vecinit2.i = insertelement <2 x i32> %vecinit.i, i32 %tmp, i32 1
75 %vcvt.i = sitofp <2 x i32> %vecinit2.i to <2 x float>
76 %div.i = fdiv <2 x float> %vcvt.i, <float 0x41F0000000000000, float 0x41F0000000000000>
77 tail call void @foo_float32x2_t(<2 x float> %div.i) nounwind
84 define void @t6() nounwind {
86 %tmp = load i32* @iin, align 4, !tbaa !3
87 %vecinit.i = insertelement <4 x i32> undef, i32 %tmp, i32 0
88 %vecinit2.i = insertelement <4 x i32> %vecinit.i, i32 %tmp, i32 1
89 %vecinit4.i = insertelement <4 x i32> %vecinit2.i, i32 %tmp, i32 2
90 %vecinit6.i = insertelement <4 x i32> %vecinit4.i, i32 %tmp, i32 3
91 %vcvt.i = sitofp <4 x i32> %vecinit6.i to <4 x float>
92 %div.i = fdiv <4 x float> %vcvt.i, <float 8.000000e+00, float 8.000000e+00, float 8.000000e+00, float 8.000000e+00>
93 tail call void @foo_float32x4_t(<4 x float> %div.i) nounwind
97 declare void @foo_float32x4_t(<4 x float>)
99 !0 = metadata !{metadata !"float", metadata !1}
100 !1 = metadata !{metadata !"omnipotent char", metadata !2}
101 !2 = metadata !{metadata !"Simple C/C++ TBAA", null}
102 !3 = metadata !{metadata !"int", metadata !1}