summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-09-16 22:04:57 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-10-01 15:40:34 -0700
commitef3c5ac7fb915f489a553fa9d9a0c96d219545ad (patch)
treedfc488432c16263dfe38e532aa3730a6664a3617
parent4d02faede57b782264ab97d57919e9dad7dd8131 (diff)
downloadexternal_mesa3d-ef3c5ac7fb915f489a553fa9d9a0c96d219545ad.zip
external_mesa3d-ef3c5ac7fb915f489a553fa9d9a0c96d219545ad.tar.gz
external_mesa3d-ef3c5ac7fb915f489a553fa9d9a0c96d219545ad.tar.bz2
nir/spirv/cfg: Detect switch_break after loop_break/continue
While the current CFG code is valid in the case where a switch break also happens to be a loop continue, it's a bit suboptimal. Since hardware is capable of handling the continue as a direct jump, it's better to use a continue instruction when we can than to bother with all of the nasty switch break lowering. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Cc: "12.0" <mesa-stable@lists.freedesktop.org>
-rw-r--r--src/compiler/spirv/vtn_cfg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 475454e..1c8c4f8 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -239,12 +239,12 @@ vtn_get_branch_type(struct vtn_block *block,
swcase->fallthrough == block->switch_case);
swcase->fallthrough = block->switch_case;
return vtn_branch_type_switch_fallthrough;
- } else if (block == switch_break) {
- return vtn_branch_type_switch_break;
} else if (block == loop_break) {
return vtn_branch_type_loop_break;
} else if (block == loop_cont) {
return vtn_branch_type_loop_continue;
+ } else if (block == switch_break) {
+ return vtn_branch_type_switch_break;
} else {
return vtn_branch_type_none;
}