mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[NVPTX] Enable combineRepeatedFPDivisors for NVPTX.
Reviewers: tra Subscribers: jholewinski, llvm-commits Differential Revision: https://reviews.llvm.org/D29477 llvm-svn: 294011
This commit is contained in:
parent
b6aef04698
commit
b818266aed
@ -530,6 +530,8 @@ public:
|
||||
int &ExtraSteps, bool &UseOneConst,
|
||||
bool Reciprocal) const override;
|
||||
|
||||
unsigned combineRepeatedFPDivisors() const override { return 2; }
|
||||
|
||||
bool allowFMA(MachineFunction &MF, CodeGenOpt::Level OptLevel) const;
|
||||
bool allowUnsafeFPMath(MachineFunction &MF) const;
|
||||
|
||||
|
@ -117,5 +117,49 @@ define float @fcos_approx(float %a) #0 {
|
||||
ret float %r
|
||||
}
|
||||
|
||||
; CHECK-LABEL: repeated_div_recip_allowed
|
||||
define float @repeated_div_recip_allowed(i1 %pred, float %a, float %b, float %divisor) {
|
||||
; CHECK: rcp.rn.f32
|
||||
; CHECK: mul.rn.f32
|
||||
; CHECK: mul.rn.f32
|
||||
%x = fdiv arcp float %a, %divisor
|
||||
%y = fdiv arcp float %b, %divisor
|
||||
%z = select i1 %pred, float %x, float %y
|
||||
ret float %z
|
||||
}
|
||||
|
||||
; CHECK-LABEL: repeated_div_recip_allowed_ftz
|
||||
define float @repeated_div_recip_allowed_ftz(i1 %pred, float %a, float %b, float %divisor) #1 {
|
||||
; CHECK: rcp.rn.ftz.f32
|
||||
; CHECK: mul.rn.ftz.f32
|
||||
; CHECK: mul.rn.ftz.f32
|
||||
%x = fdiv arcp float %a, %divisor
|
||||
%y = fdiv arcp float %b, %divisor
|
||||
%z = select i1 %pred, float %x, float %y
|
||||
ret float %z
|
||||
}
|
||||
|
||||
; CHECK-LABEL: repeated_div_fast
|
||||
define float @repeated_div_fast(i1 %pred, float %a, float %b, float %divisor) #0 {
|
||||
; CHECK: rcp.approx.f32
|
||||
; CHECK: mul.f32
|
||||
; CHECK: mul.f32
|
||||
%x = fdiv float %a, %divisor
|
||||
%y = fdiv float %b, %divisor
|
||||
%z = select i1 %pred, float %x, float %y
|
||||
ret float %z
|
||||
}
|
||||
|
||||
; CHECK-LABEL: repeated_div_fast_ftz
|
||||
define float @repeated_div_fast_ftz(i1 %pred, float %a, float %b, float %divisor) #0 #1 {
|
||||
; CHECK: rcp.approx.ftz.f32
|
||||
; CHECK: mul.ftz.f32
|
||||
; CHECK: mul.ftz.f32
|
||||
%x = fdiv float %a, %divisor
|
||||
%y = fdiv float %b, %divisor
|
||||
%z = select i1 %pred, float %x, float %y
|
||||
ret float %z
|
||||
}
|
||||
|
||||
attributes #0 = { "unsafe-fp-math" = "true" }
|
||||
attributes #1 = { "nvptx-f32ftz" = "true" }
|
||||
|
Loading…
x
Reference in New Issue
Block a user