[llvm] 3e596ed - [X86] Fix -Wc++11-narrowing in X86ISelLowering.cpp (NFC)
Jie Fu via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 02:18:26 PDT 2023
Author: Jie Fu
Date: 2023-08-11T17:18:16+08:00
New Revision: 3e596ed20cf66818ee6c71ed32c9f56bf0b7584d
URL: https://github.com/llvm/llvm-project/commit/3e596ed20cf66818ee6c71ed32c9f56bf0b7584d
DIFF: https://github.com/llvm/llvm-project/commit/3e596ed20cf66818ee6c71ed32c9f56bf0b7584d.diff
LOG: [X86] Fix -Wc++11-narrowing in X86ISelLowering.cpp (NFC)
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54604:26: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
^~~~~~~~~~~~~
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54604:26: note: insert an explicit cast to silence this issue
int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
^~~~~~~~~~~~~
static_cast<int>( )
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54604:41: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
^~~~~~~~~~~~~~~~~~~
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54604:41: note: insert an explicit cast to silence this issue
int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
^~~~~~~~~~~~~~~~~~~
static_cast<int>( )
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54604:62: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
^~~~~~~~~~~~~
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54604:62: note: insert an explicit cast to silence this issue
int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
^~~~~~~~~~~~~
static_cast<int>( )
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54605:26: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
((Imm1 >> 4) & 0x3)};
^~~~~~~~~~~~~~~~~~~
/Users/jiefu/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54605:26: note: insert an explicit cast to silence this issue
((Imm1 >> 4) & 0x3)};
^~~~~~~~~~~~~~~~~~~
static_cast<int>( )
4 errors generated.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index f1fc49a0b65c31..400c5c4a9a7ca6 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -54601,8 +54601,8 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
unsigned Imm1 = Ops[1].getConstantOperandVal(2);
// TODO: Handle zero'd subvectors.
if ((Imm0 & 0x88) == 0 && (Imm1 & 0x88) == 0) {
- int Mask[4] = {(Imm0 & 0x03), ((Imm0 >> 4) & 0x3), (Imm1 & 0x03),
- ((Imm1 >> 4) & 0x3)};
+ int Mask[4] = {(int)(Imm0 & 0x03), (int)((Imm0 >> 4) & 0x3), (int)(Imm1 & 0x03),
+ (int)((Imm1 >> 4) & 0x3)};
MVT ShuffleVT = EltSizeInBits >= 32 ? VT : MVT::v8i64;
SDValue LHS = concatSubVectors(Ops[0].getOperand(0),
Ops[0].getOperand(1), DAG, DL);
More information about the llvm-commits
mailing list