mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[InstCombine] add tests for llvm.sin(-x); NFC
Also add a corresponding test for llvm.cos with FMF to make sure that was handled correctly. llvm-svn: 340950
This commit is contained in:
parent
2e66151644
commit
e4979e89e5
@ -48,6 +48,18 @@ define <2 x float> @fneg_v2f32(<2 x float> %x) {
|
||||
ret <2 x float> %cos
|
||||
}
|
||||
|
||||
; FMF are not required, but they should propagate.
|
||||
|
||||
define <2 x float> @fneg_cos_fmf(<2 x float> %x){
|
||||
; CHECK-LABEL: @fneg_cos_fmf(
|
||||
; CHECK-NEXT: [[R:%.*]] = call nnan afn <2 x float> @llvm.cos.v2f32(<2 x float> [[X:%.*]])
|
||||
; CHECK-NEXT: ret <2 x float> [[R]]
|
||||
;
|
||||
%negx = fsub fast <2 x float> <float -0.0, float -0.0>, %x
|
||||
%r = call nnan afn <2 x float> @llvm.cos.v2f32(<2 x float> %negx)
|
||||
ret <2 x float> %r
|
||||
}
|
||||
|
||||
define float @fabs_f32(float %x) {
|
||||
; CHECK-LABEL: @fabs_f32(
|
||||
; CHECK-NEXT: [[COS:%.*]] = call float @llvm.cos.f32(float [[X:%.*]])
|
||||
@ -80,3 +92,31 @@ define <2 x float> @fabs_fneg_v2f32(<2 x float> %x) {
|
||||
ret <2 x float> %cos
|
||||
}
|
||||
|
||||
; TODO: Negate is canonicalized after sin.
|
||||
|
||||
declare <2 x float> @llvm.sin.v2f32(<2 x float>)
|
||||
|
||||
define <2 x float> @fneg_sin(<2 x float> %x){
|
||||
; CHECK-LABEL: @fneg_sin(
|
||||
; CHECK-NEXT: [[NEGX:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
|
||||
; CHECK-NEXT: [[R:%.*]] = call <2 x float> @llvm.sin.v2f32(<2 x float> [[NEGX]])
|
||||
; CHECK-NEXT: ret <2 x float> [[R]]
|
||||
;
|
||||
%negx = fsub <2 x float> <float -0.0, float -0.0>, %x
|
||||
%r = call <2 x float> @llvm.sin.v2f32(<2 x float> %negx)
|
||||
ret <2 x float> %r
|
||||
}
|
||||
|
||||
; TODO: FMF are not required, but they should propagate.
|
||||
|
||||
define <2 x float> @fneg_sin_fmf(<2 x float> %x){
|
||||
; CHECK-LABEL: @fneg_sin_fmf(
|
||||
; CHECK-NEXT: [[NEGX:%.*]] = fsub fast <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
|
||||
; CHECK-NEXT: [[R:%.*]] = call nnan arcp afn <2 x float> @llvm.sin.v2f32(<2 x float> [[NEGX]])
|
||||
; CHECK-NEXT: ret <2 x float> [[R]]
|
||||
;
|
||||
%negx = fsub fast <2 x float> <float -0.0, float -0.0>, %x
|
||||
%r = call nnan arcp afn <2 x float> @llvm.sin.v2f32(<2 x float> %negx)
|
||||
ret <2 x float> %r
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user