panfrost: introduce LDST_ATOMIC property
authorItalo Nicola <italonicola@collabora.com>
Wed, 26 Aug 2020 11:13:39 +0000 (11:13 +0000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 1 Sep 2020 21:04:09 +0000 (21:04 +0000)
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6439>

src/panfrost/midgard/helpers.h
src/panfrost/midgard/midgard_ops.c
src/panfrost/midgard/midgard_ops.h

index e0a595c2c3d02d8d29f284fddb497565d5e51fd7..1deac259151dfc1e656336147d4f8e9ee8ad93c6 100644 (file)
@@ -238,6 +238,9 @@ struct mir_tag_props {
 /* Computes an address according to indirects/zext/shift/etc */
 #define LDST_ADDRESS (1 << 5)
 
 /* Computes an address according to indirects/zext/shift/etc */
 #define LDST_ADDRESS (1 << 5)
 
+/* Some fields such swizzle and address have special meanings */
+#define LDST_ATOMIC (1 << 6)
+
 /* This file is common, so don't define the tables themselves. #include
  * midgard_op.h if you need that, or edit midgard_ops.c directly */
 
 /* This file is common, so don't define the tables themselves. #include
  * midgard_op.h if you need that, or edit midgard_ops.c directly */
 
index 2d70ed0c3ff180d29d07a086505d93efaf32da53..2768fa8db228c5ae2567fff46c684876e7e0427b 100644 (file)
@@ -188,27 +188,27 @@ struct mir_ldst_op_props load_store_opcode_props[256] = {
         [midgard_op_ldst_perspective_division_z] = {"ldst_perspective_division_z", M32},
         [midgard_op_ldst_perspective_division_w] = {"ldst_perspective_division_w", M32},
 
         [midgard_op_ldst_perspective_division_z] = {"ldst_perspective_division_z", M32},
         [midgard_op_ldst_perspective_division_w] = {"ldst_perspective_division_w", M32},
 
-        [midgard_op_atomic_add]  = {"atomic_add",  M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_and]  = {"atomic_and",  M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_or]   = {"atomic_or",   M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_xor]  = {"atomic_xor",  M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_imin] = {"atomic_imin", M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_umin] = {"atomic_umin", M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_imax] = {"atomic_imax", M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_umax] = {"atomic_umax", M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_xchg] = {"atomic_xchg", M32 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_cmpxchg] = {"atomic_cmpxchg", M32 | LDST_SIDE_FX | LDST_ADDRESS},
-
-        [midgard_op_atomic_add64]  = {"atomic_add64",  M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_and64]  = {"atomic_and64",  M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_or64]   = {"atomic_or64",   M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_xor64]  = {"atomic_xor64",  M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_imin64] = {"atomic_imin64", M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_umin64] = {"atomic_umin64", M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_imax64] = {"atomic_imax64", M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_umax64] = {"atomic_umax64", M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_xchg64] = {"atomic_xchg64", M64 | LDST_SIDE_FX | LDST_ADDRESS},
-        [midgard_op_atomic_cmpxchg64] = {"atomic_cmpxchg64", M64 | LDST_SIDE_FX | LDST_ADDRESS},
+        [midgard_op_atomic_add]     = {"atomic_add",     M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_and]     = {"atomic_and",     M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_or]      = {"atomic_or",      M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_xor]     = {"atomic_xor",     M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_imin]    = {"atomic_imin",    M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_umin]    = {"atomic_umin",    M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_imax]    = {"atomic_imax",    M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_umax]    = {"atomic_umax",    M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_xchg]    = {"atomic_xchg",    M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_cmpxchg] = {"atomic_cmpxchg", M32 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+
+        [midgard_op_atomic_add64]     = {"atomic_add64",     M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_and64]     = {"atomic_and64",     M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_or64]      = {"atomic_or64",      M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_xor64]     = {"atomic_xor64",     M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_imin64]    = {"atomic_imin64",    M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_umin64]    = {"atomic_umin64",    M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_imax64]    = {"atomic_imax64",    M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_umax64]    = {"atomic_umax64",    M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_xchg64]    = {"atomic_xchg64",    M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
+        [midgard_op_atomic_cmpxchg64] = {"atomic_cmpxchg64", M64 | LDST_SIDE_FX | LDST_ADDRESS | LDST_ATOMIC},
 
         [midgard_op_ld_uchar]  = {"ld_uchar", M32 | LDST_ADDRESS},
         [midgard_op_ld_char]   = {"ld_char",   M32 | LDST_ADDRESS},
 
         [midgard_op_ld_uchar]  = {"ld_uchar", M32 | LDST_ADDRESS},
         [midgard_op_ld_char]   = {"ld_char",   M32 | LDST_ADDRESS},
index 6c5bd4d0942d14a1fddba3d11cd8bd6ba34dffa4..ee4dca6ae9966d9262b5022bcc26b09e87ac4d55 100644 (file)
@@ -30,6 +30,7 @@ extern struct mir_op_props alu_opcode_props[256];
 extern struct mir_ldst_op_props load_store_opcode_props[256];
 extern struct mir_tag_props midgard_tag_props[16];
 
 extern struct mir_ldst_op_props load_store_opcode_props[256];
 extern struct mir_tag_props midgard_tag_props[16];
 
+#define OP_IS_ATOMIC(op) (load_store_opcode_props[op].props & LDST_ATOMIC)
 #define OP_IS_STORE(op) (load_store_opcode_props[op].props & LDST_STORE)
 #define OP_HAS_ADDRESS(op) (load_store_opcode_props[op].props & LDST_ADDRESS)
 
 #define OP_IS_STORE(op) (load_store_opcode_props[op].props & LDST_STORE)
 #define OP_HAS_ADDRESS(op) (load_store_opcode_props[op].props & LDST_ADDRESS)