2017-08-05 07:36:03 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2007-09-27 05:12:10 +08:00
|
|
|
; Make sure this testcase codegens to the sin and cos instructions, not calls
|
2017-08-05 07:36:03 +08:00
|
|
|
; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | FileCheck %s --check-prefix=CHECK --check-prefix=UNSAFE
|
|
|
|
; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2009-09-26 02:15:29 +08:00
|
|
|
declare float @sinf(float) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2009-09-26 02:15:29 +08:00
|
|
|
declare double @sin(double) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2009-09-26 02:15:29 +08:00
|
|
|
declare x86_fp80 @sinl(x86_fp80) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
|
|
|
|
define float @test1(float %X) {
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-LABEL: test1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-NEXT: subl $12, %esp
|
|
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 16
|
|
|
|
; CHECK-NEXT: flds {{[0-9]+}}(%esp)
|
|
|
|
; CHECK-NEXT: fstps (%esp)
|
|
|
|
; CHECK-NEXT: calll _sinf
|
|
|
|
; CHECK-NEXT: addl $12, %esp
|
|
|
|
; CHECK-NEXT: retl
|
2009-09-26 02:15:29 +08:00
|
|
|
%Y = call float @sinf(float %X) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
ret float %Y
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test2(double %X) {
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-LABEL: test2:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-NEXT: subl $12, %esp
|
|
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 16
|
|
|
|
; CHECK-NEXT: fldl {{[0-9]+}}(%esp)
|
|
|
|
; CHECK-NEXT: fstpl (%esp)
|
|
|
|
; CHECK-NEXT: calll _sin
|
|
|
|
; CHECK-NEXT: addl $12, %esp
|
|
|
|
; CHECK-NEXT: retl
|
2009-09-26 02:15:29 +08:00
|
|
|
%Y = call double @sin(double %X) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
ret double %Y
|
|
|
|
}
|
2012-09-15 20:44:27 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
define x86_fp80 @test3(x86_fp80 %X) {
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-LABEL: test3:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-NEXT: subl $28, %esp
|
|
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 32
|
|
|
|
; CHECK-NEXT: fldt {{[0-9]+}}(%esp)
|
|
|
|
; CHECK-NEXT: fstpt (%esp)
|
|
|
|
; CHECK-NEXT: calll _sinl
|
|
|
|
; CHECK-NEXT: addl $28, %esp
|
|
|
|
; CHECK-NEXT: retl
|
2009-09-26 02:15:29 +08:00
|
|
|
%Y = call x86_fp80 @sinl(x86_fp80 %X) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
ret x86_fp80 %Y
|
|
|
|
}
|
|
|
|
|
2009-09-26 02:15:29 +08:00
|
|
|
declare float @cosf(float) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2009-09-26 02:15:29 +08:00
|
|
|
declare double @cos(double) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2009-09-26 02:15:29 +08:00
|
|
|
declare x86_fp80 @cosl(x86_fp80) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2012-07-03 11:59:22 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
define float @test4(float %X) {
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-LABEL: test4:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-NEXT: subl $12, %esp
|
|
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 16
|
|
|
|
; CHECK-NEXT: flds {{[0-9]+}}(%esp)
|
|
|
|
; CHECK-NEXT: fstps (%esp)
|
|
|
|
; CHECK-NEXT: calll _cosf
|
|
|
|
; CHECK-NEXT: addl $12, %esp
|
|
|
|
; CHECK-NEXT: retl
|
2009-09-26 02:15:29 +08:00
|
|
|
%Y = call float @cosf(float %X) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
ret float %Y
|
|
|
|
}
|
2012-09-15 20:44:27 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
define double @test5(double %X) {
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-LABEL: test5:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-NEXT: subl $12, %esp
|
|
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 16
|
|
|
|
; CHECK-NEXT: fldl {{[0-9]+}}(%esp)
|
|
|
|
; CHECK-NEXT: fstpl (%esp)
|
|
|
|
; CHECK-NEXT: calll _cos
|
|
|
|
; CHECK-NEXT: addl $12, %esp
|
|
|
|
; CHECK-NEXT: retl
|
2009-09-26 02:15:29 +08:00
|
|
|
%Y = call double @cos(double %X) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
ret double %Y
|
|
|
|
}
|
2012-09-15 20:44:27 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
define x86_fp80 @test6(x86_fp80 %X) {
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-LABEL: test6:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-08-12 04:55:29 +08:00
|
|
|
; CHECK-NEXT: subl $28, %esp
|
|
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 32
|
|
|
|
; CHECK-NEXT: fldt {{[0-9]+}}(%esp)
|
|
|
|
; CHECK-NEXT: fstpt (%esp)
|
|
|
|
; CHECK-NEXT: calll _cosl
|
|
|
|
; CHECK-NEXT: addl $28, %esp
|
|
|
|
; CHECK-NEXT: retl
|
2009-09-26 02:15:29 +08:00
|
|
|
%Y = call x86_fp80 @cosl(x86_fp80 %X) readonly
|
2007-09-27 05:12:10 +08:00
|
|
|
ret x86_fp80 %Y
|
|
|
|
}
|