mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 22:50:47 +00:00
fold fp div by 0 to inf, the way gcc does. This is legal according to the FP spec
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21655 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
abc73b3e5d
commit
8b9e3e6511
@ -470,6 +470,13 @@ struct DirectFPRules
|
||||
(BuiltinType)V2->getValue());
|
||||
return ConstantClass::get(*Ty, Result);
|
||||
}
|
||||
static Constant *Div(const ConstantClass *V1, const ConstantClass *V2) {
|
||||
if (V2->isExactlyValue(0.0)) return ConstantClass::get(*Ty, INFINITY);
|
||||
if (V2->isExactlyValue(-0.0)) return ConstantClass::get(*Ty, -INFINITY);
|
||||
if (V2->isNullValue()) return 0;
|
||||
BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue();
|
||||
return ConstantClass::get(*Ty, R);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user