[llvm] 22d8ba3 - [X86] getConstVector - use APInt::extractBits instead of shift+mask. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 4 05:25:59 PST 2025


Author: Simon Pilgrim
Date: 2025-03-04T13:24:36Z
New Revision: 22d8ba3dbc732fdf4acf830e741d972be282f827

URL: https://github.com/llvm/llvm-project/commit/22d8ba3dbc732fdf4acf830e741d972be282f827
DIFF: https://github.com/llvm/llvm-project/commit/22d8ba3dbc732fdf4acf830e741d972be282f827.diff

LOG: [X86] getConstVector - use APInt::extractBits instead of shift+mask. NFC.

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 bbab43d4e92af..8f0ba3e24ed02 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -4001,8 +4001,8 @@ static SDValue getConstVector(ArrayRef<APInt> Bits, const APInt &Undefs,
     const APInt &V = Bits[i];
     assert(V.getBitWidth() == VT.getScalarSizeInBits() && "Unexpected sizes");
     if (Split) {
-      Ops.push_back(DAG.getConstant(V.trunc(32), dl, EltVT));
-      Ops.push_back(DAG.getConstant(V.lshr(32).trunc(32), dl, EltVT));
+      Ops.push_back(DAG.getConstant(V.extractBits(32, 0), dl, EltVT));
+      Ops.push_back(DAG.getConstant(V.extractBits(32, 32), dl, EltVT));
     } else if (EltVT == MVT::f32) {
       APFloat FV(APFloat::IEEEsingle(), V);
       Ops.push_back(DAG.getConstantFP(FV, dl, EltVT));


        


More information about the llvm-commits mailing list