summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2017-06-01 18:29:00 -0700
committerConnor Abbott <cwabbott0@gmail.com>2017-06-05 18:34:17 -0700
commitc87fc02cac410e738c1a56cbdea9725073690d6d (patch)
treefec15d871ac41e080a6fc12c862017616d04decb
parente6ee874fc8f77c95192dff7d13ac828eda1c2766 (diff)
nir/gcm: use the new cross-thread attribute
-rw-r--r--src/compiler/nir/nir_opt_gcm.c71
1 files changed, 26 insertions, 45 deletions
diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c
index 8f6e820825..0fdf587b26 100644
--- a/src/compiler/nir/nir_opt_gcm.c
+++ b/src/compiler/nir/nir_opt_gcm.c
@@ -109,58 +109,39 @@ static bool
gcm_pin_instructions_block(nir_block *block, struct gcm_state *state)
{
nir_foreach_instr_safe(instr, block) {
- switch (instr->type) {
- case nir_instr_type_alu:
- instr->pass_flags = 0;
- break;
-
- case nir_instr_type_tex:
- switch (nir_instr_as_tex(instr)->op) {
- case nir_texop_tex:
- case nir_texop_txb:
- case nir_texop_lod:
- /* These two take implicit derivatives so they need to be pinned */
- instr->pass_flags = GCM_INSTR_PINNED;
- break;
-
- default:
+ if (nir_instr_is_cross_thread(instr)) {
+ /* pin cross-thread operations for now */
+ instr->pass_flags = GCM_INSTR_PINNED;
+ } else {
+ switch (instr->type) {
+ case nir_instr_type_alu:
+ case nir_instr_type_tex:
+ case nir_instr_type_load_const:
instr->pass_flags = 0;
break;
- }
- break;
- case nir_instr_type_load_const:
- instr->pass_flags = 0;
- break;
+ case nir_instr_type_intrinsic: {
+ const nir_intrinsic_info *info =
+ &nir_intrinsic_infos[nir_instr_as_intrinsic(instr)->intrinsic];
- case nir_instr_type_intrinsic: {
- nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
- const nir_intrinsic_info *info =
- &nir_intrinsic_infos[intrin->intrinsic];
-
- if ((info->flags & NIR_INTRINSIC_CAN_ELIMINATE) &&
- (info->flags & NIR_INTRINSIC_CAN_REORDER) &&
- intrin->intrinsic != nir_intrinsic_fddx &&
- intrin->intrinsic != nir_intrinsic_fddy &&
- intrin->intrinsic != nir_intrinsic_fddx_coarse &&
- intrin->intrinsic != nir_intrinsic_fddy_coarse &&
- intrin->intrinsic != nir_intrinsic_fddx_fine &&
- intrin->intrinsic != nir_intrinsic_fddy_fine) {
- instr->pass_flags = 0;
- } else {
- instr->pass_flags = GCM_INSTR_PINNED;
+ if ((info->flags & NIR_INTRINSIC_CAN_ELIMINATE) &&
+ (info->flags & NIR_INTRINSIC_CAN_REORDER)) {
+ instr->pass_flags = 0;
+ } else {
+ instr->pass_flags = GCM_INSTR_PINNED;
+ }
+ break;
}
- break;
- }
- case nir_instr_type_jump:
- case nir_instr_type_ssa_undef:
- case nir_instr_type_phi:
- instr->pass_flags = GCM_INSTR_PINNED;
- break;
+ case nir_instr_type_jump:
+ case nir_instr_type_ssa_undef:
+ case nir_instr_type_phi:
+ instr->pass_flags = GCM_INSTR_PINNED;
+ break;
- default:
- unreachable("Invalid instruction type in GCM");
+ default:
+ unreachable("Invalid instruction type in GCM");
+ }
}
if (!(instr->pass_flags & GCM_INSTR_PINNED)) {