From 2a33510f1649f2ef5c5b2d693aa89ef0efc5dcfb Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 11 Feb 2014 13:12:07 -0800 Subject: [PATCH] i965/fs: Decide predicate/predicate_inverse outside of the for loop. Reviewed-by: Kenneth Graunke --- .../drivers/dri/i965/brw_fs_sel_peephole.cpp | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp index c0bba8e7ced..03c7ee64538 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp @@ -156,6 +156,18 @@ fs_visitor::opt_peephole_sel() fs_inst *sel_inst[MAX_MOVS] = { NULL }; fs_inst *mov_imm_inst[MAX_MOVS] = { NULL }; + enum brw_predicate predicate; + bool predicate_inverse; + if (brw->gen == 6 && if_inst->conditional_mod) { + /* For Sandybridge with IF with embedded comparison */ + predicate = BRW_PREDICATE_NORMAL; + predicate_inverse = false; + } else { + /* Separate CMP and IF instructions */ + predicate = if_inst->predicate; + predicate_inverse = if_inst->predicate_inverse; + } + /* Generate SEL instructions for pairs of MOVs to a common destination. */ for (int i = 0; i < movs; i++) { if (!then_mov[i] || !else_mov[i]) @@ -190,15 +202,8 @@ fs_visitor::opt_peephole_sel() } sel_inst[i] = SEL(then_mov[i]->dst, src0, else_mov[i]->src[0]); - - if (brw->gen == 6 && if_inst->conditional_mod) { - /* For Sandybridge with IF with embedded comparison */ - sel_inst[i]->predicate = BRW_PREDICATE_NORMAL; - } else { - /* Separate CMP and IF instructions */ - sel_inst[i]->predicate = if_inst->predicate; - sel_inst[i]->predicate_inverse = if_inst->predicate_inverse; - } + sel_inst[i]->predicate = predicate; + sel_inst[i]->predicate_inverse = predicate_inverse; } } -- 2.30.2