summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_eu_emit.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2016-05-14 23:53:19 -0700
committerKenneth Graunke <kenneth@whitecape.org>2016-05-16 00:19:53 -0700
commit2f02fad6b3a0429798c3bd4feb4501dafa5e2fc0 (patch)
treed47aec7bb8282018ccc66a7d0b8d08ba4932aff1 /src/mesa/drivers/dri/i965/brw_eu_emit.c
parentb6f250d7f2f704c8681aaa2a158d1a39851b8494 (diff)
downloadexternal_mesa3d-2f02fad6b3a0429798c3bd4feb4501dafa5e2fc0.zip
external_mesa3d-2f02fad6b3a0429798c3bd4feb4501dafa5e2fc0.tar.gz
external_mesa3d-2f02fad6b3a0429798c3bd4feb4501dafa5e2fc0.tar.bz2
i965: Make a "does this while jump before our instruction?" helper.
I need to use this in an additional place. Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_eu_emit.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 1a2ed3f..cc2876b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -2655,6 +2655,17 @@ brw_send_indirect_surface_message(struct brw_codegen *p,
return insn;
}
+static bool
+while_jumps_before_offset(const struct brw_device_info *devinfo,
+ brw_inst *insn, int while_offset, int start_offset)
+{
+ int scale = 16 / brw_jump_scale(devinfo);
+ int jip = devinfo->gen == 6 ? brw_inst_gen6_jump_count(devinfo, insn)
+ : brw_inst_jip(devinfo, insn);
+ return while_offset + jip * scale <= start_offset;
+}
+
+
static int
brw_find_next_block_end(struct brw_codegen *p, int start_offset)
{
@@ -2698,7 +2709,6 @@ brw_find_loop_end(struct brw_codegen *p, int start_offset)
{
const struct brw_device_info *devinfo = p->devinfo;
int offset;
- int scale = 16 / brw_jump_scale(devinfo);
void *store = p->store;
assert(devinfo->gen >= 6);
@@ -2712,9 +2722,7 @@ brw_find_loop_end(struct brw_codegen *p, int start_offset)
brw_inst *insn = store + offset;
if (brw_inst_opcode(devinfo, insn) == BRW_OPCODE_WHILE) {
- int jip = devinfo->gen == 6 ? brw_inst_gen6_jump_count(devinfo, insn)
- : brw_inst_jip(devinfo, insn);
- if (offset + jip * scale <= start_offset)
+ if (while_jumps_before_offset(devinfo, insn, offset, start_offset))
return offset;
}
}