aco: add a new Operand flag to indicate that is 24-bit

To indicate that the upper 8-bits are always 0 to optimize more MADs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7673>
This commit is contained in:
Samuel Pitoiset 2020-11-16 17:23:59 +01:00 committed by Marge Bot
parent 05fd780012
commit be600b009a
3 changed files with 19 additions and 1 deletions

View File

@ -358,6 +358,11 @@ public:
return op;
}
Operand set24bit(Operand op) {
op.set24bit(true);
return op;
}
/* hand-written helpers */
Temp as_uniform(Op op)
{

View File

@ -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), is16bit_(false) {}
isLateKill_(false), is16bit_(false), is24bit_(false) {}
explicit Operand(Temp r) noexcept
{
@ -757,6 +757,16 @@ public:
return is16bit_;
}
constexpr void set24bit(bool flag) noexcept
{
is24bit_ = flag;
}
constexpr bool is24bit() const noexcept
{
return is24bit_;
}
private:
union {
uint32_t i;
@ -775,6 +785,7 @@ private:
uint8_t constSize:2;
uint8_t isLateKill_:1;
uint8_t is16bit_:1;
uint8_t is24bit_:1;
};
/* can't initialize bit-fields in c++11, so work around using a union */
uint16_t control_ = 0;

View File

@ -170,6 +170,8 @@ void aco_print_operand(const Operand *operand, FILE *output)
fprintf(output, "(latekill)");
if (operand->is16bit())
fprintf(output, "(is16bit)");
if (operand->is24bit())
fprintf(output, "(is24bit)");
fprintf(output, "%%%d", operand->tempId());