llvm.org GIT mirror llvm / 1906d32
Combine X86 CMPPD and CMPPS node types. Simplifies selection code and pattern matching. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148670 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 8 years ago
4 changed file(s) with 26 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
83568356 EVT EltVT = Op0.getValueType().getVectorElementType();
83578357 assert(EltVT == MVT::f32 || EltVT == MVT::f64);
83588358
8359 unsigned Opc = EltVT == MVT::f32 ? X86ISD::CMPPS : X86ISD::CMPPD;
83608359 bool Swap = false;
83618360
83628361 // SSE Condition code mapping:
83968395 if (SSECC == 8) {
83978396 if (SetCCOpcode == ISD::SETUEQ) {
83988397 SDValue UNORD, EQ;
8399 UNORD = DAG.getNode(Opc, dl, VT, Op0, Op1, DAG.getConstant(3, MVT::i8));
8400 EQ = DAG.getNode(Opc, dl, VT, Op0, Op1, DAG.getConstant(0, MVT::i8));
8398 UNORD = DAG.getNode(X86ISD::CMPP, dl, VT, Op0, Op1,
8399 DAG.getConstant(3, MVT::i8));
8400 EQ = DAG.getNode(X86ISD::CMPP, dl, VT, Op0, Op1,
8401 DAG.getConstant(0, MVT::i8));
84018402 return DAG.getNode(ISD::OR, dl, VT, UNORD, EQ);
84028403 } else if (SetCCOpcode == ISD::SETONE) {
84038404 SDValue ORD, NEQ;
8404 ORD = DAG.getNode(Opc, dl, VT, Op0, Op1, DAG.getConstant(7, MVT::i8));
8405 NEQ = DAG.getNode(Opc, dl, VT, Op0, Op1, DAG.getConstant(4, MVT::i8));
8405 ORD = DAG.getNode(X86ISD::CMPP, dl, VT, Op0, Op1,
8406 DAG.getConstant(7, MVT::i8));
8407 NEQ = DAG.getNode(X86ISD::CMPP, dl, VT, Op0, Op1,
8408 DAG.getConstant(4, MVT::i8));
84068409 return DAG.getNode(ISD::AND, dl, VT, ORD, NEQ);
84078410 }
84088411 llvm_unreachable("Illegal FP comparison");
84098412 }
84108413 // Handle all other FP comparisons here.
8411 return DAG.getNode(Opc, dl, VT, Op0, Op1, DAG.getConstant(SSECC, MVT::i8));
8414 return DAG.getNode(X86ISD::CMPP, dl, VT, Op0, Op1,
8415 DAG.getConstant(SSECC, MVT::i8));
84128416 }
84138417
84148418 // Break 256-bit integer vector compare into smaller ones.
1093410938 case X86ISD::VSHLI: return "X86ISD::VSHLI";
1093510939 case X86ISD::VSRLI: return "X86ISD::VSRLI";
1093610940 case X86ISD::VSRAI: return "X86ISD::VSRAI";
10937 case X86ISD::CMPPD: return "X86ISD::CMPPD";
10938 case X86ISD::CMPPS: return "X86ISD::CMPPS";
10941 case X86ISD::CMPP: return "X86ISD::CMPP";
1093910942 case X86ISD::PCMPEQ: return "X86ISD::PCMPEQ";
1094010943 case X86ISD::PCMPGT: return "X86ISD::PCMPGT";
1094110944 case X86ISD::ADD: return "X86ISD::ADD";
227227 // VSHLI, VSRLI, VSRAI - Vector shift elements by immediate
228228 VSHLI, VSRLI, VSRAI,
229229
230 // CMPPD, CMPPS - Vector double/float comparison.
231 // CMPPD, CMPPS - Vector double/float comparison.
232 CMPPD, CMPPS,
230 // CMPP - Vector packed double/float comparison.
231 CMPP,
233232
234233 // PCMP* - Vector integer comparisons.
235234 PCMPEQ, PCMPGT,
7474 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
7575 def X86vshldq : SDNode<"X86ISD::VSHLDQ", SDTIntShiftOp>;
7676 def X86vshrdq : SDNode<"X86ISD::VSRLDQ", SDTIntShiftOp>;
77 def X86cmpps : SDNode<"X86ISD::CMPPS", SDTX86VFCMP>;
78 def X86cmppd : SDNode<"X86ISD::CMPPD", SDTX86VFCMP>;
77 def X86cmpp : SDNode<"X86ISD::CMPP", SDTX86VFCMP>;
7978 def X86pcmpeq : SDNode<"X86ISD::PCMPEQ", SDTIntBinOp, [SDNPCommutative]>;
8079 def X86pcmpgt : SDNode<"X86ISD::PCMPGT", SDTIntBinOp>;
8180
22612261 }
22622262
22632263 let Predicates = [HasAVX] in {
2264 def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)),
2264 def : Pat<(v4i32 (X86cmpp (v4f32 VR128:$src1), VR128:$src2, imm:$cc)),
22652265 (VCMPPSrri (v4f32 VR128:$src1), (v4f32 VR128:$src2), imm:$cc)>;
2266 def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)),
2266 def : Pat<(v4i32 (X86cmpp (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)),
22672267 (VCMPPSrmi (v4f32 VR128:$src1), addr:$src2, imm:$cc)>;
2268 def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)),
2268 def : Pat<(v2i64 (X86cmpp (v2f64 VR128:$src1), VR128:$src2, imm:$cc)),
22692269 (VCMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>;
2270 def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)),
2270 def : Pat<(v2i64 (X86cmpp (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)),
22712271 (VCMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>;
22722272
2273 def : Pat<(v8i32 (X86cmpps (v8f32 VR256:$src1), VR256:$src2, imm:$cc)),
2273 def : Pat<(v8i32 (X86cmpp (v8f32 VR256:$src1), VR256:$src2, imm:$cc)),
22742274 (VCMPPSYrri (v8f32 VR256:$src1), (v8f32 VR256:$src2), imm:$cc)>;
2275 def : Pat<(v8i32 (X86cmpps (v8f32 VR256:$src1), (memop addr:$src2), imm:$cc)),
2275 def : Pat<(v8i32 (X86cmpp (v8f32 VR256:$src1), (memop addr:$src2), imm:$cc)),
22762276 (VCMPPSYrmi (v8f32 VR256:$src1), addr:$src2, imm:$cc)>;
2277 def : Pat<(v4i64 (X86cmppd (v4f64 VR256:$src1), VR256:$src2, imm:$cc)),
2277 def : Pat<(v4i64 (X86cmpp (v4f64 VR256:$src1), VR256:$src2, imm:$cc)),
22782278 (VCMPPDYrri VR256:$src1, VR256:$src2, imm:$cc)>;
2279 def : Pat<(v4i64 (X86cmppd (v4f64 VR256:$src1), (memop addr:$src2), imm:$cc)),
2279 def : Pat<(v4i64 (X86cmpp (v4f64 VR256:$src1), (memop addr:$src2), imm:$cc)),
22802280 (VCMPPDYrmi VR256:$src1, addr:$src2, imm:$cc)>;
22812281 }
22822282
22832283 let Predicates = [HasSSE1] in {
2284 def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)),
2284 def : Pat<(v4i32 (X86cmpp (v4f32 VR128:$src1), VR128:$src2, imm:$cc)),
22852285 (CMPPSrri (v4f32 VR128:$src1), (v4f32 VR128:$src2), imm:$cc)>;
2286 def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)),
2286 def : Pat<(v4i32 (X86cmpp (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)),
22872287 (CMPPSrmi (v4f32 VR128:$src1), addr:$src2, imm:$cc)>;
22882288 }
22892289
22902290 let Predicates = [HasSSE2] in {
2291 def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)),
2291 def : Pat<(v2i64 (X86cmpp (v2f64 VR128:$src1), VR128:$src2, imm:$cc)),
22922292 (CMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>;
2293 def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)),
2293 def : Pat<(v2i64 (X86cmpp (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)),
22942294 (CMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>;
22952295 }
22962296