mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add a new intrinsic: llvm.fmuladd. This intrinsic represents a multiply-add
expression (a * b + c) that can be implemented as a fused multiply-add (fma) if the target determines that this will be more efficient. This intrinsic will be used to implement FP_CONTRACT support and an aggressive FMA formation mode. If your target has a fast FMA instruction you should override the isFMAFasterThanMulAndAdd method in TargetLowering to return true. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4932,6 +4932,27 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
getValue(I.getArgOperand(1)),
|
||||
getValue(I.getArgOperand(2))));
|
||||
return 0;
|
||||
case Intrinsic::fmuladd: {
|
||||
EVT VT = TLI.getValueType(I.getType());
|
||||
if (TLI.isOperationLegal(ISD::FMA, VT) && TLI.isFMAFasterThanMulAndAdd(VT)){
|
||||
setValue(&I, DAG.getNode(ISD::FMA, dl,
|
||||
getValue(I.getArgOperand(0)).getValueType(),
|
||||
getValue(I.getArgOperand(0)),
|
||||
getValue(I.getArgOperand(1)),
|
||||
getValue(I.getArgOperand(2))));
|
||||
} else {
|
||||
SDValue Mul = DAG.getNode(ISD::FMUL, dl,
|
||||
getValue(I.getArgOperand(0)).getValueType(),
|
||||
getValue(I.getArgOperand(0)),
|
||||
getValue(I.getArgOperand(1)));
|
||||
SDValue Add = DAG.getNode(ISD::FADD, dl,
|
||||
getValue(I.getArgOperand(0)).getValueType(),
|
||||
Mul,
|
||||
getValue(I.getArgOperand(2)));
|
||||
setValue(&I, Add);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case Intrinsic::convert_to_fp16:
|
||||
setValue(&I, DAG.getNode(ISD::FP32_TO_FP16, dl,
|
||||
MVT::i16, getValue(I.getArgOperand(0))));
|
||||
|
Reference in New Issue
Block a user