mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
Fix an instance where we would drop fast math flags when performing an fdiv to reciprocal multiply transformation.
llvm-svn: 199425
This commit is contained in:
parent
2c40c9a6c0
commit
dbdd830886
@ -1050,8 +1050,10 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
|
||||
}
|
||||
|
||||
// X / C => X * 1/C
|
||||
if (Instruction *T = CvtFDivConstToReciprocal(Op0, Op1C, AllowReciprocal))
|
||||
if (Instruction *T = CvtFDivConstToReciprocal(Op0, Op1C, AllowReciprocal)) {
|
||||
T->copyFastMathFlags(&I);
|
||||
return T;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,3 +23,11 @@ define float @test3(float %x) nounwind readnone ssp {
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NEXT: fdiv float %x, 0x36A0000000000000
|
||||
}
|
||||
|
||||
define float @test4(float %x) nounwind readnone ssp {
|
||||
%div = fdiv fast float %x, 8.0
|
||||
ret float %div
|
||||
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: fmul fast float %x, 1.250000e-01
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user