i965/fs: Make resolve_source_modifiers consistent with the vec4 version

Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Jason Ekstrand 2015-08-10 11:52:50 -07:00
parent 7068a6409c
commit 8a688bee83
3 changed files with 16 additions and 15 deletions

View file

@ -1311,15 +1311,16 @@ fs_visitor::emit_sampleid_setup()
return reg; return reg;
} }
void fs_reg
fs_visitor::resolve_source_modifiers(fs_reg *src) fs_visitor::resolve_source_modifiers(const fs_reg &src)
{ {
if (!src->abs && !src->negate) if (!src.abs && !src.negate)
return; return src;
fs_reg temp = bld.vgrf(src->type); fs_reg temp = bld.vgrf(src.type);
bld.MOV(temp, *src); bld.MOV(temp, src);
*src = temp;
return temp;
} }
void void

View file

@ -225,7 +225,7 @@ public:
fs_reg emit_mcs_fetch(const fs_reg &coordinate, unsigned components, fs_reg emit_mcs_fetch(const fs_reg &coordinate, unsigned components,
const fs_reg &sampler); const fs_reg &sampler);
void emit_gen6_gather_wa(uint8_t wa, fs_reg dst); void emit_gen6_gather_wa(uint8_t wa, fs_reg dst);
void resolve_source_modifiers(fs_reg *src); fs_reg resolve_source_modifiers(const fs_reg &src);
void emit_discard_jump(); void emit_discard_jump();
bool try_replace_with_sel(); bool try_replace_with_sel();
bool opt_peephole_sel(); bool opt_peephole_sel();

View file

@ -811,28 +811,28 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
case nir_op_inot: case nir_op_inot:
if (devinfo->gen >= 8) { if (devinfo->gen >= 8) {
resolve_source_modifiers(&op[0]); op[0] = resolve_source_modifiers(op[0]);
} }
bld.NOT(result, op[0]); bld.NOT(result, op[0]);
break; break;
case nir_op_ixor: case nir_op_ixor:
if (devinfo->gen >= 8) { if (devinfo->gen >= 8) {
resolve_source_modifiers(&op[0]); op[0] = resolve_source_modifiers(op[0]);
resolve_source_modifiers(&op[1]); op[1] = resolve_source_modifiers(op[1]);
} }
bld.XOR(result, op[0], op[1]); bld.XOR(result, op[0], op[1]);
break; break;
case nir_op_ior: case nir_op_ior:
if (devinfo->gen >= 8) { if (devinfo->gen >= 8) {
resolve_source_modifiers(&op[0]); op[0] = resolve_source_modifiers(op[0]);
resolve_source_modifiers(&op[1]); op[1] = resolve_source_modifiers(op[1]);
} }
bld.OR(result, op[0], op[1]); bld.OR(result, op[0], op[1]);
break; break;
case nir_op_iand: case nir_op_iand:
if (devinfo->gen >= 8) { if (devinfo->gen >= 8) {
resolve_source_modifiers(&op[0]); op[0] = resolve_source_modifiers(op[0]);
resolve_source_modifiers(&op[1]); op[1] = resolve_source_modifiers(op[1]);
} }
bld.AND(result, op[0], op[1]); bld.AND(result, op[0], op[1]);
break; break;