diff options
author | Jason Ekstrand <[email protected]> | 2017-02-14 22:15:16 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-02-16 17:28:03 -0800 |
commit | 161d3e81bef19ddd7870ee88d50479439f28e82b (patch) | |
tree | 96bc2d094b6917d335ece4705283a28cf8753ea1 /src/mesa | |
parent | a4393bd97fe62e8299273bae769201c5c9c816ea (diff) |
nir: Combine the int and double [un]pack opcodes
NIR is a typeless IR and the two opcodes, when considered bitwise, do
exactly the same thing. There's no reason to have two versions.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 31 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 8 |
2 files changed, 13 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 94f275189f3..91c14ebddfe 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -1212,7 +1212,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) inst->saturate = instr->dest.saturate; break; - case nir_op_pack_double_2x32_split: + case nir_op_pack_64_2x32_split: /* Optimize the common case where we are re-packing a double with * the result of a previous double unpack. In this case we can take the * 32-bit value to use in the re-pack from the original double and bypass @@ -1227,8 +1227,8 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) continue; const nir_alu_instr *alu_parent = nir_instr_as_alu(parent_instr); - if (alu_parent->op == nir_op_unpack_double_2x32_split_x || - alu_parent->op == nir_op_unpack_double_2x32_split_y) + if (alu_parent->op == nir_op_unpack_64_2x32_split_x || + alu_parent->op == nir_op_unpack_64_2x32_split_y) continue; if (!alu_parent->src[0].src.is_ssa) @@ -1237,7 +1237,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) op[i] = get_nir_src(alu_parent->src[0].src); op[i] = offset(retype(op[i], BRW_REGISTER_TYPE_DF), bld, alu_parent->src[0].swizzle[channel]); - if (alu_parent->op == nir_op_unpack_double_2x32_split_y) + if (alu_parent->op == nir_op_unpack_64_2x32_split_y) op[i] = subscript(op[i], BRW_REGISTER_TYPE_UD, 1); else op[i] = subscript(op[i], BRW_REGISTER_TYPE_UD, 0); @@ -1245,18 +1245,18 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) bld.emit(FS_OPCODE_PACK, result, op[0], op[1]); break; - case nir_op_unpack_double_2x32_split_x: - case nir_op_unpack_double_2x32_split_y: { + case nir_op_unpack_64_2x32_split_x: + case nir_op_unpack_64_2x32_split_y: { /* Optimize the common case where we are unpacking from a double we have * previously packed. In this case we can just bypass the pack operation * and source directly from its arguments. */ - unsigned index = (instr->op == nir_op_unpack_double_2x32_split_x) ? 0 : 1; + unsigned index = (instr->op == nir_op_unpack_64_2x32_split_x) ? 0 : 1; if (instr->src[0].src.is_ssa) { nir_instr *parent_instr = instr->src[0].src.ssa->parent_instr; if (parent_instr->type == nir_instr_type_alu) { nir_alu_instr *alu_parent = nir_instr_as_alu(parent_instr); - if (alu_parent->op == nir_op_pack_double_2x32_split && + if (alu_parent->op == nir_op_pack_64_2x32_split && alu_parent->src[index].src.is_ssa) { op[0] = retype(get_nir_src(alu_parent->src[index].src), BRW_REGISTER_TYPE_UD); @@ -1268,20 +1268,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) } } - if (instr->op == nir_op_unpack_double_2x32_split_x) - bld.MOV(result, subscript(op[0], BRW_REGISTER_TYPE_UD, 0)); - else - bld.MOV(result, subscript(op[0], BRW_REGISTER_TYPE_UD, 1)); - break; - } - - case nir_op_pack_int_2x32_split: - bld.emit(FS_OPCODE_PACK, result, op[0], op[1]); - break; - - case nir_op_unpack_int_2x32_split_x: - case nir_op_unpack_int_2x32_split_y: { - if (instr->op == nir_op_unpack_int_2x32_split_x) + if (instr->op == nir_op_unpack_64_2x32_split_x) bld.MOV(result, subscript(op[0], BRW_REGISTER_TYPE_UD, 0)); else bld.MOV(result, subscript(op[0], BRW_REGISTER_TYPE_UD, 1)); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 2127415be7a..a7f048a0f8f 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -1762,7 +1762,7 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) break; } - case nir_op_pack_double_2x32_split: { + case nir_op_pack_64_2x32_split: { dst_reg result = dst_reg(this, glsl_type::dvec4_type); dst_reg tmp = dst_reg(this, glsl_type::uvec4_type); emit(MOV(tmp, retype(op[0], BRW_REGISTER_TYPE_UD))); @@ -1773,9 +1773,9 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) break; } - case nir_op_unpack_double_2x32_split_x: - case nir_op_unpack_double_2x32_split_y: { - enum opcode oper = (instr->op == nir_op_unpack_double_2x32_split_x) ? + case nir_op_unpack_64_2x32_split_x: + case nir_op_unpack_64_2x32_split_y: { + enum opcode oper = (instr->op == nir_op_unpack_64_2x32_split_x) ? VEC4_OPCODE_PICK_LOW_32BIT : VEC4_OPCODE_PICK_HIGH_32BIT; dst_reg tmp = dst_reg(this, glsl_type::dvec4_type); emit(MOV(tmp, op[0])); |