ir3: Introduce phi and parallelcopy instructions
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 10 Feb 2021 18:47:18 +0000 (19:47 +0100)
committerEmma Anholt <emma@anholt.net>
Thu, 10 Jun 2021 19:20:38 +0000 (12:20 -0700)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>

src/freedreno/ir3/instr-a3xx.h
src/freedreno/ir3/ir3.h
src/freedreno/ir3/ir3_print.c

index e7f31fd..656ee2b 100644 (file)
@@ -314,6 +314,14 @@ typedef enum {
         */
        OPC_META_TEX_PREFETCH = _OPC(-1, 4),
 
+       /* Parallel copies have multiple destinations, and copy each destination
+        * to its corresponding source. This happens "in parallel," meaning that
+        * it happens as-if every source is read first and then every destination
+        * is stored. These are produced in RA when register shuffling is
+        * required, and then lowered away immediately afterwards.
+        */
+       OPC_META_PARALLEL_COPY = _OPC(-1, 5),
+       OPC_META_PHI = _OPC(-1, 6),
 } opc_t;
 
 #define opc_cat(opc) ((int)((opc) >> NOPC_BITS))
index 92b9bd1..6a37afa 100644 (file)
@@ -310,6 +310,12 @@ struct ir3_instruction {
                        unsigned *outidxs;
                } end;
                struct {
+                       /* used to temporarily hold reference to nir_phi_instr
+                        * until we resolve the phi srcs
+                        */
+                       void *nphi;
+               } phi;
+               struct {
                        unsigned samp, tex;
                        unsigned input_offset;
                        unsigned samp_base : 3;
index 4eb5362..ff5c5bb 100644 (file)
@@ -99,9 +99,11 @@ static void print_instr_name(struct ir3_instruction *instr, bool flags)
        if (is_meta(instr)) {
                switch (instr->opc) {
                case OPC_META_INPUT:  printf("_meta:in");   break;
-               case OPC_META_SPLIT:        printf("_meta:split");        break;
-               case OPC_META_COLLECT:      printf("_meta:collect");      break;
-               case OPC_META_TEX_PREFETCH: printf("_meta:tex_prefetch"); break;
+               case OPC_META_SPLIT:                    printf("_meta:split");        break;
+               case OPC_META_COLLECT:                  printf("_meta:collect");      break;
+               case OPC_META_TEX_PREFETCH:             printf("_meta:tex_prefetch"); break;
+               case OPC_META_PARALLEL_COPY:    printf("_meta:parallel_copy"); break;
+               case OPC_META_PHI:                              printf("_meta:phi");          break;
 
                /* shouldn't hit here.. just for debugging: */
                default: printf("_meta:%d", instr->opc);    break;