Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -mtriple=x86_64-apple-macosx -S | FileCheck %s
      2 target triple = "x86_64-apple-macosx"
      3 
      4 define double @test1(double %a, double %b) nounwind {
      5   %wa = fpext double %a to x86_fp80
      6   %wb = fpext double %b to x86_fp80
      7   %wr = fadd x86_fp80 %wa, %wb
      8   %r = fptrunc x86_fp80 %wr to double
      9   ret double %r
     10 ; CHECK: test1
     11 ; CHECK: fadd x86_fp80
     12 ; CHECK: ret
     13 }
     14 
     15 define double @test2(double %a, double %b) nounwind {
     16   %wa = fpext double %a to x86_fp80
     17   %wb = fpext double %b to x86_fp80
     18   %wr = fsub x86_fp80 %wa, %wb
     19   %r = fptrunc x86_fp80 %wr to double
     20   ret double %r
     21 ; CHECK: test2
     22 ; CHECK: fsub x86_fp80
     23 ; CHECK: ret
     24 }
     25 
     26 define double @test3(double %a, double %b) nounwind {
     27   %wa = fpext double %a to x86_fp80
     28   %wb = fpext double %b to x86_fp80
     29   %wr = fmul x86_fp80 %wa, %wb
     30   %r = fptrunc x86_fp80 %wr to double
     31   ret double %r
     32 ; CHECK: test3
     33 ; CHECK: fmul x86_fp80
     34 ; CHECK: ret
     35 }
     36 
     37 define double @test4(double %a, half %b) nounwind {
     38   %wa = fpext double %a to x86_fp80
     39   %wb = fpext half %b to x86_fp80
     40   %wr = fmul x86_fp80 %wa, %wb
     41   %r = fptrunc x86_fp80 %wr to double
     42   ret double %r
     43 ; CHECK: test4
     44 ; CHECK: fmul double
     45 ; CHECK: ret
     46 }
     47 
     48 define double @test5(double %a, double %b) nounwind {
     49   %wa = fpext double %a to x86_fp80
     50   %wb = fpext double %b to x86_fp80
     51   %wr = fdiv x86_fp80 %wa, %wb
     52   %r = fptrunc x86_fp80 %wr to double
     53   ret double %r
     54 ; CHECK: test5
     55 ; CHECK: fdiv x86_fp80
     56 ; CHECK: ret
     57 }
     58