1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -O3 -S | FileCheck %s
4 ; Compile time conversions of NaNs.
6 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
7 target triple = "i686-apple-darwin8"
9 %struct..0anon = type { float }
10 %struct..1anon = type { double }
12 @fnan = constant [3 x i32] [ i32 2143831397, i32 2143831396, i32 2143831398 ]
13 @dnan = constant [3 x i64] [ i64 9223235251041752696, i64 9223235251041752697, i64 9223235250773317239 ], align 8
14 @fsnan = constant [3 x i32] [ i32 2139637093, i32 2139637092, i32 2139637094 ]
15 @dsnan = constant [3 x i64] [ i64 9220983451228067448, i64 9220983451228067449, i64 9220983450959631991 ], align 8
16 @.str = internal constant [10 x i8] c"%08x%08x\0A\00"
17 @.str1 = internal constant [6 x i8] c"%08x\0A\00"
19 @var = external global i32
21 ; SNAN becomes QNAN on fptrunc:
22 ; 2147228864 = 0x7ffc1cc0 : QNAN
27 ; CHECK-NEXT: store volatile i32 2147027116, i32* @var, align 4
28 ; CHECK-NEXT: store volatile i32 -1610612736, i32* @var, align 4
29 ; CHECK-NEXT: store volatile i32 2147027116, i32* @var, align 4
30 ; CHECK-NEXT: store volatile i32 -2147483648, i32* @var, align 4
31 ; CHECK-NEXT: store volatile i32 2147027116, i32* @var, align 4
32 ; CHECK-NEXT: store volatile i32 -1073741824, i32* @var, align 4
33 ; CHECK-NEXT: store volatile i32 2147228864, i32* @var, align 4
34 ; CHECK-NEXT: store volatile i32 2147228864, i32* @var, align 4
35 ; CHECK-NEXT: store volatile i32 2147228864, i32* @var, align 4
36 ; CHECK-NEXT: store volatile i32 2147027116, i32* @var, align 4
37 ; CHECK-NEXT: store volatile i32 -1610612736, i32* @var, align 4
38 ; CHECK-NEXT: store volatile i32 2147027116, i32* @var, align 4
39 ; CHECK-NEXT: store volatile i32 -2147483648, i32* @var, align 4
40 ; CHECK-NEXT: store volatile i32 2147027116, i32* @var, align 4
41 ; CHECK-NEXT: store volatile i32 -1073741824, i32* @var, align 4
42 ; CHECK-NEXT: store volatile i32 2147228864, i32* @var, align 4
43 ; CHECK-NEXT: store volatile i32 2147228864, i32* @var, align 4
44 ; CHECK-NEXT: store volatile i32 2147228864, i32* @var, align 4
45 ; CHECK-NEXT: ret i32 undef
48 %retval = alloca i32, align 4
49 %i = alloca i32, align 4
50 %uf = alloca %struct..0anon, align 4
51 %ud = alloca %struct..1anon, align 8
52 %"alloca point" = bitcast i32 0 to i32
53 store i32 0, i32* %i, align 4
57 %t = load i32, i32* %i, align 4
58 %t1 = getelementptr [3 x i32], [3 x i32]* @fnan, i32 0, i32 %t
59 %t2 = load i32, i32* %t1, align 4
60 %t3 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
61 %t34 = bitcast float* %t3 to i32*
62 store i32 %t2, i32* %t34, align 4
63 %t5 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
64 %t6 = load float, float* %t5, align 4
65 %t67 = fpext float %t6 to double
66 %t8 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
67 store double %t67, double* %t8, align 8
68 %t9 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
69 %t910 = bitcast double* %t9 to i64*
70 %t11 = load i64, i64* %t910, align 8
71 %t1112 = trunc i64 %t11 to i32
72 %t13 = and i32 %t1112, -1
73 %t14 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
74 %t1415 = bitcast double* %t14 to i64*
75 %t16 = load i64, i64* %t1415, align 8
76 %.cast = zext i32 32 to i64
77 %t17 = ashr i64 %t16, %.cast
78 %t1718 = trunc i64 %t17 to i32
79 %t19 = getelementptr [10 x i8], [10 x i8]* @.str, i32 0, i32 0
80 store volatile i32 %t1718, i32* @var
81 store volatile i32 %t13, i32* @var
82 %t21 = load i32, i32* %i, align 4
83 %t22 = add i32 %t21, 1
84 store i32 %t22, i32* %i, align 4
87 bb23: ; preds = %bb, %entry
88 %t24 = load i32, i32* %i, align 4
89 %t25 = icmp sle i32 %t24, 2
90 %t2526 = zext i1 %t25 to i8
91 %toBool = icmp ne i8 %t2526, 0
92 br i1 %toBool, label %bb, label %bb27
95 store i32 0, i32* %i, align 4
99 %t29 = load i32, i32* %i, align 4
100 %t30 = getelementptr [3 x i64], [3 x i64]* @dnan, i32 0, i32 %t29
101 %t31 = load i64, i64* %t30, align 8
102 %t32 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
103 %t3233 = bitcast double* %t32 to i64*
104 store i64 %t31, i64* %t3233, align 8
105 %t35 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
106 %t36 = load double, double* %t35, align 8
107 %t3637 = fptrunc double %t36 to float
108 %t38 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
109 store float %t3637, float* %t38, align 4
110 %t39 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
111 %t3940 = bitcast float* %t39 to i32*
112 %t41 = load i32, i32* %t3940, align 4
113 %t42 = getelementptr [6 x i8], [6 x i8]* @.str1, i32 0, i32 0
114 store volatile i32 %t41, i32* @var
115 %t44 = load i32, i32* %i, align 4
116 %t45 = add i32 %t44, 1
117 store i32 %t45, i32* %i, align 4
120 bb46: ; preds = %bb28, %bb27
121 %t47 = load i32, i32* %i, align 4
122 %t48 = icmp sle i32 %t47, 2
123 %t4849 = zext i1 %t48 to i8
124 %toBool50 = icmp ne i8 %t4849, 0
125 br i1 %toBool50, label %bb28, label %bb51
127 bb51: ; preds = %bb46
128 store i32 0, i32* %i, align 4
131 bb52: ; preds = %bb78
132 %t53 = load i32, i32* %i, align 4
133 %t54 = getelementptr [3 x i32], [3 x i32]* @fsnan, i32 0, i32 %t53
134 %t55 = load i32, i32* %t54, align 4
135 %t56 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
136 %t5657 = bitcast float* %t56 to i32*
137 store i32 %t55, i32* %t5657, align 4
138 %t58 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
139 %t59 = load float, float* %t58, align 4
140 %t5960 = fpext float %t59 to double
141 %t61 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
142 store double %t5960, double* %t61, align 8
143 %t62 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
144 %t6263 = bitcast double* %t62 to i64*
145 %t64 = load i64, i64* %t6263, align 8
146 %t6465 = trunc i64 %t64 to i32
147 %t66 = and i32 %t6465, -1
148 %t68 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
149 %t6869 = bitcast double* %t68 to i64*
150 %t70 = load i64, i64* %t6869, align 8
151 %.cast71 = zext i32 32 to i64
152 %t72 = ashr i64 %t70, %.cast71
153 %t7273 = trunc i64 %t72 to i32
154 %t74 = getelementptr [10 x i8], [10 x i8]* @.str, i32 0, i32 0
155 store volatile i32 %t7273, i32* @var
156 store volatile i32 %t66, i32* @var
157 %t76 = load i32, i32* %i, align 4
158 %t77 = add i32 %t76, 1
159 store i32 %t77, i32* %i, align 4
162 bb78: ; preds = %bb52, %bb51
163 %t79 = load i32, i32* %i, align 4
164 %t80 = icmp sle i32 %t79, 2
165 %t8081 = zext i1 %t80 to i8
166 %toBool82 = icmp ne i8 %t8081, 0
167 br i1 %toBool82, label %bb52, label %bb83
169 bb83: ; preds = %bb78
170 store i32 0, i32* %i, align 4
173 bb84: ; preds = %bb101
174 %t85 = load i32, i32* %i, align 4
175 %t86 = getelementptr [3 x i64], [3 x i64]* @dsnan, i32 0, i32 %t85
176 %t87 = load i64, i64* %t86, align 8
177 %t88 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
178 %t8889 = bitcast double* %t88 to i64*
179 store i64 %t87, i64* %t8889, align 8
180 %t90 = getelementptr %struct..1anon, %struct..1anon* %ud, i32 0, i32 0
181 %t91 = load double, double* %t90, align 8
182 %t9192 = fptrunc double %t91 to float
183 %t93 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
184 store float %t9192, float* %t93, align 4
185 %t94 = getelementptr %struct..0anon, %struct..0anon* %uf, i32 0, i32 0
186 %t9495 = bitcast float* %t94 to i32*
187 %t96 = load i32, i32* %t9495, align 4
188 %t97 = getelementptr [6 x i8], [6 x i8]* @.str1, i32 0, i32 0
189 store volatile i32 %t96, i32* @var
190 %t99 = load i32, i32* %i, align 4
191 %t100 = add i32 %t99, 1
192 store i32 %t100, i32* %i, align 4
195 bb101: ; preds = %bb84, %bb83
196 %t102 = load i32, i32* %i, align 4
197 %t103 = icmp sle i32 %t102, 2
198 %t103104 = zext i1 %t103 to i8
199 %toBool105 = icmp ne i8 %t103104, 0
200 br i1 %toBool105, label %bb84, label %bb106
202 bb106: ; preds = %bb101
205 return: ; preds = %bb106
206 %retval107 = load i32, i32* %retval