[PATCH] D157111: AMDGPU: Try to select fmul by power of 2 to ldexp

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 05:34:08 PDT 2023


foad added a comment.

Any plans to do something for negated powers of two?



================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:3330
+// immediate where it's preferable to emit a multiply by as an
+// ldexp. We skip over -4.0 to 4.0 as those are inline immediates
+// anyway.
----------------



================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:3335
+    // Prefer leaving the FP inline immediates as they are.
+    // [+-]4.0, [+-]2.0, [+-]0.5, [+-]1.0
+    if (Exp >= -1 && Exp <= 2)
----------------



================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:3342
+    // materializing a 64-bit constant.
+    return (Exp >= -16) && (Exp <= 64);
+  }], FPPow2ToExponentXForm
----------------
Don't need parens.


================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:3349
+    // Prefer leaving the FP inline immediates as they are.
+    // [+-]4.0, [+-]2.0, [+-]0.5, [+-]1.0
+
----------------



================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:3353
+    // constant.
+    return Exp != INT_MIN && ((Exp < -1 || Exp > 2));
+  }], FPPow2ToExponentXForm
----------------
Too many parens.


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

https://reviews.llvm.org/D157111



More information about the llvm-commits mailing list