From 8912f16464230ebe733538ced222c4509d574fef Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Fri, 13 Sep 2024 19:53:13 +0200 Subject: [PATCH] aco/ir: add float control definition flags Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_ir.h | 18 +++++++++++++++++- src/amd/compiler/aco_print_ir.cpp | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 83cfbb6ac02..ca97edb784e 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -911,7 +911,8 @@ private: class Definition final { public: constexpr Definition() - : temp(Temp(0, s1)), reg_(0), isFixed_(0), isKill_(0), isPrecise_(0), isNUW_(0), isNoCSE_(0) + : temp(Temp(0, s1)), reg_(0), isFixed_(0), isKill_(0), isPrecise_(0), isInfPreserve_(0), + isNaNPreserve_(0), isSZPreserve_(0), isNUW_(0), isNoCSE_(0) {} Definition(uint32_t index, RegClass type) noexcept : temp(index, type) {} explicit Definition(Temp tmp) noexcept : temp(tmp) {} @@ -955,6 +956,18 @@ public: constexpr bool isPrecise() const noexcept { return isPrecise_; } + constexpr void setInfPreserve(bool inf_preserve) noexcept { isInfPreserve_ = inf_preserve; } + + constexpr bool isInfPreserve() const noexcept { return isInfPreserve_; } + + constexpr void setNaNPreserve(bool nan_preserve) noexcept { isNaNPreserve_ = nan_preserve; } + + constexpr bool isNaNPreserve() const noexcept { return isNaNPreserve_; } + + constexpr void setSZPreserve(bool sz_preserve) noexcept { isSZPreserve_ = sz_preserve; } + + constexpr bool isSZPreserve() const noexcept { return isSZPreserve_; } + /* No Unsigned Wrap */ constexpr void setNUW(bool nuw) noexcept { isNUW_ = nuw; } @@ -972,6 +985,9 @@ private: uint8_t isFixed_ : 1; uint8_t isKill_ : 1; uint8_t isPrecise_ : 1; + uint8_t isInfPreserve_ : 1; + uint8_t isNaNPreserve_ : 1; + uint8_t isSZPreserve_ : 1; uint8_t isNUW_ : 1; uint8_t isNoCSE_ : 1; }; diff --git a/src/amd/compiler/aco_print_ir.cpp b/src/amd/compiler/aco_print_ir.cpp index dde7ba349fd..3af249abaa3 100644 --- a/src/amd/compiler/aco_print_ir.cpp +++ b/src/amd/compiler/aco_print_ir.cpp @@ -150,6 +150,16 @@ print_definition(const Definition* definition, FILE* output, unsigned flags) print_reg_class(definition->regClass(), output); if (definition->isPrecise()) fprintf(output, "(precise)"); + if (definition->isInfPreserve() || definition->isNaNPreserve() || definition->isSZPreserve()) { + fprintf(output, "("); + if (definition->isSZPreserve()) + fprintf(output, "Sz"); + if (definition->isInfPreserve()) + fprintf(output, "Inf"); + if (definition->isNaNPreserve()) + fprintf(output, "NaN"); + fprintf(output, "Preserve)"); + } if (definition->isNUW()) fprintf(output, "(nuw)"); if (definition->isNoCSE())