Home | History | Annotate | Download | only in InstCombine
      1 
      2 ; RUN: opt < %s -instcombine -S | not grep fpext
      3 @X = external global float 
      4 @Y = external global float
      5 
      6 define void @test() nounwind  {
      7 entry:
      8 	%tmp = load float* @X, align 4		; <float> [#uses=1]
      9 	%tmp1 = fpext float %tmp to double		; <double> [#uses=1]
     10 	%tmp3 = fadd double %tmp1, 0.000000e+00		; <double> [#uses=1]
     11 	%tmp34 = fptrunc double %tmp3 to float		; <float> [#uses=1]
     12 	store float %tmp34, float* @X, align 4
     13 	ret void
     14 }
     15 
     16 define void @test2() nounwind  {
     17 entry:
     18 	%tmp = load float* @X, align 4		; <float> [#uses=1]
     19 	%tmp1 = fpext float %tmp to double		; <double> [#uses=1]
     20 	%tmp2 = load float* @Y, align 4		; <float> [#uses=1]
     21 	%tmp23 = fpext float %tmp2 to double		; <double> [#uses=1]
     22 	%tmp5 = fmul double %tmp1, %tmp23		; <double> [#uses=1]
     23 	%tmp56 = fptrunc double %tmp5 to float		; <float> [#uses=1]
     24 	store float %tmp56, float* @X, align 4
     25 	ret void
     26 }
     27 
     28 define void @test3() nounwind  {
     29 entry:
     30 	%tmp = load float* @X, align 4		; <float> [#uses=1]
     31 	%tmp1 = fpext float %tmp to double		; <double> [#uses=1]
     32 	%tmp2 = load float* @Y, align 4		; <float> [#uses=1]
     33 	%tmp23 = fpext float %tmp2 to double		; <double> [#uses=1]
     34 	%tmp5 = fdiv double %tmp1, %tmp23		; <double> [#uses=1]
     35 	%tmp56 = fptrunc double %tmp5 to float		; <float> [#uses=1]
     36 	store float %tmp56, float* @X, align 4
     37 	ret void
     38 }
     39 
     40 define void @test4() nounwind  {
     41 entry:
     42 	%tmp = load float* @X, align 4		; <float> [#uses=1]
     43 	%tmp1 = fpext float %tmp to double		; <double> [#uses=1]
     44 	%tmp2 = fsub double -0.000000e+00, %tmp1		; <double> [#uses=1]
     45 	%tmp34 = fptrunc double %tmp2 to float		; <float> [#uses=1]
     46 	store float %tmp34, float* @X, align 4
     47 	ret void
     48 }
     49