lima/ppir: fix disassembler temp read/write print
authorQiang Yu <yuq825@gmail.com>
Sat, 20 Jul 2019 10:11:07 +0000 (18:11 +0800)
committerQiang Yu <yuq825@gmail.com>
Wed, 24 Jul 2019 12:39:39 +0000 (20:39 +0800)
temp read/write use negtive offset, and handle
alignment==1 case.

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
src/gallium/drivers/lima/ir/pp/disasm.c

index d2a3fb17d030a525530a6eba9dc23c20c61f08ff..1f7dc0a5a80c1620463c1c38453504532c00f353 100644 (file)
@@ -304,10 +304,18 @@ print_uniform(void *code, unsigned offset)
       break;
    }
 
-   if (uniform->alignment)
-      printf(" %u", uniform->index);
-   else
-      printf(" %u.%c", uniform->index >> 2, "xyzw"[uniform->index & 3]);
+   int16_t index = uniform->index;
+   switch (uniform->alignment) {
+   case 2:
+      printf(" %d", index);
+      break;
+   case 1:
+      printf(" %d.%s", index / 2, (index & 1) ? "zw" : "xy");
+      break;
+   default:
+      printf(" %d.%c", index / 4, "xyzw"[index & 3]);
+      break;
+   }
 
    if (uniform->offset_en) {
       printf(" ");
@@ -649,11 +657,17 @@ print_temp_write(void *code, unsigned offset)
 
    printf("store.t");
 
-   if (temp_write->temp_write.alignment) {
-      printf(" %u", temp_write->temp_write.index);
-   } else {
-      printf(" %u.%c", temp_write->temp_write.index >> 2,
-             "xyzw"[temp_write->temp_write.index & 3]);
+   int16_t index = temp_write->temp_write.index;
+   switch (temp_write->temp_write.alignment) {
+   case 2:
+      printf(" %d", index);
+      break;
+   case 1:
+      printf(" %d.%s", index / 2, (index & 1) ? "zw" : "xy");
+      break;
+   default:
+      printf(" %d.%c", index / 4, "xyzw"[index & 3]);
+      break;
    }
 
    if (temp_write->temp_write.offset_en) {