llvm.org GIT mirror llvm / 20c08e5
move this fp select into a pattern git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78464 91177308-0d34-0410-b5e6-96231b3b80d8 Andrew Lenharth 10 years ago
2 changed file(s) with 9 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
384384 }
385385 break;
386386
387 case ISD::SELECT:
388 if (N->getValueType(0).isFloatingPoint() &&
389 (N->getOperand(0).getOpcode() != ISD::SETCC ||
390 !N->getOperand(0).getOperand(1).getValueType().isFloatingPoint())) {
391 //This should be the condition not covered by the Patterns
392 //FIXME: Don't have SelectCode die, but rather return something testable
393 // so that things like this can be caught in fall though code
394 //move int to fp
395 bool isDouble = N->getValueType(0) == MVT::f64;
396 SDValue cond = N->getOperand(0);
397 SDValue TV = N->getOperand(1);
398 SDValue FV = N->getOperand(2);
399
400 SDNode* LD = CurDAG->getTargetNode(Alpha::ITOFT, dl, MVT::f64, cond);
401 return CurDAG->getTargetNode(isDouble?Alpha::FCMOVNET:Alpha::FCMOVNES,
402 dl, MVT::f64, FV, TV, SDValue(LD,0));
403 }
404 break;
405
406387 case ISD::AND: {
407388 ConstantSDNode* SC = NULL;
408389 ConstantSDNode* MC = NULL;
701701
702702 //misc FP selects
703703 //Select double
704
704
705705 def : Pat<(select (seteq F8RC:$RA, F8RC:$RB), F8RC:$st, F8RC:$sf),
706706 (FCMOVNET F8RC:$sf, F8RC:$st, (CMPTEQ F8RC:$RA, F8RC:$RB))>;
707707 def : Pat<(select (setoeq F8RC:$RA, F8RC:$RB), F8RC:$st, F8RC:$sf),
790790
791791
792792 let OutOperandList = (ops GPRC:$RC), InOperandList = (ops F4RC:$RA), Fb = 31 in
793 def FTOIS : FPForm<0x1C, 0x078, "ftois $RA,$RC",[], s_ftoi>; //Floating to integer move, S_floating
793 def FTOIS : FPForm<0x1C, 0x078, "ftois $RA,$RC",
794 [(set GPRC:$RC, (bitconvert F4RC:$RA))], s_ftoi>; //Floating to integer move, S_floating
794795 let OutOperandList = (ops GPRC:$RC), InOperandList = (ops F8RC:$RA), Fb = 31 in
795796 def FTOIT : FPForm<0x1C, 0x070, "ftoit $RA,$RC",
796797 [(set GPRC:$RC, (bitconvert F8RC:$RA))], s_ftoi>; //Floating to integer move
797798 let OutOperandList = (ops F4RC:$RC), InOperandList = (ops GPRC:$RA), Fb = 31 in
798 def ITOFS : FPForm<0x14, 0x004, "itofs $RA,$RC",[], s_itof>; //Integer to floating move, S_floating
799 def ITOFS : FPForm<0x14, 0x004, "itofs $RA,$RC",
800 [(set F4RC:$RC, (bitconvert GPRC:$RA))], s_itof>; //Integer to floating move, S_floating
799801 let OutOperandList = (ops F8RC:$RC), InOperandList = (ops GPRC:$RA), Fb = 31 in
800802 def ITOFT : FPForm<0x14, 0x024, "itoft $RA,$RC",
801803 [(set F8RC:$RC, (bitconvert GPRC:$RA))], s_itof>; //Integer to floating move
817819 def CVTTS : FPForm<0x16, 0x7AC, "cvtts/sui $RB,$RC",
818820 [(set F4RC:$RC, (fround F8RC:$RB))], s_fadd>;
819821
822 def : Pat<(select GPRC:$RC, F8RC:$st, F8RC:$sf),
823 (f64 (FCMOVEQT F8RC:$st, F8RC:$sf, (ITOFT GPRC:$RC)))>;
824 def : Pat<(select GPRC:$RC, F4RC:$st, F4RC:$sf),
825 (f32 (FCMOVEQS F4RC:$st, F4RC:$sf, (ITOFT GPRC:$RC)))>;
820826
821827 /////////////////////////////////////////////////////////
822828 //Branching