[llvm] [NVPTX] Constant fold NVVM fmin and fmax (PR #121966)

Lewis Crawford via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 06:39:17 PST 2025


================
@@ -38,9 +38,8 @@ enum class TMAReductionOp : uint8_t {
   XOR = 7,
 };
 
-inline bool IntrinsicShouldFTZ(Intrinsic::ID IntrinsicID) {
+inline bool FloatToIntIntrinsicShouldFTZ(Intrinsic::ID IntrinsicID) {
----------------
LewisCrawford wrote:

This is mostly in response to @AlexMaclean 's comment on #118965 here:  https://github.com/llvm/llvm-project/pull/118965#discussion_r1884210682 , where he suggested it would be better to have helper functions for each class of intrinsic, rather than one big switch statement with 176 unrelated intrinsics to check for rounding modes, and 144 unrelated intrinsics with the FTZ modifier. Here, I'm adding a new FMinFMaxShouldFTZ function, and renaming IntrinsicShouldFTZ to FloatToIntIntrinsicShouldFTZ instead of combining both into a single switch statement.

I've changed these helper functions all to have explicit checks for all entries in the sets now, which means there are roughly double the number of case statements needed in this file.

Hopefully these rather unwieldy case statements can help motivate the use of flag arguments in future intrinsics, such as in #121507

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


More information about the llvm-commits mailing list