[llvm] [AMDGPU] Replace `isInlinableLiteral16` with specific version (PR #81345)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 01:23:11 PST 2024


================
@@ -4121,8 +4121,26 @@ bool SIInstrInfo::isInlineConstant(const APInt &Imm) const {
                                         ST.hasInv2PiInlineImm());
   case 16:
     return ST.has16BitInsts() &&
-           AMDGPU::isInlinableLiteral16(Imm.getSExtValue(),
-                                        ST.hasInv2PiInlineImm());
+           AMDGPU::isInlinableLiteralI16(Imm.getSExtValue(),
+                                         ST.hasInv2PiInlineImm());
+  default:
+    llvm_unreachable("invalid bitwidth");
+  }
+}
+
+bool SIInstrInfo::isInlineConstant(const APFloat &Imm) const {
+  APInt IntImm = Imm.bitcastToAPInt();
+  bool HasInv2Pi = ST.hasInv2PiInlineImm();
+  switch (IntImm.getBitWidth()) {
+  case 32:
+  case 64:
+    return isInlineConstant(IntImm);
+  case 16:
+    return ST.has16BitInsts() &&
+           (Imm.isIEEE() ? AMDGPU::isInlinableLiteralFP16(IntImm.getSExtValue(),
----------------
arsenm wrote:

This isIEEE check will always be true. This is not a check for the fltSemantics, both use IEEEfloat layout 

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


More information about the llvm-commits mailing list