2017-11-12 05:44:47 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2013-08-24 04:39:19 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+sse4.1 | FileCheck -check-prefix=CHECK-SSE %s
|
2012-08-09 04:31:37 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+avx | FileCheck -check-prefix=CHECK-AVX %s
|
2017-11-12 05:44:48 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+avx512f | FileCheck -check-prefix=CHECK-AVX512 %s
|
2011-12-09 23:44:03 +08:00
|
|
|
|
|
|
|
define float @test1(float %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundss $9, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundss $9, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundss $9, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call float @floorf(float %x) nounwind readnone
|
|
|
|
ret float %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare float @floorf(float) nounwind readnone
|
|
|
|
|
|
|
|
define double @test2(double %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundsd $9, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundsd $9, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundsd $9, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call double @floor(double %x) nounwind readnone
|
|
|
|
ret double %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare double @floor(double) nounwind readnone
|
|
|
|
|
|
|
|
define float @test3(float %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundss $12, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundss $12, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundss $12, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call float @nearbyintf(float %x) nounwind readnone
|
|
|
|
ret float %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare float @nearbyintf(float) nounwind readnone
|
|
|
|
|
|
|
|
define double @test4(double %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundsd $12, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundsd $12, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundsd $12, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call double @nearbyint(double %x) nounwind readnone
|
|
|
|
ret double %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare double @nearbyint(double) nounwind readnone
|
|
|
|
|
|
|
|
define float @test5(float %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test5:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundss $10, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test5:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundss $10, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test5:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundss $10, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call float @ceilf(float %x) nounwind readnone
|
|
|
|
ret float %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare float @ceilf(float) nounwind readnone
|
|
|
|
|
|
|
|
define double @test6(double %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test6:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundsd $10, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test6:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundsd $10, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test6:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundsd $10, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call double @ceil(double %x) nounwind readnone
|
|
|
|
ret double %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare double @ceil(double) nounwind readnone
|
|
|
|
|
|
|
|
define float @test7(float %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test7:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundss $4, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test7:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test7:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call float @rintf(float %x) nounwind readnone
|
|
|
|
ret float %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare float @rintf(float) nounwind readnone
|
|
|
|
|
|
|
|
define double @test8(double %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundsd $4, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundsd $4, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundsd $4, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call double @rint(double %x) nounwind readnone
|
|
|
|
ret double %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare double @rint(double) nounwind readnone
|
|
|
|
|
|
|
|
define float @test9(float %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test9:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundss $11, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test9:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test9:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call float @truncf(float %x) nounwind readnone
|
|
|
|
ret float %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare float @truncf(float) nounwind readnone
|
|
|
|
|
|
|
|
define double @test10(double %x) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-SSE-LABEL: test10:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-SSE: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-SSE-NEXT: roundsd $11, %xmm0, %xmm0
|
|
|
|
; CHECK-SSE-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-AVX-LABEL: test10:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX: ## %bb.0:
|
2017-11-12 05:44:47 +08:00
|
|
|
; CHECK-AVX-NEXT: vroundsd $11, %xmm0, %xmm0, %xmm0
|
|
|
|
; CHECK-AVX-NEXT: retq
|
2017-11-12 05:44:48 +08:00
|
|
|
;
|
|
|
|
; CHECK-AVX512-LABEL: test10:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-AVX512: ## %bb.0:
|
2018-02-13 12:19:26 +08:00
|
|
|
; CHECK-AVX512-NEXT: vroundsd $11, %xmm0, %xmm0, %xmm0
|
2017-11-12 05:44:48 +08:00
|
|
|
; CHECK-AVX512-NEXT: retq
|
2017-11-12 05:44:47 +08:00
|
|
|
%call = tail call double @trunc(double %x) nounwind readnone
|
|
|
|
ret double %call
|
2011-12-09 23:44:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare double @trunc(double) nounwind readnone
|