diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -3901,105 +3901,47 @@ defm : CRNotPat<(i1 (setcc i64:$s1, i64:$s2, SETNE)), (EXTRACT_SUBREG (CMPD $s1, $s2), sub_eq)>; -let Predicates = [HasFPU] in { -// Instantiations of CRNotPat for f32. -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETUGE)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETGE)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETULE)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETLE)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETUNE)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETNE)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; -defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETO)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_un)>; - -// Instantiations of CRNotPat for f64. -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETUGE)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETGE)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETULE)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETLE)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETUNE)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETNE)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; -defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETO)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_un)>; - -// Instantiations of CRNotPat for f128. -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETUGE)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETGE)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETULE)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETLE)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETUNE)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETNE)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; -defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETO)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_un)>; +multiclass FSetCCPat { + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETUGE)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>; + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETGE)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>; + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETULE)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>; + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETLE)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>; + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETUNE)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>; + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETNE)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>; + defm : CRNotPat<(i1 (SetCC Ty:$s1, Ty:$s2, SETO)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_un)>; + + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETOLT)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>; + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETLT)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>; + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETOGT)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>; + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETGT)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>; + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETOEQ)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>; + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETEQ)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>; + def : Pat<(i1 (SetCC Ty:$s1, Ty:$s2, SETUO)), + (EXTRACT_SUBREG (FCmp $s1, $s2), sub_un)>; } -// SETCC for f32. let Predicates = [HasFPU] in { -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOLT)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETLT)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOGT)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETGT)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOEQ)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETEQ)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; -def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETUO)), - (EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_un)>; +// SETCC for f32. +defm : FSetCCPat; // SETCC for f64. -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOLT)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETLT)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOGT)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETGT)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOEQ)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETEQ)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; -def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETUO)), - (EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_un)>; +defm : FSetCCPat; // SETCC for f128. -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETOLT)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETLT)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETOGT)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETGT)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETOEQ)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETEQ)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; -def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETUO)), - (EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_un)>; - +defm : FSetCCPat; } // This must be in this file because it relies on patterns defined in this file