Mesa (master): aco: add a new Operand flag to indicate that is 16-bit
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 12 12:42:17 UTC 2020
Module: Mesa
Branch: master
Commit: 0ea763a727d671fa7dab2e37b7592fc045a53396
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ea763a727d671fa7dab2e37b7592fc045a53396
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Fri Nov 6 08:49:12 2020 +0100
aco: add a new Operand flag to indicate that is 16-bit
To indicate that the upper 16-bits are always 0 and that optimizing
v_mad_u32_u16 to v_mul_u32_u24 is valid.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7425>
---
src/amd/compiler/aco_builder_h.py | 6 ++++++
src/amd/compiler/aco_ir.h | 14 +++++++++++++-
src/amd/compiler/aco_print_ir.cpp | 2 ++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/amd/compiler/aco_builder_h.py b/src/amd/compiler/aco_builder_h.py
index 426f91c8a9d..e2b12fb32a5 100644
--- a/src/amd/compiler/aco_builder_h.py
+++ b/src/amd/compiler/aco_builder_h.py
@@ -352,6 +352,12 @@ public:
}
% endfor
+
+ Operand set16bit(Operand op) {
+ op.set16bit(true);
+ return op;
+ }
+
/* hand-written helpers */
Temp as_uniform(Op op)
{
diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h
index 39db82c655a..9ceb24abbe7 100644
--- a/src/amd/compiler/aco_ir.h
+++ b/src/amd/compiler/aco_ir.h
@@ -420,7 +420,7 @@ public:
constexpr Operand()
: reg_(PhysReg{128}), isTemp_(false), isFixed_(true), isConstant_(false),
isKill_(false), isUndef_(true), isFirstKill_(false), constSize(0),
- isLateKill_(false) {}
+ isLateKill_(false), is16bit_(false) {}
explicit Operand(Temp r) noexcept
{
@@ -746,6 +746,17 @@ public:
else
return other.isTemp() && other.getTemp() == getTemp();
}
+
+ constexpr void set16bit(bool flag) noexcept
+ {
+ is16bit_ = flag;
+ }
+
+ constexpr bool is16bit() const noexcept
+ {
+ return is16bit_;
+ }
+
private:
union {
uint32_t i;
@@ -763,6 +774,7 @@ private:
uint8_t isFirstKill_:1;
uint8_t constSize:2;
uint8_t isLateKill_:1;
+ uint8_t is16bit_:1;
};
/* can't initialize bit-fields in c++11, so work around using a union */
uint16_t control_ = 0;
diff --git a/src/amd/compiler/aco_print_ir.cpp b/src/amd/compiler/aco_print_ir.cpp
index 2a90a0af2fe..e679cef6346 100644
--- a/src/amd/compiler/aco_print_ir.cpp
+++ b/src/amd/compiler/aco_print_ir.cpp
@@ -168,6 +168,8 @@ static void print_operand(const Operand *operand, FILE *output)
} else {
if (operand->isLateKill())
fprintf(output, "(latekill)");
+ if (operand->is16bit())
+ fprintf(output, "(is16bit)");
fprintf(output, "%%%d", operand->tempId());
More information about the mesa-commit
mailing list