[PATCH] D69735: [amdgpu] Fix known bits compuation on `MUL_I24`/`MUL_U24`.
Michael Liao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 13:25:00 PDT 2019
hliao created this revision.
hliao added reviewers: arsenm, rampitec.
Herald added subscribers: llvm-commits, hiraditya, t-tye, tpr, dstuttard, nhaehnle, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69735
Files:
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AMDGPU/computeNumSignBits-mul.ll
Index: llvm/test/CodeGen/AMDGPU/computeNumSignBits-mul.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/computeNumSignBits-mul.ll
+++ llvm/test/CodeGen/AMDGPU/computeNumSignBits-mul.ll
@@ -157,3 +157,14 @@
%mul2 = mul i32 %mul0, %mul1
ret i32 %mul2
}
+
+; GFX9-LABEL: known_bits_mul24:
+; GFX9: v_mov_b32_e32 v0, 0
+; GFX9-NEXT: s_setpc_b64 s[30:31]
+define i32 @known_bits_mul24() {
+ %r0 = call i32 @llvm.amdgcn.mul.i24(i32 0, i32 -7)
+ %r1 = shl i32 %r0, 2
+ ret i32 %r1
+}
+
+declare i32 @llvm.amdgcn.mul.i24(i32, i32)
Index: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -4435,6 +4435,9 @@
unsigned TrailZ = LHSKnown.countMinTrailingZeros() +
RHSKnown.countMinTrailingZeros();
Known.Zero.setLowBits(std::min(TrailZ, 32u));
+ // Skip extra check if all bits are known zeros.
+ if (TrailZ >= 32)
+ break;
// Truncate to 24 bits.
LHSKnown = LHSKnown.trunc(24);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69735.227521.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191101/8ce498de/attachment.bin>
More information about the llvm-commits
mailing list