[llvm] AMDGPU: Perform zero/any extend combine into permute (PR #177370)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 08:41:47 PST 2026
================
@@ -14470,7 +14473,43 @@ SDValue SITargetLowering::performZeroExtendCombine(SDNode *N,
if (Src.getValueType() != MVT::i16)
return SDValue();
- return SDValue();
+ if (!Src->hasOneUse())
+ return SDValue();
+
+ // TODO: We bail out below if SrcOffset is not in the first dword (>= 4). It's
+ // possible we're missing out on some combine opportunities, but we'd need to
+ // weigh the cost of extracting the byte from the upper dwords.
+
+ std::optional<ByteProvider<SDValue>> BP0 =
+ calculateByteProvider(SDValue(N, 0), 0, 0, 0);
+ if (!BP0 || BP0->SrcOffset >= 4 || !BP0->Src)
+ return SDValue();
+ SDValue V0 = *BP0->Src;
+
+ std::optional<ByteProvider<SDValue>> BP1 =
+ calculateByteProvider(SDValue(N, 0), 1, 0, 1);
+ if (!BP1 || BP1->SrcOffset >= 4 || !BP1->Src)
+ return SDValue();
+ SDValue V1 = *BP1->Src;
+
----------------
macurtis-amd wrote:
I added a blank like above the assignment. Hopefully that's what you wanted.
https://github.com/llvm/llvm-project/pull/177370
More information about the llvm-commits
mailing list