fprintf(fp, " = load_const (");
+ /*
+ * we don't really know the type of the constant (if it will be used as a
+ * float or an int), so just print the raw constant in hex for fidelity
+ * and then print in float again for readability.
+ */
+
for (unsigned i = 0; i < instr->def.num_components; i++) {
if (i != 0)
fprintf(fp, ", ");
- /*
- * we don't really know the type of the constant (if it will be used as a
- * float or an int), so just print the raw constant in hex for fidelity
- * and then print the float in a comment for readability.
- */
-
switch (instr->def.bit_size) {
case 64:
- fprintf(fp, "0x%016" PRIx64 " /* %f */", instr->value[i].u64,
- instr->value[i].f64);
+ fprintf(fp, "0x%016" PRIx64, instr->value[i].u64);
break;
case 32:
- fprintf(fp, "0x%08x /* %f */", instr->value[i].u32, instr->value[i].f32);
+ fprintf(fp, "0x%08x", instr->value[i].u32);
break;
case 16:
- fprintf(fp, "0x%04x /* %f */", instr->value[i].u16,
- _mesa_half_to_float(instr->value[i].u16));
+ fprintf(fp, "0x%04x", instr->value[i].u16);
break;
case 8:
fprintf(fp, "0x%02x", instr->value[i].u8);
}
}
+ if (instr->def.bit_size > 8) {
+ if (instr->def.num_components > 1)
+ fprintf(fp, ") = (");
+ else
+ fprintf(fp, " = ");
+
+ for (unsigned i = 0; i < instr->def.num_components; i++) {
+ if (i != 0)
+ fprintf(fp, ", ");
+
+ switch (instr->def.bit_size) {
+ case 64:
+ fprintf(fp, "%f", instr->value[i].f64);
+ break;
+ case 32:
+ fprintf(fp, "%f", instr->value[i].f32);
+ break;
+ case 16:
+ fprintf(fp, "%f", _mesa_half_to_float(instr->value[i].u16));
+ break;
+ default:
+ unreachable("unhandled bit size");
+ }
+ }
+ }
+
fprintf(fp, ")");
}