[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:30:39 PST 2020
foad added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1596-1597
+ }
+ // Arithmetic shift larger than scalar size has no effect.
+ Imm = Ty.getScalarSizeInBits() - 1;
+ }
----------------
foad wrote:
> You could also handle G_USHLSAT and G_SSHLSAT the same way as G_ASHR.
Sorry, I was wrong about G_USHLSAT. You can't handle it quite the same way as G_ASHR. With 8-bit ints:
1 ushlsat 5 ushlsat 5 = 0xff
1 ushlsat 7 = 0x80
So they are not the same.
If the combined shift amount for ushlsat is >= 8 then you could replace it with "x == 0 ? 0 : 0xff" but it's probably not worth doing this.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90217/new/
https://reviews.llvm.org/D90217
More information about the llvm-commits
mailing list