mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-27 02:20:38 +02:00
pan/mdg: stop querying datatype by reading opcode name
Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9461>
This commit is contained in:
parent
fdae70b807
commit
5d8301977b
2 changed files with 48 additions and 21 deletions
|
|
@ -41,12 +41,38 @@ extern struct mir_tag_props midgard_tag_props[16];
|
|||
static inline bool
|
||||
midgard_is_integer_op(int op)
|
||||
{
|
||||
const char *name = alu_opcode_props[op].name;
|
||||
return (op >= 0x40 && op <= 0x7E) || (op >= 0xA0 && op <= 0xC1);
|
||||
}
|
||||
|
||||
if (!name)
|
||||
static inline bool
|
||||
midgard_is_unsigned_op(int op)
|
||||
{
|
||||
assert(midgard_is_integer_op(op));
|
||||
|
||||
switch (op) {
|
||||
case midgard_alu_op_uaddsat:
|
||||
case midgard_alu_op_usubsat:
|
||||
case midgard_alu_op_uwmul:
|
||||
case midgard_alu_op_umin:
|
||||
case midgard_alu_op_umax:
|
||||
case midgard_alu_op_uavg:
|
||||
case midgard_alu_op_uravg:
|
||||
case midgard_alu_op_ushlsat:
|
||||
case midgard_alu_op_uabsdiff:
|
||||
case midgard_alu_op_ult:
|
||||
case midgard_alu_op_ule:
|
||||
case midgard_alu_op_uball_lt:
|
||||
case midgard_alu_op_uball_lte:
|
||||
case midgard_alu_op_ubany_lt:
|
||||
case midgard_alu_op_ubany_lte:
|
||||
case midgard_alu_op_u2f_rte:
|
||||
case midgard_alu_op_u2f_rtz:
|
||||
case midgard_alu_op_u2f_rtn:
|
||||
case midgard_alu_op_u2f_rtp:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
return (name[0] == 'i') || (name[0] == 'u');
|
||||
}
|
||||
}
|
||||
|
||||
/* Does this opcode *write* an integer? Same as is_integer_op, unless it's a
|
||||
|
|
|
|||
|
|
@ -37,27 +37,28 @@ mir_print_constant_component(FILE *fp, const midgard_constants *consts, unsigned
|
|||
bool is_sint = false, is_uint = false, is_hex = false;
|
||||
const char *opname = alu_opcode_props[op].name;
|
||||
|
||||
bool is_int = midgard_is_integer_op(op);
|
||||
|
||||
/* Add a sentinel name to prevent crashing */
|
||||
if (!opname)
|
||||
opname = "unknown";
|
||||
|
||||
if (opname[0] == 'u') {
|
||||
/* If the opcode starts with a 'u' we are sure we deal with an
|
||||
* unsigned int operation
|
||||
*/
|
||||
is_uint = true;
|
||||
} else if (opname[0] == 'i') {
|
||||
/* Bit ops are easier to follow when the constant is printed in
|
||||
* hexadecimal. Other operations starting with a 'i' are
|
||||
* considered to operate on signed integers. That might not
|
||||
* be true for all of them, but it's good enough for traces.
|
||||
*/
|
||||
if (op >= midgard_alu_op_iand &&
|
||||
op <= midgard_alu_op_ipopcnt)
|
||||
is_hex = true;
|
||||
else
|
||||
is_sint = true;
|
||||
}
|
||||
if (is_int) {
|
||||
is_uint = midgard_is_unsigned_op(op);
|
||||
|
||||
if (!is_uint) {
|
||||
/* Bit ops are easier to follow when the constant is printed in
|
||||
* hexadecimal. Other operations starting with a 'i' are
|
||||
* considered to operate on signed integers. That might not
|
||||
* be true for all of them, but it's good enough for traces.
|
||||
*/
|
||||
if (op >= midgard_alu_op_iand &&
|
||||
op <= midgard_alu_op_ipopcnt)
|
||||
is_hex = true;
|
||||
else
|
||||
is_sint = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (half)
|
||||
reg_mode--;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue