diff options
author | Ian Romanick <[email protected]> | 2016-06-29 18:00:22 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-10-04 16:53:32 -0700 |
commit | 7cd0b3084cb5e1ee69431d462eedc2e3e7eb8203 (patch) | |
tree | fdefee475d34eefd73c022bc9969fd824c59a32e /src/compiler/nir/nir_lower_atomics.c | |
parent | 2c9a17ac79810f455dd6a82acf4355b579c222e9 (diff) |
nir/intrinsics: Add more atomic_counter ops
v2: Delete some stray debug code notice by Iago.
v3: Massive rebase on new ir_function_signature::intrinsic_id mechanism.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]> [v1]
Acked-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_atomics.c')
-rw-r--r-- | src/compiler/nir/nir_lower_atomics.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c index 04e1febc179..583e2a50c74 100644 --- a/src/compiler/nir/nir_lower_atomics.c +++ b/src/compiler/nir/nir_lower_atomics.c @@ -54,6 +54,38 @@ lower_instr(nir_intrinsic_instr *instr, op = nir_intrinsic_atomic_counter_dec; break; + case nir_intrinsic_atomic_counter_add_var: + op = nir_intrinsic_atomic_counter_add; + break; + + case nir_intrinsic_atomic_counter_min_var: + op = nir_intrinsic_atomic_counter_min; + break; + + case nir_intrinsic_atomic_counter_max_var: + op = nir_intrinsic_atomic_counter_max; + break; + + case nir_intrinsic_atomic_counter_and_var: + op = nir_intrinsic_atomic_counter_and; + break; + + case nir_intrinsic_atomic_counter_or_var: + op = nir_intrinsic_atomic_counter_or; + break; + + case nir_intrinsic_atomic_counter_xor_var: + op = nir_intrinsic_atomic_counter_xor; + break; + + case nir_intrinsic_atomic_counter_exchange_var: + op = nir_intrinsic_atomic_counter_exchange; + break; + + case nir_intrinsic_atomic_counter_comp_swap_var: + op = nir_intrinsic_atomic_counter_comp_swap; + break; + default: return; } @@ -120,6 +152,12 @@ lower_instr(nir_intrinsic_instr *instr, new_instr->src[0].is_ssa = true; new_instr->src[0].ssa = offset_def; + /* Copy the other sources, if any, from the original instruction to the new + * instruction. + */ + for (unsigned i = 0; i < nir_intrinsic_infos[instr->intrinsic].num_srcs; i++) + new_instr->src[i + 1] = instr->src[i]; + if (instr->dest.is_ssa) { nir_ssa_dest_init(&new_instr->instr, &new_instr->dest, instr->dest.ssa.num_components, 32, NULL); |