Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x7FF8000000000000 | count 12
      2 ; RUN: opt < %s -simplifycfg -instcombine -S | grep "0\.0" | count 3
      3 ; RUN: opt < %s -simplifycfg -instcombine -S | grep "3\.5" | count 1
      4 ;
      5 
      6 ; ModuleID = 'apf.c'
      7 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"
      8 target triple = "i386-apple-darwin9.6"
      9 @"\01LC" = internal constant [4 x i8] c"%f\0A\00"		; <[4 x i8]*> [#uses=1]
     10 
     11 define void @foo1() nounwind {
     12 entry:
     13 	%y = alloca float		; <float*> [#uses=2]
     14 	%x = alloca float		; <float*> [#uses=2]
     15 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
     16 	store float 0x7FF0000000000000, float* %x, align 4
     17 	store float 0x7FF8000000000000, float* %y, align 4
     18 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
     19 	%1 = fpext float %0 to double		; <double> [#uses=1]
     20 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
     21 	%3 = fpext float %2 to double		; <double> [#uses=1]
     22 	%4 = frem double %3, %1		; <double> [#uses=1]
     23 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
     24 	br label %return
     25 
     26 return:		; preds = %entry
     27 	ret void
     28 }
     29 
     30 declare i32 @printf(i8*, ...) nounwind
     31 
     32 define void @foo2() nounwind {
     33 entry:
     34 	%y = alloca float		; <float*> [#uses=2]
     35 	%x = alloca float		; <float*> [#uses=2]
     36 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
     37 	store float 0x7FF0000000000000, float* %x, align 4
     38 	store float 0.000000e+00, float* %y, align 4
     39 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
     40 	%1 = fpext float %0 to double		; <double> [#uses=1]
     41 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
     42 	%3 = fpext float %2 to double		; <double> [#uses=1]
     43 	%4 = frem double %3, %1		; <double> [#uses=1]
     44 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
     45 	br label %return
     46 
     47 return:		; preds = %entry
     48 	ret void
     49 }
     50 
     51 define void @foo3() nounwind {
     52 entry:
     53 	%y = alloca float		; <float*> [#uses=2]
     54 	%x = alloca float		; <float*> [#uses=2]
     55 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
     56 	store float 0x7FF0000000000000, float* %x, align 4
     57 	store float 3.500000e+00, float* %y, align 4
     58 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
     59 	%1 = fpext float %0 to double		; <double> [#uses=1]
     60 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
     61 	%3 = fpext float %2 to double		; <double> [#uses=1]
     62 	%4 = frem double %3, %1		; <double> [#uses=1]
     63 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
     64 	br label %return
     65 
     66 return:		; preds = %entry
     67 	ret void
     68 }
     69 
     70 define void @foo4() nounwind {
     71 entry:
     72 	%y = alloca float		; <float*> [#uses=2]
     73 	%x = alloca float		; <float*> [#uses=2]
     74 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
     75 	store float 0x7FF0000000000000, float* %x, align 4
     76 	store float 0x7FF0000000000000, float* %y, align 4
     77 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
     78 	%1 = fpext float %0 to double		; <double> [#uses=1]
     79 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
     80 	%3 = fpext float %2 to double		; <double> [#uses=1]
     81 	%4 = frem double %3, %1		; <double> [#uses=1]
     82 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
     83 	br label %return
     84 
     85 return:		; preds = %entry
     86 	ret void
     87 }
     88 
     89 define void @foo5() nounwind {
     90 entry:
     91 	%y = alloca float		; <float*> [#uses=2]
     92 	%x = alloca float		; <float*> [#uses=2]
     93 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
     94 	store float 0x7FF8000000000000, float* %x, align 4
     95 	store float 0x7FF0000000000000, float* %y, align 4
     96 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
     97 	%1 = fpext float %0 to double		; <double> [#uses=1]
     98 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
     99 	%3 = fpext float %2 to double		; <double> [#uses=1]
    100 	%4 = frem double %3, %1		; <double> [#uses=1]
    101 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    102 	br label %return
    103 
    104 return:		; preds = %entry
    105 	ret void
    106 }
    107 
    108 define void @foo6() nounwind {
    109 entry:
    110 	%y = alloca float		; <float*> [#uses=2]
    111 	%x = alloca float		; <float*> [#uses=2]
    112 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    113 	store float 0x7FF8000000000000, float* %x, align 4
    114 	store float 0.000000e+00, float* %y, align 4
    115 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    116 	%1 = fpext float %0 to double		; <double> [#uses=1]
    117 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    118 	%3 = fpext float %2 to double		; <double> [#uses=1]
    119 	%4 = frem double %3, %1		; <double> [#uses=1]
    120 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    121 	br label %return
    122 
    123 return:		; preds = %entry
    124 	ret void
    125 }
    126 
    127 define void @foo7() nounwind {
    128 entry:
    129 	%y = alloca float		; <float*> [#uses=2]
    130 	%x = alloca float		; <float*> [#uses=2]
    131 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    132 	store float 0x7FF8000000000000, float* %x, align 4
    133 	store float 3.500000e+00, float* %y, align 4
    134 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    135 	%1 = fpext float %0 to double		; <double> [#uses=1]
    136 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    137 	%3 = fpext float %2 to double		; <double> [#uses=1]
    138 	%4 = frem double %3, %1		; <double> [#uses=1]
    139 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    140 	br label %return
    141 
    142 return:		; preds = %entry
    143 	ret void
    144 }
    145 
    146 define void @foo8() nounwind {
    147 entry:
    148 	%y = alloca float		; <float*> [#uses=2]
    149 	%x = alloca float		; <float*> [#uses=2]
    150 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    151 	store float 0x7FF8000000000000, float* %x, align 4
    152 	store float 0x7FF8000000000000, float* %y, align 4
    153 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    154 	%1 = fpext float %0 to double		; <double> [#uses=1]
    155 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    156 	%3 = fpext float %2 to double		; <double> [#uses=1]
    157 	%4 = frem double %3, %1		; <double> [#uses=1]
    158 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    159 	br label %return
    160 
    161 return:		; preds = %entry
    162 	ret void
    163 }
    164 
    165 define void @foo9() nounwind {
    166 entry:
    167 	%y = alloca float		; <float*> [#uses=2]
    168 	%x = alloca float		; <float*> [#uses=2]
    169 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    170 	store float 0.000000e+00, float* %x, align 4
    171 	store float 0x7FF8000000000000, float* %y, align 4
    172 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    173 	%1 = fpext float %0 to double		; <double> [#uses=1]
    174 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    175 	%3 = fpext float %2 to double		; <double> [#uses=1]
    176 	%4 = frem double %3, %1		; <double> [#uses=1]
    177 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    178 	br label %return
    179 
    180 return:		; preds = %entry
    181 	ret void
    182 }
    183 
    184 define void @foo10() nounwind {
    185 entry:
    186 	%y = alloca float		; <float*> [#uses=2]
    187 	%x = alloca float		; <float*> [#uses=2]
    188 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    189 	store float 0.000000e+00, float* %x, align 4
    190 	store float 0x7FF0000000000000, float* %y, align 4
    191 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    192 	%1 = fpext float %0 to double		; <double> [#uses=1]
    193 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    194 	%3 = fpext float %2 to double		; <double> [#uses=1]
    195 	%4 = frem double %3, %1		; <double> [#uses=1]
    196 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    197 	br label %return
    198 
    199 return:		; preds = %entry
    200 	ret void
    201 }
    202 
    203 define void @foo11() nounwind {
    204 entry:
    205 	%y = alloca float		; <float*> [#uses=2]
    206 	%x = alloca float		; <float*> [#uses=2]
    207 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    208 	store float 0.000000e+00, float* %x, align 4
    209 	store float 0.000000e+00, float* %y, align 4
    210 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    211 	%1 = fpext float %0 to double		; <double> [#uses=1]
    212 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    213 	%3 = fpext float %2 to double		; <double> [#uses=1]
    214 	%4 = frem double %3, %1		; <double> [#uses=1]
    215 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    216 	br label %return
    217 
    218 return:		; preds = %entry
    219 	ret void
    220 }
    221 
    222 define void @foo12() nounwind {
    223 entry:
    224 	%y = alloca float		; <float*> [#uses=2]
    225 	%x = alloca float		; <float*> [#uses=2]
    226 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    227 	store float 0.000000e+00, float* %x, align 4
    228 	store float 3.500000e+00, float* %y, align 4
    229 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    230 	%1 = fpext float %0 to double		; <double> [#uses=1]
    231 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    232 	%3 = fpext float %2 to double		; <double> [#uses=1]
    233 	%4 = frem double %3, %1		; <double> [#uses=1]
    234 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    235 	br label %return
    236 
    237 return:		; preds = %entry
    238 	ret void
    239 }
    240 
    241 define void @foo13() nounwind {
    242 entry:
    243 	%y = alloca float		; <float*> [#uses=2]
    244 	%x = alloca float		; <float*> [#uses=2]
    245 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    246 	store float 3.500000e+00, float* %x, align 4
    247 	store float 0x7FF8000000000000, float* %y, align 4
    248 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    249 	%1 = fpext float %0 to double		; <double> [#uses=1]
    250 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    251 	%3 = fpext float %2 to double		; <double> [#uses=1]
    252 	%4 = frem double %3, %1		; <double> [#uses=1]
    253 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    254 	br label %return
    255 
    256 return:		; preds = %entry
    257 	ret void
    258 }
    259 
    260 define void @foo14() nounwind {
    261 entry:
    262 	%y = alloca float		; <float*> [#uses=2]
    263 	%x = alloca float		; <float*> [#uses=2]
    264 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    265 	store float 3.500000e+00, float* %x, align 4
    266 	store float 0x7FF0000000000000, float* %y, align 4
    267 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    268 	%1 = fpext float %0 to double		; <double> [#uses=1]
    269 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    270 	%3 = fpext float %2 to double		; <double> [#uses=1]
    271 	%4 = frem double %3, %1		; <double> [#uses=1]
    272 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    273 	br label %return
    274 
    275 return:		; preds = %entry
    276 	ret void
    277 }
    278 
    279 define void @foo15() nounwind {
    280 entry:
    281 	%y = alloca float		; <float*> [#uses=2]
    282 	%x = alloca float		; <float*> [#uses=2]
    283 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    284 	store float 3.500000e+00, float* %x, align 4
    285 	store float 0.000000e+00, float* %y, align 4
    286 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    287 	%1 = fpext float %0 to double		; <double> [#uses=1]
    288 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    289 	%3 = fpext float %2 to double		; <double> [#uses=1]
    290 	%4 = frem double %3, %1		; <double> [#uses=1]
    291 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    292 	br label %return
    293 
    294 return:		; preds = %entry
    295 	ret void
    296 }
    297 
    298 define void @foo16() nounwind {
    299 entry:
    300 	%y = alloca float		; <float*> [#uses=2]
    301 	%x = alloca float		; <float*> [#uses=2]
    302 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
    303 	store float 3.500000e+00, float* %x, align 4
    304 	store float 3.500000e+00, float* %y, align 4
    305 	%0 = load float, float* %y, align 4		; <float> [#uses=1]
    306 	%1 = fpext float %0 to double		; <double> [#uses=1]
    307 	%2 = load float, float* %x, align 4		; <float> [#uses=1]
    308 	%3 = fpext float %2 to double		; <double> [#uses=1]
    309 	%4 = frem double %3, %1		; <double> [#uses=1]
    310 	%5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind		; <i32> [#uses=0]
    311 	br label %return
    312 
    313 return:		; preds = %entry
    314 	ret void
    315 }
    316