mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
Factor common code out of individual if blocks into common tail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168551 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
134f78cf41
commit
915562e762
@ -4204,6 +4204,7 @@ SelectionDAGBuilder::visitPow(const CallInst &I) {
|
||||
IntegerPartOfX = DAG.getNode(ISD::SHL, dl, MVT::i32, IntegerPartOfX,
|
||||
DAG.getConstant(23, TLI.getPointerTy()));
|
||||
|
||||
SDValue TwoToFractionalPartOfX;
|
||||
if (LimitFloatPrecision <= 6) {
|
||||
// For floating-point precision of 6:
|
||||
//
|
||||
@ -4217,14 +4218,8 @@ SelectionDAGBuilder::visitPow(const CallInst &I) {
|
||||
SDValue t3 = DAG.getNode(ISD::FADD, dl, MVT::f32, t2,
|
||||
getF32Constant(DAG, 0x3f3c50c8));
|
||||
SDValue t4 = DAG.getNode(ISD::FMUL, dl, MVT::f32, t3, X);
|
||||
SDValue t5 = DAG.getNode(ISD::FADD, dl, MVT::f32, t4,
|
||||
getF32Constant(DAG, 0x3f7f5e7e));
|
||||
SDValue t6 = DAG.getNode(ISD::BITCAST, dl, MVT::i32, t5);
|
||||
SDValue TwoToFractionalPartOfX =
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, t6, IntegerPartOfX);
|
||||
|
||||
result = DAG.getNode(ISD::BITCAST, dl,
|
||||
MVT::f32, TwoToFractionalPartOfX);
|
||||
TwoToFractionalPartOfX = DAG.getNode(ISD::FADD, dl, MVT::f32, t4,
|
||||
getF32Constant(DAG, 0x3f7f5e7e));
|
||||
} else if (LimitFloatPrecision <= 12) {
|
||||
// For floating-point precision of 12:
|
||||
//
|
||||
@ -4242,14 +4237,8 @@ SelectionDAGBuilder::visitPow(const CallInst &I) {
|
||||
SDValue t5 = DAG.getNode(ISD::FADD, dl, MVT::f32, t4,
|
||||
getF32Constant(DAG, 0x3f324b07));
|
||||
SDValue t6 = DAG.getNode(ISD::FMUL, dl, MVT::f32, t5, X);
|
||||
SDValue t7 = DAG.getNode(ISD::FADD, dl, MVT::f32, t6,
|
||||
getF32Constant(DAG, 0x3f7ff8fd));
|
||||
SDValue t8 = DAG.getNode(ISD::BITCAST, dl, MVT::i32, t7);
|
||||
SDValue TwoToFractionalPartOfX =
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, t8, IntegerPartOfX);
|
||||
|
||||
result = DAG.getNode(ISD::BITCAST, dl,
|
||||
MVT::f32, TwoToFractionalPartOfX);
|
||||
TwoToFractionalPartOfX = DAG.getNode(ISD::FADD, dl, MVT::f32, t6,
|
||||
getF32Constant(DAG, 0x3f7ff8fd));
|
||||
} else { // LimitFloatPrecision <= 18
|
||||
// For floating-point precision of 18:
|
||||
//
|
||||
@ -4278,15 +4267,14 @@ SelectionDAGBuilder::visitPow(const CallInst &I) {
|
||||
SDValue t11 = DAG.getNode(ISD::FADD, dl, MVT::f32, t10,
|
||||
getF32Constant(DAG, 0x3f317234));
|
||||
SDValue t12 = DAG.getNode(ISD::FMUL, dl, MVT::f32, t11, X);
|
||||
SDValue t13 = DAG.getNode(ISD::FADD, dl, MVT::f32, t12,
|
||||
getF32Constant(DAG, 0x3f800000));
|
||||
SDValue t14 = DAG.getNode(ISD::BITCAST, dl, MVT::i32, t13);
|
||||
SDValue TwoToFractionalPartOfX =
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, t14, IntegerPartOfX);
|
||||
|
||||
result = DAG.getNode(ISD::BITCAST, dl,
|
||||
MVT::f32, TwoToFractionalPartOfX);
|
||||
TwoToFractionalPartOfX = DAG.getNode(ISD::FADD, dl, MVT::f32, t12,
|
||||
getF32Constant(DAG, 0x3f800000));
|
||||
}
|
||||
|
||||
SDValue t13 = DAG.getNode(ISD::BITCAST, dl,MVT::i32,TwoToFractionalPartOfX);
|
||||
result = DAG.getNode(ISD::BITCAST, dl, MVT::f32,
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32,
|
||||
t13, IntegerPartOfX));
|
||||
} else {
|
||||
// No special expansion.
|
||||
result = DAG.getNode(ISD::FPOW, dl,
|
||||
|
Loading…
Reference in New Issue
Block a user