2012-04-27 15:11:58 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2 -mcpu=nehalem | FileCheck %s
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2 -mcpu=nehalem | FileCheck %s
|
2009-12-18 15:40:29 +08:00
|
|
|
|
|
|
|
define double @t1(float* nocapture %x) nounwind readonly ssp {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t1:
|
2011-02-22 15:19:20 +08:00
|
|
|
; CHECK: movss ([[A0:%rdi|%rcx]]), %xmm0
|
2010-06-27 04:05:06 +08:00
|
|
|
; CHECK: cvtss2sd %xmm0, %xmm0
|
2009-12-18 15:40:29 +08:00
|
|
|
|
|
|
|
%0 = load float* %x, align 4
|
|
|
|
%1 = fpext float %0 to double
|
|
|
|
ret double %1
|
|
|
|
}
|
|
|
|
|
2009-12-23 01:47:23 +08:00
|
|
|
define float @t2(double* nocapture %x) nounwind readonly ssp optsize {
|
2009-12-18 15:40:29 +08:00
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: t2:
|
2011-02-22 15:19:20 +08:00
|
|
|
; CHECK: cvtsd2ss ([[A0]]), %xmm0
|
2009-12-18 15:40:29 +08:00
|
|
|
%0 = load double* %x, align 8
|
|
|
|
%1 = fptrunc double %0 to float
|
|
|
|
ret float %1
|
|
|
|
}
|
2010-07-13 04:46:04 +08:00
|
|
|
|
|
|
|
define float @squirtf(float* %x) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: squirtf:
|
2011-02-22 15:19:20 +08:00
|
|
|
; CHECK: movss ([[A0]]), %xmm0
|
2010-07-13 04:46:04 +08:00
|
|
|
; CHECK: sqrtss %xmm0, %xmm0
|
|
|
|
%z = load float* %x
|
|
|
|
%t = call float @llvm.sqrt.f32(float %z)
|
|
|
|
ret float %t
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @squirt(double* %x) nounwind {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: squirt:
|
2012-08-02 08:56:42 +08:00
|
|
|
; CHECK: sqrtsd ([[A0]]), %xmm0
|
2010-07-13 04:46:04 +08:00
|
|
|
%z = load double* %x
|
|
|
|
%t = call double @llvm.sqrt.f64(double %z)
|
|
|
|
ret double %t
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @squirtf_size(float* %x) nounwind optsize {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: squirtf_size:
|
2011-02-22 15:19:20 +08:00
|
|
|
; CHECK: sqrtss ([[A0]]), %xmm0
|
2010-07-13 04:46:04 +08:00
|
|
|
%z = load float* %x
|
|
|
|
%t = call float @llvm.sqrt.f32(float %z)
|
|
|
|
ret float %t
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @squirt_size(double* %x) nounwind optsize {
|
|
|
|
entry:
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: squirt_size:
|
2011-02-22 15:19:20 +08:00
|
|
|
; CHECK: sqrtsd ([[A0]]), %xmm0
|
2010-07-13 04:46:04 +08:00
|
|
|
%z = load double* %x
|
|
|
|
%t = call double @llvm.sqrt.f64(double %z)
|
|
|
|
ret double %t
|
|
|
|
}
|
|
|
|
|
|
|
|
declare float @llvm.sqrt.f32(float)
|
|
|
|
declare double @llvm.sqrt.f64(double)
|