mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-27 14:45:50 +00:00
SelectionDAG: Don't use MVT::Other to determine legality of ISD::SELECT_CC
The SelectionDAG bad a special case for ISD::SELECT_CC, where it would allow targets to specify: setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); to indicate that they wanted to expand ISD::SELECT_CC for all types. This wasn't applied correctly everywhere, and it makes writing new DAG patterns with ISD::SELECT_CC difficult. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210541 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c23f0e1e44
commit
102d0f3e3f
@ -4567,12 +4567,9 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
|
||||
|
||||
// fold selects based on a setcc into other things, such as min/max/abs
|
||||
if (N0.getOpcode() == ISD::SETCC) {
|
||||
// FIXME:
|
||||
// Check against MVT::Other for SELECT_CC, which is a workaround for targets
|
||||
// having to say they don't support SELECT_CC on every type the DAG knows
|
||||
// about, since there is no way to mark an opcode illegal at all value types
|
||||
if (TLI.isOperationLegalOrCustom(ISD::SELECT_CC, MVT::Other) &&
|
||||
TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT))
|
||||
if ((!LegalOperations &&
|
||||
TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT)) ||
|
||||
TLI.isOperationLegal(ISD::SELECT_CC, VT))
|
||||
return DAG.getNode(ISD::SELECT_CC, SDLoc(N), VT,
|
||||
N0.getOperand(0), N0.getOperand(1),
|
||||
N1, N2, N0.getOperand(2));
|
||||
@ -7028,11 +7025,7 @@ SDValue DAGCombiner::visitSINT_TO_FP(SDNode *N) {
|
||||
}
|
||||
|
||||
// The next optimizations are desirable only if SELECT_CC can be lowered.
|
||||
// Check against MVT::Other for SELECT_CC, which is a workaround for targets
|
||||
// having to say they don't support SELECT_CC on every type the DAG knows
|
||||
// about, since there is no way to mark an opcode illegal at all value types
|
||||
// (See also visitSELECT)
|
||||
if (TLI.isOperationLegalOrCustom(ISD::SELECT_CC, MVT::Other)) {
|
||||
if (TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT) || !LegalOperations) {
|
||||
// fold (sint_to_fp (setcc x, y, cc)) -> (select_cc x, y, -1.0, 0.0,, cc)
|
||||
if (N0.getOpcode() == ISD::SETCC && N0.getValueType() == MVT::i1 &&
|
||||
!VT.isVector() &&
|
||||
@ -7085,11 +7078,7 @@ SDValue DAGCombiner::visitUINT_TO_FP(SDNode *N) {
|
||||
}
|
||||
|
||||
// The next optimizations are desirable only if SELECT_CC can be lowered.
|
||||
// Check against MVT::Other for SELECT_CC, which is a workaround for targets
|
||||
// having to say they don't support SELECT_CC on every type the DAG knows
|
||||
// about, since there is no way to mark an opcode illegal at all value types
|
||||
// (See also visitSELECT)
|
||||
if (TLI.isOperationLegalOrCustom(ISD::SELECT_CC, MVT::Other)) {
|
||||
if (TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT) || !LegalOperations) {
|
||||
// fold (uint_to_fp (setcc x, y, cc)) -> (select_cc x, y, -1.0, 0.0,, cc)
|
||||
|
||||
if (N0.getOpcode() == ISD::SETCC && !VT.isVector() &&
|
||||
|
@ -1339,18 +1339,12 @@ HexagonTargetLowering::HexagonTargetLowering(HexagonTargetMachine
|
||||
|
||||
setOperationAction(ISD::SELECT_CC, MVT::f32, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::f64, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
|
||||
|
||||
} else {
|
||||
|
||||
// Hexagon has no select or setcc: expand to SELECT_CC.
|
||||
setOperationAction(ISD::SELECT, MVT::f32, Expand);
|
||||
setOperationAction(ISD::SELECT, MVT::f64, Expand);
|
||||
|
||||
// This is a workaround documented in DAGCombiner.cpp:2892 We don't
|
||||
// support SELECT_CC on every type.
|
||||
setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
|
||||
|
||||
}
|
||||
|
||||
if (EmitJumpTables) {
|
||||
|
@ -287,7 +287,8 @@ MipsTargetLowering::MipsTargetLowering(MipsTargetMachine &TM)
|
||||
setOperationAction(ISD::BR_CC, MVT::f64, Expand);
|
||||
setOperationAction(ISD::BR_CC, MVT::i32, Expand);
|
||||
setOperationAction(ISD::BR_CC, MVT::i64, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i32, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i64, Expand);
|
||||
setOperationAction(ISD::UINT_TO_FP, MVT::i32, Expand);
|
||||
setOperationAction(ISD::UINT_TO_FP, MVT::i64, Expand);
|
||||
setOperationAction(ISD::FP_TO_UINT, MVT::i32, Expand);
|
||||
|
@ -130,7 +130,13 @@ NVPTXTargetLowering::NVPTXTargetLowering(NVPTXTargetMachine &TM)
|
||||
addRegisterClass(MVT::f64, &NVPTX::Float64RegsRegClass);
|
||||
|
||||
// Operations not directly supported by NVPTX.
|
||||
setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::f32, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::f64, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i1, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i8, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i16, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i32, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i64, Expand);
|
||||
setOperationAction(ISD::BR_CC, MVT::f32, Expand);
|
||||
setOperationAction(ISD::BR_CC, MVT::f64, Expand);
|
||||
setOperationAction(ISD::BR_CC, MVT::i1, Expand);
|
||||
|
@ -440,7 +440,13 @@ void X86TargetLowering::resetOperationActions() {
|
||||
setOperationAction(ISD::BR_CC , MVT::i16, Expand);
|
||||
setOperationAction(ISD::BR_CC , MVT::i32, Expand);
|
||||
setOperationAction(ISD::BR_CC , MVT::i64, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::Other, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::f32, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::f64, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::f80, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::i8, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::i16, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::i32, Expand);
|
||||
setOperationAction(ISD::SELECT_CC , MVT::i64, Expand);
|
||||
if (Subtarget->is64Bit())
|
||||
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i32, Legal);
|
||||
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16 , Legal);
|
||||
@ -858,6 +864,7 @@ void X86TargetLowering::resetOperationActions() {
|
||||
setOperationAction(ISD::ZERO_EXTEND, VT, Expand);
|
||||
setOperationAction(ISD::ANY_EXTEND, VT, Expand);
|
||||
setOperationAction(ISD::VSELECT, VT, Expand);
|
||||
setOperationAction(ISD::SELECT_CC, VT, Expand);
|
||||
for (int InnerVT = MVT::FIRST_VECTOR_VALUETYPE;
|
||||
InnerVT <= MVT::LAST_VECTOR_VALUETYPE; ++InnerVT)
|
||||
setTruncStoreAction(VT,
|
||||
|
@ -98,9 +98,6 @@ XCoreTargetLowering::XCoreTargetLowering(XCoreTargetMachine &XTM)
|
||||
setOperationAction(ISD::SUBC, MVT::i32, Expand);
|
||||
setOperationAction(ISD::SUBE, MVT::i32, Expand);
|
||||
|
||||
// Stop the combiner recombining select and set_cc
|
||||
setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
|
||||
|
||||
// 64bit
|
||||
setOperationAction(ISD::ADD, MVT::i64, Custom);
|
||||
setOperationAction(ISD::SUB, MVT::i64, Custom);
|
||||
|
@ -16,13 +16,11 @@ entry:
|
||||
; SOURCE-SCHED: lw
|
||||
; SOURCE-SCHED: lui
|
||||
; SOURCE-SCHED: sw
|
||||
; SOURCE-SCHED: addiu
|
||||
; SOURCE-SCHED: addiu
|
||||
; SOURCE-SCHED: c.olt.s
|
||||
; SOURCE-SCHED: movt
|
||||
; SOURCE-SCHED: lw
|
||||
; SOURCE-SCHED: lwc1
|
||||
; SOURCE-SCHED: mtc1
|
||||
; SOURCE-SCHED: c.olt.s
|
||||
; SOURCE-SCHED: jr
|
||||
|
||||
store float 0.000000e+00, float* @gf0, align 4
|
||||
store float 1.000000e+00, float* @gf1, align 4
|
||||
%cmp = fcmp olt float %a, %b
|
||||
|
Loading…
Reference in New Issue
Block a user