[PATCH] D100149: [AMDGPU][GlobalISel] Legalize and select G_SBFX and G_UBFX
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 21 03:18:45 PDT 2021
foad added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp:498-499
}
+ case TargetOpcode::G_SBFX:
+ case TargetOpcode::G_UBFX: {
+ Register SrcReg = MI.getOperand(1).getReg();
----------------
This should really go in as a separate patch with unit tests in unittests/CodeGen/GlobalISel/KnownBitsTest.cpp.
================
Comment at: llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp:518
+ /*Add*/ false, /*NSW*/ false, ExtKnown, WidthKnown);
+ Known = KnownBits::ashr(KnownBits::shl(Known, ShiftKnown), ShiftKnown);
+ }
----------------
This looks technically correct but I can't help feeling you'd get more precise results (when Width isn't exactly known) from a specialized KnownBits::sext function. On the other hand, maybe it's not worth optimizing for the case where Width isn't exactly known.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100149/new/
https://reviews.llvm.org/D100149
More information about the llvm-commits
mailing list