ins.has_constants = true;
if (instr->op == nir_op_b2f32) {
- ins.constants[0] = 1.0f;
+ float f = 1.0f;
+ memcpy(&ins.constants, &f, sizeof(float));
} else {
- /* Type pun it into place */
- uint32_t one = 0x1;
- memcpy(&ins.constants[0], &one, sizeof(uint32_t));
+ ins.constants[0] = 1;
}
ins.alu.src2 = vector_alu_srco_unsigned(blank_alu_src_xxxx);
ins.ssa_args.inline_constant = false;
ins.ssa_args.src[1] = SSA_FIXED_REGISTER(REGISTER_CONSTANT);
ins.has_constants = true;
- ins.constants[0] = 0.0f;
+ ins.constants[0] = 0;
ins.alu.src2 = vector_alu_srco_unsigned(blank_alu_src_xxxx);
} else if (instr->op == nir_op_inot) {
ins.invert = true;
if (scaled_constant != iconstants[component])
continue;
} else {
- float original = (float) ins->constants[component];
+ float *f = (float *) ins->constants;
+ float original = f[component];
scaled_constant = _mesa_float_to_half(original);
/* Check for loss of precision. If this is
* vector by checking if all accessed values
* (by the swizzle) are the same. */
- uint32_t *cons = (uint32_t *) ins->constants;
+ uint32_t *cons = ins->constants;
uint32_t value = cons[component];
bool is_vector = false;
printf(", ");
mir_print_index(args->src[2]);
- if (ins->has_constants)
- printf(" <%f, %f, %f, %f>", ins->constants[0], ins->constants[1], ins->constants[2], ins->constants[3]);
+ if (ins->has_constants) {
+ uint32_t *uc = ins->constants;
+ float *fc = (float *) uc;
+
+ if (midgard_is_integer_op(ins->alu.op))
+ printf(" <0x%X, 0x%X, 0x%X, 0x%x>", uc[0], uc[1], uc[2], uc[3]);
+ else
+ printf(" <%f, %f, %f, %f>", fc[0], fc[1], fc[2], fc[3]);
+ }
if (ins->no_spill)
printf(" /* no spill */");