mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
R600/SI: Add intrinsics for various math instructions.
These will be used for custom lowering and for library implementations of various math functions, so it's useful to expose these as builtins. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -922,6 +922,20 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
|
||||
break;
|
||||
}
|
||||
|
||||
case Intrinsic::AMDGPU_rcp: {
|
||||
if (const ConstantFP *C = dyn_cast<ConstantFP>(II->getArgOperand(0))) {
|
||||
const APFloat &ArgVal = C->getValueAPF();
|
||||
APFloat Val(ArgVal.getSemantics(), 1.0);
|
||||
APFloat::opStatus Status = Val.divide(ArgVal,
|
||||
APFloat::rmNearestTiesToEven);
|
||||
// Only do this if it was exact and therefore not dependent on the
|
||||
// rounding mode.
|
||||
if (Status == APFloat::opOK)
|
||||
return ReplaceInstUsesWith(CI, ConstantFP::get(II->getContext(), Val));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case Intrinsic::stackrestore: {
|
||||
// If the save is right next to the restore, remove the restore. This can
|
||||
// happen when variable allocas are DCE'd.
|
||||
|
Reference in New Issue
Block a user