}
}
-static unsigned
+static void
print_dest(unsigned reg, midgard_reg_mode mode, midgard_dest_override override)
{
/* Depending on the mode and override, we determine the type of
update_dest(reg);
print_reg(reg, bits);
-
- return bits;
}
static void
{
printf(".");
- if (override == midgard_dest_override_none) {
- for (unsigned i = 0; i < 8; i++) {
- if (mask & (1 << i))
- printf("%c%c",
- components[i*2 + 0],
- components[i*2 + 1]);
- }
- } else {
- bool upper = (override == midgard_dest_override_upper);
-
- for (unsigned i = 0; i < 8; i++) {
- if (mask & (1 << i))
- printf("%c", components[i + (upper ? 8 : 0)]);
- }
+ for (unsigned i = 0; i < 8; i++) {
+ if (mask & (1 << i))
+ printf("%c%c",
+ components[i*2 + 0],
+ components[i*2 + 1]);
}
}
return;
}
- if (bits < 16) {
- /* Shouldn't happen but with junk / out-of-spec shaders it
- * would cause an infinite loop */
-
- printf("/* XXX: bits = %u */", bits);
- return;
- }
-
/* Skip 'complete' masks */
- if (bits >= 32 && mask == 0xFF) return;
-
- if (bits == 16) {
- if (mask == 0x0F)
- return;
- else if (mask == 0xF0) {
- printf("'");
- return;
+ if (override == midgard_dest_override_none) {
+ if (bits >= 32 && mask == 0xFF) return;
+
+ if (bits == 16) {
+ if (mask == 0x0F)
+ return;
+ else if (mask == 0xF0) {
+ printf("'");
+ return;
+ }
}
}
bool uppercase = bits > 32;
bool tripped = false;
+ /* To apply an upper destination override, we "shift" the alphabet.
+ * E.g. with an upper override on 32-bit, instead of xyzw, print efgh.
+ * For upper 16-bit, instead of xyzwefgh, print ijklmnop */
+
+ const char *alphabet = components;
+
+ if (override == midgard_dest_override_upper) {
+ unsigned components = 128 / bits;
+ alphabet += components;
+ }
+
for (unsigned i = 0; i < 8; i += skip) {
bool a = (mask & (1 << i)) != 0;
}
if (a) {
- char c = components[i / skip];
+ char c = alphabet[i / skip];
if (uppercase)
c = toupper(c);
uint8_t mask = alu_field->mask;
/* First, print the destination */
- unsigned dest_size =
- print_dest(reg_info->out_reg, mode, alu_field->dest_override);
-
- /* Apply the destination override to the mask */
-
- if (mode == midgard_reg_mode_32 || mode == midgard_reg_mode_64) {
- if (override == midgard_dest_override_lower)
- mask &= 0x0F;
- else if (override == midgard_dest_override_upper)
- mask &= 0xF0;
- } else if (mode == midgard_reg_mode_16
- && override == midgard_dest_override_lower) {
- /* stub */
- }
+ print_dest(reg_info->out_reg, mode, alu_field->dest_override);
if (override != midgard_dest_override_none) {
bool modeable = (mode != midgard_reg_mode_8);
printf("/* do%u */ ", override);
}
- print_mask(mask, dest_size, override);
+ print_mask(mask, bits_for_mode(mode), override);
printf(", ");