[llvm] [AMDGPU] Support v_lshl_add_u64 with non-constant shift amount (PR #179904)
Frederik Harwath via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 5 03:48:35 PST 2026
================
@@ -638,19 +638,13 @@ class ThreeOpFrag<SDPatternOperator op1, SDPatternOperator op2> : ThreeOpFragSDA
}
def shl_0_to_4 : PatFrag<
- (ops node:$src0, node:$src1), (shl node:$src0, node:$src1),
- [{
- if (auto *C = dyn_cast<ConstantSDNode>(N->getOperand(1))) {
- return C->getZExtValue() <= 4;
- }
- return false;
- }]> {
+ (ops node:$src0, node:$src1), (shl node:$src0, node:$src1), [{
+ KnownBits KB = CurDAG->computeKnownBits(N->getOperand(1));
+ return KB.getMaxValue().getZExtValue() <= 4;
+ }]> {
let GISelPredicateCode = [{
----------------
frederik-h wrote:
There seems to be no test coverage for the GlobalISel path. I compiled the existing test with -globa-isel=1 and there was only a single use of v_lshl_add_u64 in the output (in the gep test case).
https://github.com/llvm/llvm-project/pull/179904
More information about the llvm-commits
mailing list