[PATCH] D90217: [AMDGPU][GlobalISel] Fold a chain of two shift instructions with constant operands

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 07:09:15 PST 2020


foad requested changes to this revision.
foad added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1592-1594
+  // Saturating signed left shift has no effect beyond scalar size minus 1.
+  if (Imm >= ScalarSizeInBits - 1 && Opcode == TargetOpcode::G_SSHLSAT) {
+    Imm = ScalarSizeInBits - 2;
----------------
This is wrong. With 8-bit ints:
1 sshlsat 6 = 0x40
1 sshlsat 7 = 0x7f
I think this should clamp to ScalarSizeInBits - 1 just like ashr does.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90217/new/

https://reviews.llvm.org/D90217



More information about the llvm-commits mailing list