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@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7425>
This commit is contained in:
Samuel Pitoiset 2020-11-06 08:49:12 +01:00 committed by Marge Bot
parent bda35ae6b9
commit 0ea763a727
3 changed files with 21 additions and 1 deletions

View file

@ -352,6 +352,12 @@ public:
}
% endfor
Operand set16bit(Operand op) {
op.set16bit(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) {}
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;

View file

@ -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());