[llvm] [WIP][AMDGPU] Split `isInlinableLiteral16` into three and call the specific version if possible (PR #81345)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 14:23:16 PST 2024


================
@@ -2652,13 +2652,28 @@ bool isInlinableLiteral32(int32_t Literal, bool HasInv2Pi) {
          (Val == 0x3e22f983 && HasInv2Pi);
 }
 
-bool isInlinableLiteral16(int16_t Literal, bool HasInv2Pi) {
+bool isInlinableLiteralI16(int16_t Literal, bool HasInv2Pi) {
+  if (!HasInv2Pi)
+    return false;
+  if (isInlinableIntLiteral(Literal))
+    return true;
+  return (Literal == static_cast<int16_t>(llvm::bit_cast<uint32_t>(0.0f))) ||
----------------
shiltian wrote:

This large condition statement is based on my understanding of the 3rd paragraph of the section `OPF_INV2PI_16`.

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


More information about the llvm-commits mailing list