summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-03-26 17:27:16 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:54:00 -0700
commit0d03c63e91731d07df23ffd9d1278b05ec2d971a (patch)
treea2299ec3f65426190942a274be04dee84da40e55 /src/compiler/nir
parentc290e8c4b00500bbe4b8ac7da5d2b021e4a0b0a7 (diff)
nir/lower_io: Convert atomic lowering to deref instructions
No one is currently using so we can make this change irrespective of driver. We may use it again in i965 so it's best to pretend to keep it working. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_lower_io.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index f063372793d..622b625b29a 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -275,7 +275,7 @@ lower_atomic(nir_intrinsic_instr *intrin, struct lower_io_state *state,
nir_intrinsic_op op;
switch (intrin->intrinsic) {
-#define OP(O) case nir_intrinsic_var_##O: op = nir_intrinsic_shared_##O; break;
+#define OP(O) case nir_intrinsic_deref_##O: op = nir_intrinsic_shared_##O; break;
OP(atomic_exchange)
OP(atomic_comp_swap)
OP(atomic_add)
@@ -297,8 +297,10 @@ lower_atomic(nir_intrinsic_instr *intrin, struct lower_io_state *state,
nir_intrinsic_set_base(atomic, var->data.driver_location);
atomic->src[0] = nir_src_for_ssa(offset);
- for (unsigned i = 0; i < nir_intrinsic_infos[intrin->intrinsic].num_srcs; i++) {
- nir_src_copy(&atomic->src[i+1], &intrin->src[i], atomic);
+ assert(nir_intrinsic_infos[intrin->intrinsic].num_srcs ==
+ nir_intrinsic_infos[op].num_srcs);
+ for (unsigned i = 1; i < nir_intrinsic_infos[op].num_srcs; i++) {
+ nir_src_copy(&atomic->src[i], &intrin->src[i], atomic);
}
return atomic;
@@ -383,16 +385,16 @@ nir_lower_io_block(nir_block *block,
case nir_intrinsic_load_deref:
case nir_intrinsic_store_var:
case nir_intrinsic_store_deref:
- case nir_intrinsic_var_atomic_add:
- case nir_intrinsic_var_atomic_imin:
- case nir_intrinsic_var_atomic_umin:
- case nir_intrinsic_var_atomic_imax:
- case nir_intrinsic_var_atomic_umax:
- case nir_intrinsic_var_atomic_and:
- case nir_intrinsic_var_atomic_or:
- case nir_intrinsic_var_atomic_xor:
- case nir_intrinsic_var_atomic_exchange:
- case nir_intrinsic_var_atomic_comp_swap:
+ case nir_intrinsic_deref_atomic_add:
+ case nir_intrinsic_deref_atomic_imin:
+ case nir_intrinsic_deref_atomic_umin:
+ case nir_intrinsic_deref_atomic_imax:
+ case nir_intrinsic_deref_atomic_umax:
+ case nir_intrinsic_deref_atomic_and:
+ case nir_intrinsic_deref_atomic_or:
+ case nir_intrinsic_deref_atomic_xor:
+ case nir_intrinsic_deref_atomic_exchange:
+ case nir_intrinsic_deref_atomic_comp_swap:
/* We can lower the io for this nir instrinsic */
break;
case nir_intrinsic_interp_var_at_centroid:
@@ -457,16 +459,16 @@ nir_lower_io_block(nir_block *block,
component_offset);
break;
- case nir_intrinsic_var_atomic_add:
- case nir_intrinsic_var_atomic_imin:
- case nir_intrinsic_var_atomic_umin:
- case nir_intrinsic_var_atomic_imax:
- case nir_intrinsic_var_atomic_umax:
- case nir_intrinsic_var_atomic_and:
- case nir_intrinsic_var_atomic_or:
- case nir_intrinsic_var_atomic_xor:
- case nir_intrinsic_var_atomic_exchange:
- case nir_intrinsic_var_atomic_comp_swap:
+ case nir_intrinsic_deref_atomic_add:
+ case nir_intrinsic_deref_atomic_imin:
+ case nir_intrinsic_deref_atomic_umin:
+ case nir_intrinsic_deref_atomic_imax:
+ case nir_intrinsic_deref_atomic_umax:
+ case nir_intrinsic_deref_atomic_and:
+ case nir_intrinsic_deref_atomic_or:
+ case nir_intrinsic_deref_atomic_xor:
+ case nir_intrinsic_deref_atomic_exchange:
+ case nir_intrinsic_deref_atomic_comp_swap:
assert(vertex_index == NULL);
replacement = lower_atomic(intrin, state, var, offset);
break;
@@ -539,6 +541,8 @@ nir_lower_io(nir_shader *shader, nir_variable_mode modes,
{
bool progress = false;
+ nir_assert_unlowered_derefs(shader, nir_lower_atomic_derefs);
+
nir_foreach_function(function, shader) {
if (function->impl) {
progress |= nir_lower_io_impl(function->impl, modes,