Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 ; Formerly crashed, PR8490.
      3 
      4 define fastcc double @gimp_operation_color_balance_map(float %value, double %highlights) nounwind readnone inlinehint {
      5 entry:
      6 ; CHECK: gimp_operation_color_balance_map
      7 ; CHECK: fsub double -0.000000
      8   %conv = fpext float %value to double
      9   %div = fdiv double %conv, 1.600000e+01
     10   %add = fadd double %div, 1.000000e+00
     11   %div1 = fdiv double 1.000000e+00, %add
     12   %sub = fsub double 1.075000e+00, %div1
     13   %sub24 = fsub double 1.000000e+00, %sub
     14   %add26 = fadd double %sub, 1.000000e+00
     15   %cmp86 = fcmp ogt double %highlights, 0.000000e+00
     16   %cond90 = select i1 %cmp86, double %sub24, double %add26
     17   %mul91 = fmul double %highlights, %cond90
     18   %add94 = fadd double undef, %mul91
     19   ret double %add94
     20 }
     21 
     22 ; PR10180: same crash, but with vectors
     23 define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {
     24 ; CHECK-LABEL: @foo(
     25 ; CHECK: fsub <4 x float>
     26 ; CHECK: select
     27 ; CHECK: fadd <4 x float>
     28   %a = fadd <4 x float> %x, %y
     29   %sub = fsub <4 x float> %x, %z
     30   %sel = select i1 %b, <4 x float> %a, <4 x float> %sub 
     31   ret <4 x float> %sel
     32 }
     33