[llvm] Re apply 130577 narrow math for and operand (PR #133896)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 04:15:04 PDT 2025


================
@@ -1559,6 +1559,80 @@ void AMDGPUCodeGenPrepareImpl::expandDivRem64(BinaryOperator &I) const {
   llvm_unreachable("not a division");
 }
 
+/*
+This will cause non-byte load in consistency, for example:
+```
+    %load = load i1, ptr addrspace(4) %arg, align 4
+    %zext = zext i1 %load to
+    i64 %add = add i64 %zext
+```
+Instead of creating `s_and_b32 s0, s0, 1`,
+it will create `s_and_b32 s0, s0, 0xff`.
+We accept this change since the non-byte load assumes the upper bits
+within the byte are all 0.
----------------
arsenm wrote:

Comment is off topic for what this actually does (should also prefer c++ style comments)

https://github.com/llvm/llvm-project/pull/133896


More information about the llvm-commits mailing list