Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2 | FileCheck %s
      2 ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2 | FileCheck %s
      3 
      4 define double @t1(float* nocapture %x) nounwind readonly ssp {
      5 entry:
      6 ; CHECK: t1:
      7 ; CHECK: movss ([[A0:%rdi|%rcx]]), %xmm0
      8 ; CHECK: cvtss2sd %xmm0, %xmm0
      9 
     10   %0 = load float* %x, align 4
     11   %1 = fpext float %0 to double
     12   ret double %1
     13 }
     14 
     15 define float @t2(double* nocapture %x) nounwind readonly ssp optsize {
     16 entry:
     17 ; CHECK: t2:
     18 ; CHECK: cvtsd2ss ([[A0]]), %xmm0
     19   %0 = load double* %x, align 8
     20   %1 = fptrunc double %0 to float
     21   ret float %1
     22 }
     23 
     24 define float @squirtf(float* %x) nounwind {
     25 entry:
     26 ; CHECK: squirtf:
     27 ; CHECK: movss ([[A0]]), %xmm0
     28 ; CHECK: sqrtss %xmm0, %xmm0
     29   %z = load float* %x
     30   %t = call float @llvm.sqrt.f32(float %z)
     31   ret float %t
     32 }
     33 
     34 define double @squirt(double* %x) nounwind {
     35 entry:
     36 ; CHECK: squirt:
     37 ; CHECK: movsd ([[A0]]), %xmm0
     38 ; CHECK: sqrtsd %xmm0, %xmm0
     39   %z = load double* %x
     40   %t = call double @llvm.sqrt.f64(double %z)
     41   ret double %t
     42 }
     43 
     44 define float @squirtf_size(float* %x) nounwind optsize {
     45 entry:
     46 ; CHECK: squirtf_size:
     47 ; CHECK: sqrtss ([[A0]]), %xmm0
     48   %z = load float* %x
     49   %t = call float @llvm.sqrt.f32(float %z)
     50   ret float %t
     51 }
     52 
     53 define double @squirt_size(double* %x) nounwind optsize {
     54 entry:
     55 ; CHECK: squirt_size:
     56 ; CHECK: sqrtsd ([[A0]]), %xmm0
     57   %z = load double* %x
     58   %t = call double @llvm.sqrt.f64(double %z)
     59   ret double %t
     60 }
     61 
     62 declare float @llvm.sqrt.f32(float)
     63 declare double @llvm.sqrt.f64(double)
     64