const std::bitset<static_cast<int>(aco_opcode::num_opcodes)> is_atomic;
const char *name[static_cast<int>(aco_opcode::num_opcodes)];
const aco::Format format[static_cast<int>(aco_opcode::num_opcodes)];
+ /* sizes used for input/output modifiers and constants */
+ const unsigned operand_size[static_cast<int>(aco_opcode::num_opcodes)];
+ const unsigned definition_size[static_cast<int>(aco_opcode::num_opcodes)];
} Info;
extern const Info instr_info;
self.is_atomic = "1" if is_atomic else "0"
self.format = format
+ parts = name.replace('_e64', '').rsplit('_', 2)
+ op_dtype = parts[-1]
+ def_dtype = parts[-2] if len(parts) > 1 else parts[-1]
+ dtype_sizes = {'{}{}'.format(prefix, size) : size for prefix in 'biuf' for size in [64, 32, 24, 16]}
+ self.operand_size = dtype_sizes.get(op_dtype, 0)
+ self.definition_size = dtype_sizes.get(def_dtype, self.operand_size)
+
+ # exceptions
+ if self.operand_size == 24:
+ self.operand_size = 32
+ elif name in ['s_sext_i32_i8', 's_sext_i32_i16', 'v_msad_u8', 'v_cvt_pk_u16_u32', 'v_cvt_pk_i16_i32']:
+ self.operand_size = 32
+ elif name in ['v_qsad_pk_u16_u8', 'v_mqsad_pk_u16_u8', 'v_mqsad_u32_u8']:
+ self.definition_size = 0
+ self.operand_size = 0
+ elif name in ['v_mad_u64_u32', 'v_mad_i64_i32']:
+ self.operand_size = 0
+ elif name.replace('_e64', '') in ['v_lshrrev_b16', 'v_ashrrev_i16', 'v_lshlrev_b16']:
+ # v_lshlrev_b16 tested on GFX10 with 1/2 PI inline constant
+ self.operand_size = 32
+ elif '_pk_' in name or name in ['v_lerp_u8', 'v_sad_u8', 'v_sad_u16',
+ 'v_cvt_f32_ubyte0', 'v_cvt_f32_ubyte1',
+ 'v_cvt_f32_ubyte2', 'v_cvt_f32_ubyte3']:
+ self.operand_size = 32
+ self.definition_size = 32
+ elif '_pknorm_' in name:
+ self.definition_size = 32
+ elif format == Format.PSEUDO_REDUCTION:
+ # 64-bit reductions can have a larger definition size, but get_subdword_definition_info() handles that
+ self.definition_size = 32
+
# global dictionary of opcodes
opcodes = {}