2015-11-24 05:33:58 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2015-04-04 01:13:31 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s
|
2010-08-13 04:20:53 +08:00
|
|
|
|
2011-08-09 11:04:23 +08:00
|
|
|
define <8 x float> @sitofp00(<8 x i32> %a) nounwind {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: sitofp00:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtdq2ps %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-09 11:04:23 +08:00
|
|
|
%b = sitofp <8 x i32> %a to <8 x float>
|
|
|
|
ret <8 x float> %b
|
|
|
|
}
|
2010-08-13 04:20:53 +08:00
|
|
|
|
2011-08-09 11:04:23 +08:00
|
|
|
define <8 x i32> @fptosi00(<8 x float> %a) nounwind {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: fptosi00:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-09 11:04:23 +08:00
|
|
|
%b = fptosi <8 x float> %a to <8 x i32>
|
|
|
|
ret <8 x i32> %b
|
2010-08-13 04:20:53 +08:00
|
|
|
}
|
|
|
|
|
2011-08-10 01:39:13 +08:00
|
|
|
define <4 x double> @sitofp01(<4 x i32> %a) {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: sitofp01:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtdq2pd %xmm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-10 01:39:13 +08:00
|
|
|
%b = sitofp <4 x i32> %a to <4 x double>
|
|
|
|
ret <4 x double> %b
|
|
|
|
}
|
|
|
|
|
2013-03-31 20:49:15 +08:00
|
|
|
define <8 x float> @sitofp02(<8 x i16> %a) {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: sitofp02:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vpmovsxwd %xmm0, %xmm1
|
|
|
|
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
|
|
|
|
; CHECK-NEXT: vpmovsxwd %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
|
|
|
|
; CHECK-NEXT: vcvtdq2ps %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2013-03-31 20:49:15 +08:00
|
|
|
%b = sitofp <8 x i16> %a to <8 x float>
|
|
|
|
ret <8 x float> %b
|
|
|
|
}
|
|
|
|
|
2011-08-10 01:39:13 +08:00
|
|
|
define <4 x i32> @fptosi01(<4 x double> %a) {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: fptosi01:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvttpd2dqy %ymm0, %xmm0
|
|
|
|
; CHECK-NEXT: vzeroupper
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-10 01:39:13 +08:00
|
|
|
%b = fptosi <4 x double> %a to <4 x i32>
|
|
|
|
ret <4 x i32> %b
|
|
|
|
}
|
|
|
|
|
2011-08-09 11:04:23 +08:00
|
|
|
define <8 x float> @fptrunc00(<8 x double> %b) nounwind {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: fptrunc00:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtpd2psy %ymm0, %xmm0
|
|
|
|
; CHECK-NEXT: vcvtpd2psy %ymm1, %xmm1
|
|
|
|
; CHECK-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-09 11:04:23 +08:00
|
|
|
%a = fptrunc <8 x double> %b to <8 x float>
|
|
|
|
ret <8 x float> %a
|
2011-08-09 11:04:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x double> @fpext00(<4 x float> %b) nounwind {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: fpext00:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtps2pd %xmm0, %ymm0
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-09 11:04:29 +08:00
|
|
|
%a = fpext <4 x float> %b to <4 x double>
|
|
|
|
ret <4 x double> %a
|
2011-06-16 15:03:21 +08:00
|
|
|
}
|
2011-07-16 08:50:20 +08:00
|
|
|
|
|
|
|
define double @funcA(i64* nocapture %e) nounwind uwtable readonly ssp {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: funcA:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtsi2sdq (%rdi), %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: retq
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp1 = load i64, i64* %e, align 8
|
2011-07-16 08:50:20 +08:00
|
|
|
%conv = sitofp i64 %tmp1 to double
|
|
|
|
ret double %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @funcB(i32* nocapture %e) nounwind uwtable readonly ssp {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: funcB:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtsi2sdl (%rdi), %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: retq
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp1 = load i32, i32* %e, align 4
|
2011-07-16 08:50:20 +08:00
|
|
|
%conv = sitofp i32 %tmp1 to double
|
|
|
|
ret double %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @funcC(i32* nocapture %e) nounwind uwtable readonly ssp {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: funcC:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtsi2ssl (%rdi), %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: retq
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp1 = load i32, i32* %e, align 4
|
2011-07-16 08:50:20 +08:00
|
|
|
%conv = sitofp i32 %tmp1 to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @funcD(i64* nocapture %e) nounwind uwtable readonly ssp {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: funcD:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvtsi2ssq (%rdi), %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: retq
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp1 = load i64, i64* %e, align 8
|
2011-07-16 08:50:20 +08:00
|
|
|
%conv = sitofp i64 %tmp1 to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
2011-07-19 01:51:40 +08:00
|
|
|
|
2011-08-09 11:04:23 +08:00
|
|
|
define void @fpext() nounwind uwtable {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: fpext:
|
|
|
|
; CHECK: # BB#0:
|
2015-08-11 16:19:43 +08:00
|
|
|
; CHECK-NEXT: vcvtss2sd -{{[0-9]+}}(%rsp), %xmm0, %xmm0
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-NEXT: vmovsd %xmm0, -{{[0-9]+}}(%rsp)
|
|
|
|
; CHECK-NEXT: retq
|
2011-08-09 11:04:23 +08:00
|
|
|
%f = alloca float, align 4
|
|
|
|
%d = alloca double, align 8
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load float, float* %f, align 4
|
2011-08-09 11:04:23 +08:00
|
|
|
%conv = fpext float %tmp to double
|
|
|
|
store double %conv, double* %d, align 8
|
|
|
|
ret void
|
2011-07-19 01:51:40 +08:00
|
|
|
}
|
|
|
|
|
2015-02-23 23:12:31 +08:00
|
|
|
define double @nearbyint_f64(double %a) {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: nearbyint_f64:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vroundsd $12, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: retq
|
2015-02-23 23:12:31 +08:00
|
|
|
%res = call double @llvm.nearbyint.f64(double %a)
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
declare double @llvm.nearbyint.f64(double %p)
|
|
|
|
|
|
|
|
define float @floor_f32(float %a) {
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-LABEL: floor_f32:
|
|
|
|
; CHECK: # BB#0:
|
2015-09-22 19:43:17 +08:00
|
|
|
; CHECK-NEXT: vroundss $9, %xmm0, %xmm0, %xmm0
|
2015-04-04 01:13:31 +08:00
|
|
|
; CHECK-NEXT: retq
|
2015-02-23 23:12:31 +08:00
|
|
|
%res = call float @llvm.floor.f32(float %a)
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
declare float @llvm.floor.f32(float %p)
|
|
|
|
|
|
|
|
|