[llvm] [PowerPC] Use MathExtras helpers to simplify code. NFC (PR #104691)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 17 19:51:54 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/104691
None
>From 653ec50e2e3338783aedd7bb5ee75c51058a07dc Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Sat, 17 Aug 2024 19:47:59 -0700
Subject: [PATCH] [PowerPC] Use MathExtras helpers to simplify code. NFC
---
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index fff39a37265f20..459a96eca1ff20 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -9513,10 +9513,8 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
} else {
// We may lose precision, so we have to use XXSPLTI32DX.
- uint32_t Hi =
- (uint32_t)((APSplatBits.getZExtValue() & 0xFFFFFFFF00000000LL) >> 32);
- uint32_t Lo =
- (uint32_t)(APSplatBits.getZExtValue() & 0xFFFFFFFF);
+ uint32_t Hi = Hi_32(APSplatBits.getZExtValue());
+ uint32_t Lo = Lo_32(APSplatBits.getZExtValue());
SDValue SplatNode = DAG.getUNDEF(MVT::v2i64);
if (!Hi || !Lo)
@@ -9660,8 +9658,7 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
dl);
// If the sign extended value is in the range [-16,15], use VSPLTI[bhw].
- int32_t SextVal= (int32_t(SplatBits << (32-SplatBitSize)) >>
- (32-SplatBitSize));
+ int32_t SextVal = SignExtend32(SplatBits, SplatBitSize);
if (SextVal >= -16 && SextVal <= 15)
return getCanonicalConstSplat(SextVal, SplatSize, Op.getValueType(), DAG,
dl);
More information about the llvm-commits
mailing list