[llvm] b68b94f - [Support] Add MVT::getDoubleNumVectorElementsVT helper.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 06:42:35 PDT 2023
Author: Simon Pilgrim
Date: 2023-04-17T14:42:19+01:00
New Revision: b68b94f6f40b4f5d89fc3bba819c2d134ff4fc69
URL: https://github.com/llvm/llvm-project/commit/b68b94f6f40b4f5d89fc3bba819c2d134ff4fc69
DIFF: https://github.com/llvm/llvm-project/commit/b68b94f6f40b4f5d89fc3bba819c2d134ff4fc69.diff
LOG: [Support] Add MVT::getDoubleNumVectorElementsVT helper.
Matches the equivalent EVT::getDoubleNumVectorElementsVT helper.
This allows us to consistently MVT instead of EVT in the combinePTESTCC method.
Added:
Modified:
llvm/include/llvm/Support/MachineValueType.h
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/MachineValueType.h b/llvm/include/llvm/Support/MachineValueType.h
index eb97239612c5f..2a2ab24e4f2cc 100644
--- a/llvm/include/llvm/Support/MachineValueType.h
+++ b/llvm/include/llvm/Support/MachineValueType.h
@@ -534,6 +534,14 @@ namespace llvm {
return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
}
+ // Return a VT for a vector type with the same element type but
+ // double the number of elements.
+ MVT getDoubleNumVectorElementsVT() const {
+ MVT EltVT = getVectorElementType();
+ auto EltCnt = getVectorElementCount();
+ return MVT::getVectorVT(EltVT, EltCnt * 2);
+ }
+
/// Returns true if the given vector is a power of 2.
bool isPow2VectorType() const {
unsigned NElts = getVectorMinNumElements();
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index ac94dee5e2dc1..4f6462d95d4fd 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -47304,10 +47304,10 @@ static SDValue combinePTESTCC(SDValue EFLAGS, X86::CondCode &CC,
// TESTZ: ZF = (Op0 & Op1) == 0
// TESTC: CF = (~Op0 & Op1) == 0
// TESTNZC: ZF == 0 && CF == 0
- EVT VT = EFLAGS.getValueType();
+ MVT VT = EFLAGS.getSimpleValueType();
SDValue Op0 = EFLAGS.getOperand(0);
SDValue Op1 = EFLAGS.getOperand(1);
- EVT OpVT = Op0.getValueType();
+ MVT OpVT = Op0.getSimpleValueType();
// TEST*(~X,Y) == TEST*(X,Y)
if (SDValue NotOp0 = IsNOT(Op0, DAG)) {
@@ -47442,7 +47442,7 @@ static SDValue combinePTESTCC(SDValue EFLAGS, X86::CondCode &CC,
Src1 = getSplitVectorSrc(peekThroughBitcasts(Src1.getOperand(0)),
peekThroughBitcasts(Src1.getOperand(1)), true);
if (Src0 && Src1) {
- EVT OpVT2 = OpVT.getDoubleNumVectorElementsVT(*DAG.getContext());
+ MVT OpVT2 = OpVT.getDoubleNumVectorElementsVT();
return DAG.getNode(EFLAGS.getOpcode(), SDLoc(EFLAGS), VT,
DAG.getBitcast(OpVT2, Src0),
DAG.getBitcast(OpVT2, Src1));
More information about the llvm-commits
mailing list