From b7c47c4f7cfd0513ee2b98179cc22f402e5b3817 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 18 Apr 2020 01:20:42 -0700 Subject: intel/compiler: Drop nir_lower_to_source_mods() and related handling. I think we're unanimous in wanting to drop nir_lower_to_source_mods. It's a bit of complexity to handle in the backend, but perhaps more importantly, would be even more complexity to handle in nir_search. And, it turns out that since we made other compiler improvements in the last few years, they no longer appear to buy us anything of value. Summarizing the results from shader-db from this patch: - Icelake (scalar mode) Instruction counts: - 411 helped, 598 hurt (out of 139,470 shaders) - 99.2% of shaders remain unaffected. The average increase in instruction count in hurt programs is 1.78 instructions. - total instructions in shared programs: 17214951 -> 17215206 (<.01%) - instructions in affected programs: 1143879 -> 1144134 (0.02%) Cycles: - 1042 helped, 1357 hurt - total cycles in shared programs: 365613294 -> 365882263 (0.07%) - cycles in affected programs: 138155497 -> 138424466 (0.19%) - Haswell (both scalar and vector modes) Instruction counts: - 73 helped, 1680 hurt (out of 139,470 shaders) - 98.7% of shaders remain unaffected. The average increase in instruction count in hurt programs is 1.9 instructions. - total instructions in shared programs: 14199527 -> 14202262 (0.02%) - instructions in affected programs: 446499 -> 449234 (0.61%) Cycles: - 5253 helped, 5559 hurt - total cycles in shared programs: 359996545 -> 360038731 (0.01%) - cycles in affected programs: 155897127 -> 155939313 (0.03%) Given that ~99% of shader-db remains unaffected, and the affected programs are hurt by about 1-2 instructions - which are all cheap ALU instructions - this is unlikely to be measurable in terms of any real performance impact that would affect users. So, drop them and simplify the backend, and hopefully enable other future simplifications in NIR. Reviewed-by: Eric Anholt [v1] Reviewed-by: Jason Ekstrand Reviewed-by: Ian Romanick Part-of: --- src/intel/compiler/brw_fs_nir.cpp | 79 +++++-------------------------------- src/intel/compiler/brw_nir.c | 1 - src/intel/compiler/brw_vec4.h | 4 +- src/intel/compiler/brw_vec4_nir.cpp | 66 +++++++------------------------ 4 files changed, 27 insertions(+), 123 deletions(-) diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 1a8306c9fda..ebb467ca0e0 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -406,9 +406,6 @@ fs_visitor::nir_emit_if(nir_if *if_stmt) */ nir_alu_instr *cond = nir_src_as_alu_instr(if_stmt->condition); if (cond != NULL && cond->op == nir_op_inot) { - assert(!cond->src[0].negate); - assert(!cond->src[0].abs); - invert = true; cond_reg = get_nir_src(cond->src[0].src); } else { @@ -544,15 +541,6 @@ fs_visitor::optimize_extract_to_float(nir_alu_instr *instr, src0->op != nir_op_extract_i8 && src0->op != nir_op_extract_i16) return false; - /* If either opcode has source modifiers, bail. - * - * TODO: We can potentially handle source modifiers if both of the opcodes - * we're combining are signed integers. - */ - if (instr->src[0].abs || instr->src[0].negate || - src0->src[0].abs || src0->src[0].negate) - return false; - unsigned element = nir_src_as_uint(src0->src[1].src); /* Element type to extract.*/ @@ -566,8 +554,7 @@ fs_visitor::optimize_extract_to_float(nir_alu_instr *instr, nir_src_bit_size(src0->src[0].src))); op0 = offset(op0, bld, src0->src[0].swizzle[0]); - set_saturate(instr->dest.saturate, - bld.MOV(result, subscript(op0, type, element))); + bld.MOV(result, subscript(op0, type, element)); return true; } @@ -739,13 +726,17 @@ fs_visitor::prepare_alu_destination_and_sources(const fs_builder &bld, (nir_alu_type)(nir_op_infos[instr->op].output_type | nir_dest_bit_size(instr->dest.dest))); + assert(!instr->dest.saturate); + for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) { + /* We don't lower to source modifiers so they should not exist. */ + assert(!instr->src[i].abs); + assert(!instr->src[i].negate); + op[i] = get_nir_src(instr->src[i].src); op[i].type = brw_type_for_nir_type(devinfo, (nir_alu_type)(nir_op_infos[instr->op].input_types[i] | nir_src_bit_size(instr->src[i].src))); - op[i].abs = instr->src[i].abs; - op[i].negate = instr->src[i].negate; } /* Move and vecN instrutions may still be vectored. Return the raw, @@ -793,8 +784,7 @@ fs_visitor::resolve_inot_sources(const fs_builder &bld, nir_alu_instr *instr, for (unsigned i = 0; i < 2; i++) { nir_alu_instr *inot_instr = nir_src_as_alu_instr(instr->src[i].src); - if (inot_instr != NULL && inot_instr->op == nir_op_inot && - !inot_instr->src[0].abs && !inot_instr->src[0].negate) { + if (inot_instr != NULL && inot_instr->op == nir_op_inot) { /* The source of the inot is now the source of instr. */ prepare_alu_destination_and_sources(bld, inot_instr, &op[i], false); @@ -863,8 +853,6 @@ fs_visitor::emit_fsign(const fs_builder &bld, const nir_alu_instr *instr, const nir_alu_instr *const fsign_instr = nir_src_as_alu_instr(instr->src[fsign_src].src); - assert(!fsign_instr->dest.saturate); - /* op[fsign_src] has the nominal result of the fsign, and op[1 - * fsign_src] has the other multiply source. This must be rearranged so * that op[0] is the source of the fsign op[1] is the other multiply @@ -880,8 +868,6 @@ fs_visitor::emit_fsign(const fs_builder &bld, const nir_alu_instr *instr, nir_src_bit_size(fsign_instr->src[0].src)); op[0].type = brw_type_for_nir_type(devinfo, t); - op[0].abs = fsign_instr->src[0].abs; - op[0].negate = fsign_instr->src[0].negate; unsigned channel = 0; if (nir_op_infos[instr->op].output_size == 0) { @@ -903,8 +889,6 @@ fs_visitor::emit_fsign(const fs_builder &bld, const nir_alu_instr *instr, bld.MOV(tmp, op[1]); op[1] = tmp; } - } else { - assert(!instr->dest.saturate); } if (op[0].abs) { @@ -1029,8 +1013,7 @@ can_fuse_fmul_fsign(nir_alu_instr *instr, unsigned fsign_src) * have already been taken (in nir_opt_algebraic) to ensure that. */ return fsign_instr != NULL && fsign_instr->op == nir_op_fsign && - is_used_once(fsign_instr) && - !instr->src[fsign_src].abs && !instr->src[fsign_src].negate; + is_used_once(fsign_instr); } void @@ -1072,7 +1055,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, inst = bld.MOV(offset(temp, bld, i), offset(op[i], bld, instr->src[i].swizzle[0])); } - inst->saturate = instr->dest.saturate; } /* In this case the source and destination registers were the same, @@ -1095,7 +1077,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, if (optimize_extract_to_float(instr, result)) return; inst = bld.MOV(result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_f2f16_rtne: @@ -1122,7 +1103,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, */ assert(type_sz(op[0].type) < 8); /* brw_nir_lower_conversions */ inst = bld.MOV(result, op[0]); - inst->saturate = instr->dest.saturate; break; } @@ -1170,7 +1150,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, assert(type_sz(result.type) < 8); /* brw_nir_lower_conversions */ inst = bld.MOV(result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fsat: @@ -1182,8 +1161,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_ineg: op[0].negate = true; inst = bld.MOV(result, op[0]); - if (instr->op == nir_op_fneg) - inst->saturate = instr->dest.saturate; break; case nir_op_fabs: @@ -1191,8 +1168,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, op[0].negate = false; op[0].abs = true; inst = bld.MOV(result, op[0]); - if (instr->op == nir_op_fabs) - inst->saturate = instr->dest.saturate; break; case nir_op_f2f32: @@ -1207,7 +1182,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, assert(type_sz(result.type) < 8); /* brw_nir_lower_conversions */ inst = bld.MOV(result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fsign: @@ -1216,27 +1190,22 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_frcp: inst = bld.emit(SHADER_OPCODE_RCP, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fexp2: inst = bld.emit(SHADER_OPCODE_EXP2, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_flog2: inst = bld.emit(SHADER_OPCODE_LOG2, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fsin: inst = bld.emit(SHADER_OPCODE_SIN, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fcos: inst = bld.emit(SHADER_OPCODE_COS, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fddx: @@ -1245,15 +1214,12 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, } else { inst = bld.emit(FS_OPCODE_DDX_COARSE, result, op[0]); } - inst->saturate = instr->dest.saturate; break; case nir_op_fddx_fine: inst = bld.emit(FS_OPCODE_DDX_FINE, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fddx_coarse: inst = bld.emit(FS_OPCODE_DDX_COARSE, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fddy: if (fs_key->high_quality_derivatives) { @@ -1261,15 +1227,12 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, } else { inst = bld.emit(FS_OPCODE_DDY_COARSE, result, op[0]); } - inst->saturate = instr->dest.saturate; break; case nir_op_fddy_fine: inst = bld.emit(FS_OPCODE_DDY_FINE, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fddy_coarse: inst = bld.emit(FS_OPCODE_DDY_COARSE, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fadd: @@ -1282,13 +1245,11 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, /* fallthrough */ case nir_op_iadd: inst = bld.ADD(result, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_iadd_sat: case nir_op_uadd_sat: inst = bld.ADD(result, op[0], op[1]); - inst->saturate = true; break; case nir_op_isub_sat: @@ -1344,7 +1305,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, } inst = bld.MUL(result, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_imul_2x32_64: @@ -1513,11 +1473,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, if (inot_src_instr != NULL && (inot_src_instr->op == nir_op_ior || inot_src_instr->op == nir_op_ixor || - inot_src_instr->op == nir_op_iand) && - !inot_src_instr->src[0].abs && - !inot_src_instr->src[0].negate && - !inot_src_instr->src[1].abs && - !inot_src_instr->src[1].negate) { + inot_src_instr->op == nir_op_iand)) { /* The sources of the source logical instruction are now the * sources of the instruction that will be generated. */ @@ -1611,12 +1567,10 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_fsqrt: inst = bld.emit(SHADER_OPCODE_SQRT, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_frsq: inst = bld.emit(SHADER_OPCODE_RSQ, result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_i2b32: @@ -1665,7 +1619,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, bld.ADD(result, result, brw_imm_f(1.0f))); inst = bld.MOV(result, result); /* for potential saturation */ } - inst->saturate = instr->dest.saturate; break; case nir_op_fceil: { @@ -1674,16 +1627,13 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, bld.RNDD(temp, op[0]); temp.negate = true; inst = bld.MOV(result, temp); - inst->saturate = instr->dest.saturate; break; } case nir_op_ffloor: inst = bld.RNDD(result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_ffract: inst = bld.FRC(result, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fround_even: inst = bld.RNDE(result, op[0]); @@ -1693,7 +1643,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, bld.ADD(result, result, brw_imm_f(1.0f))); inst = bld.MOV(result, result); /* for potential saturation */ } - inst->saturate = instr->dest.saturate; break; case nir_op_fquantize2f16: { @@ -1720,7 +1669,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, /* Select that or zero based on normal status */ inst = bld.SEL(result, zero, tmp32); inst->predicate = BRW_PREDICATE_NORMAL; - inst->saturate = instr->dest.saturate; break; } @@ -1728,14 +1676,12 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_umin: case nir_op_fmin: inst = bld.emit_minmax(result, op[0], op[1], BRW_CONDITIONAL_L); - inst->saturate = instr->dest.saturate; break; case nir_op_imax: case nir_op_umax: case nir_op_fmax: inst = bld.emit_minmax(result, op[0], op[1], BRW_CONDITIONAL_GE); - inst->saturate = instr->dest.saturate; break; case nir_op_pack_snorm_2x16: @@ -1756,7 +1702,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_unpack_half_2x16_split_x: inst = bld.emit(BRW_OPCODE_F16TO32, result, subscript(op[0], BRW_REGISTER_TYPE_UW, 0)); - inst->saturate = instr->dest.saturate; break; case nir_op_unpack_half_2x16_split_y_flush_to_zero: @@ -1765,7 +1710,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_unpack_half_2x16_split_y: inst = bld.emit(BRW_OPCODE_F16TO32, result, subscript(op[0], BRW_REGISTER_TYPE_UW, 1)); - inst->saturate = instr->dest.saturate; break; case nir_op_pack_64_2x32_split: @@ -1793,7 +1737,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, case nir_op_fpow: inst = bld.emit(SHADER_OPCODE_POW, result, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_bitfield_reverse: @@ -1914,7 +1857,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, } inst = bld.MAD(result, op[2], op[1], op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_flrp: @@ -1926,7 +1868,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr, } inst = bld.LRP(result, op[0], op[1], op[2]); - inst->saturate = instr->dest.saturate; break; case nir_op_b32csel: diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 02a6f0cba9f..e59b3ac4269 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -982,7 +982,6 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler, OPT(nir_opt_cse); } - OPT(nir_lower_to_source_mods, nir_lower_all_source_mods); OPT(nir_copy_prop); OPT(nir_opt_dce); OPT(nir_opt_move, nir_move_comparisons); diff --git a/src/intel/compiler/brw_vec4.h b/src/intel/compiler/brw_vec4.h index ab1b87de38b..1f2d922b186 100644 --- a/src/intel/compiler/brw_vec4.h +++ b/src/intel/compiler/brw_vec4.h @@ -312,8 +312,8 @@ public: bool optimize_predicate(nir_alu_instr *instr, enum brw_predicate *predicate); - void emit_conversion_from_double(dst_reg dst, src_reg src, bool saturate); - void emit_conversion_to_double(dst_reg dst, src_reg src, bool saturate); + void emit_conversion_from_double(dst_reg dst, src_reg src); + void emit_conversion_to_double(dst_reg dst, src_reg src); vec4_instruction *shuffle_64bit_data(dst_reg dst, src_reg src, bool for_write, diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp index 561d7169d4c..0e65dd2b607 100644 --- a/src/intel/compiler/brw_vec4_nir.cpp +++ b/src/intel/compiler/brw_vec4_nir.cpp @@ -805,8 +805,6 @@ vec4_visitor::optimize_predicate(nir_alu_instr *instr, unsigned base_swizzle = brw_swizzle_for_nir_swizzle(cmp_instr->src[i].swizzle); op[i].swizzle = brw_compose_swizzle(size_swizzle, base_swizzle); - op[i].abs = cmp_instr->src[i].abs; - op[i].negate = cmp_instr->src[i].negate; } emit(CMP(dst_null_d(), op[0], op[1], @@ -864,8 +862,7 @@ emit_find_msb_using_lzd(const vec4_builder &bld, } void -vec4_visitor::emit_conversion_from_double(dst_reg dst, src_reg src, - bool saturate) +vec4_visitor::emit_conversion_from_double(dst_reg dst, src_reg src) { /* BDW PRM vol 15 - workarounds: * DF->f format conversion for Align16 has wrong emask calculation when @@ -873,8 +870,7 @@ vec4_visitor::emit_conversion_from_double(dst_reg dst, src_reg src, */ if (devinfo->gen == 8 && dst.type == BRW_REGISTER_TYPE_F && src.file == BRW_IMMEDIATE_VALUE) { - vec4_instruction *inst = emit(MOV(dst, brw_imm_f(src.df))); - inst->saturate = saturate; + emit(MOV(dst, brw_imm_f(src.df))); return; } @@ -899,20 +895,17 @@ vec4_visitor::emit_conversion_from_double(dst_reg dst, src_reg src, emit(op, temp2, src_reg(temp)); emit(VEC4_OPCODE_PICK_LOW_32BIT, retype(temp2, dst.type), src_reg(temp2)); - vec4_instruction *inst = emit(MOV(dst, src_reg(retype(temp2, dst.type)))); - inst->saturate = saturate; + emit(MOV(dst, src_reg(retype(temp2, dst.type)))); } void -vec4_visitor::emit_conversion_to_double(dst_reg dst, src_reg src, - bool saturate) +vec4_visitor::emit_conversion_to_double(dst_reg dst, src_reg src) { dst_reg tmp_dst = dst_reg(src_reg(this, glsl_type::dvec4_type)); src_reg tmp_src = retype(src_reg(this, glsl_type::vec4_type), src.type); emit(MOV(dst_reg(tmp_src), src)); emit(VEC4_OPCODE_TO_DOUBLE, tmp_dst, tmp_src); - vec4_instruction *inst = emit(MOV(dst, src_reg(tmp_dst))); - inst->saturate = saturate; + emit(MOV(dst, src_reg(tmp_dst))); } /** @@ -1133,22 +1126,25 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) dst_reg dst = get_nir_dest(instr->dest.dest, dst_type); dst.writemask = instr->dest.write_mask; + assert(!instr->dest.saturate); + src_reg op[4]; for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) { + /* We don't lower to source modifiers, so they shouldn't exist. */ + assert(!instr->src[i].abs); + assert(!instr->src[i].negate); + nir_alu_type src_type = (nir_alu_type) (nir_op_infos[instr->op].input_types[i] | nir_src_bit_size(instr->src[i].src)); op[i] = get_nir_src(instr->src[i].src, src_type, 4); op[i].swizzle = brw_swizzle_for_nir_swizzle(instr->src[i].swizzle); - op[i].abs = instr->src[i].abs; - op[i].negate = instr->src[i].negate; } switch (instr->op) { case nir_op_mov: try_immediate_source(instr, &op[0], true, devinfo); inst = emit(MOV(dst, op[0])); - inst->saturate = instr->dest.saturate; break; case nir_op_vec2: @@ -1159,14 +1155,13 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_i2f32: case nir_op_u2f32: inst = emit(MOV(dst, op[0])); - inst->saturate = instr->dest.saturate; break; case nir_op_f2f32: case nir_op_f2i32: case nir_op_f2u32: if (nir_src_bit_size(instr->src[0].src) == 64) - emit_conversion_from_double(dst, op[0], instr->dest.saturate); + emit_conversion_from_double(dst, op[0]); else inst = emit(MOV(dst, op[0])); break; @@ -1174,7 +1169,7 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_f2f64: case nir_op_i2f64: case nir_op_u2f64: - emit_conversion_to_double(dst, op[0], instr->dest.saturate); + emit_conversion_to_double(dst, op[0]); break; case nir_op_fsat: @@ -1186,8 +1181,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_ineg: op[0].negate = true; inst = emit(MOV(dst, op[0])); - if (instr->op == nir_op_fneg) - inst->saturate = instr->dest.saturate; break; case nir_op_fabs: @@ -1195,8 +1188,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) op[0].negate = false; op[0].abs = true; inst = emit(MOV(dst, op[0])); - if (instr->op == nir_op_fabs) - inst->saturate = instr->dest.saturate; break; case nir_op_iadd: @@ -1205,7 +1196,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_fadd: try_immediate_source(instr, op, true, devinfo); inst = emit(ADD(dst, op[0], op[1])); - inst->saturate = instr->dest.saturate; break; case nir_op_uadd_sat: @@ -1217,7 +1207,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_fmul: try_immediate_source(instr, op, true, devinfo); inst = emit(MUL(dst, op[0], op[1])); - inst->saturate = instr->dest.saturate; break; case nir_op_imul: { @@ -1272,27 +1261,22 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_frcp: inst = emit_math(SHADER_OPCODE_RCP, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fexp2: inst = emit_math(SHADER_OPCODE_EXP2, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_flog2: inst = emit_math(SHADER_OPCODE_LOG2, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fsin: inst = emit_math(SHADER_OPCODE_SIN, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fcos: inst = emit_math(SHADER_OPCODE_COS, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_idiv: @@ -1347,17 +1331,14 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_fsqrt: inst = emit_math(SHADER_OPCODE_SQRT, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_frsq: inst = emit_math(SHADER_OPCODE_RSQ, dst, op[0]); - inst->saturate = instr->dest.saturate; break; case nir_op_fpow: inst = emit_math(SHADER_OPCODE_POW, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_uadd_carry: { @@ -1386,7 +1367,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) inst->predicate = BRW_PREDICATE_NORMAL; inst = emit(MOV(dst, src_reg(dst))); /* for potential saturation */ } - inst->saturate = instr->dest.saturate; break; case nir_op_fceil: { @@ -1400,18 +1380,15 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) emit(RNDD(dst_reg(tmp), op[0])); tmp.negate = true; inst = emit(MOV(dst, tmp)); - inst->saturate = instr->dest.saturate; break; } case nir_op_ffloor: inst = emit(RNDD(dst, op[0])); - inst->saturate = instr->dest.saturate; break; case nir_op_ffract: inst = emit(FRC(dst, op[0])); - inst->saturate = instr->dest.saturate; break; case nir_op_fround_even: @@ -1422,7 +1399,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) inst->predicate = BRW_PREDICATE_NORMAL; inst = emit(MOV(dst, src_reg(dst))); /* for potential saturation */ } - inst->saturate = instr->dest.saturate; break; case nir_op_fquantize2f16: { @@ -1446,7 +1422,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) /* Select that or zero based on normal status */ inst = emit(BRW_OPCODE_SEL, dst, zero, tmp32); inst->predicate = BRW_PREDICATE_NORMAL; - inst->saturate = instr->dest.saturate; break; } @@ -1457,7 +1432,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_fmin: try_immediate_source(instr, op, true, devinfo); inst = emit_minmax(BRW_CONDITIONAL_L, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_imax: @@ -1467,7 +1441,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_fmax: try_immediate_source(instr, op, true, devinfo); inst = emit_minmax(BRW_CONDITIONAL_GE, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_fddx: @@ -1598,7 +1571,7 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_b2f64: if (nir_dest_bit_size(instr->dest.dest) > 32) { assert(dst.type == BRW_REGISTER_TYPE_DF); - emit_conversion_to_double(dst, negate(op[0]), false); + emit_conversion_to_double(dst, negate(op[0])); } else { emit(MOV(dst, negate(op[0]))); } @@ -1815,7 +1788,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) unreachable("not reached: should have been lowered"); case nir_op_fsign: - assert(!instr->dest.saturate); if (op[0].abs) { /* Straightforward since the source can be assumed to be either * strictly >= 0 or strictly <= 0 depending on the setting of the @@ -1874,8 +1846,7 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) /* Now convert the result from float to double */ emit_conversion_to_double(dst, retype(src_reg(tmp), - BRW_REGISTER_TYPE_F), - false); + BRW_REGISTER_TYPE_F)); } break; @@ -1902,18 +1873,15 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) dst_reg mul_dst = dst_reg(this, glsl_type::dvec4_type); emit(MUL(mul_dst, op[1], op[0])); inst = emit(ADD(dst, src_reg(mul_dst), op[2])); - inst->saturate = instr->dest.saturate; } else { fix_float_operands(op, instr); inst = emit(MAD(dst, op[2], op[1], op[0])); - inst->saturate = instr->dest.saturate; } break; case nir_op_flrp: fix_float_operands(op, instr); inst = emit(LRP(dst, op[2], op[1], op[0])); - inst->saturate = instr->dest.saturate; break; case nir_op_b32csel: @@ -1945,25 +1913,21 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_fdot_replicated2: try_immediate_source(instr, op, true, devinfo); inst = emit(BRW_OPCODE_DP2, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_fdot_replicated3: try_immediate_source(instr, op, true, devinfo); inst = emit(BRW_OPCODE_DP3, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_fdot_replicated4: try_immediate_source(instr, op, true, devinfo); inst = emit(BRW_OPCODE_DP4, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_fdph_replicated: try_immediate_source(instr, op, false, devinfo); inst = emit(BRW_OPCODE_DPH, dst, op[0], op[1]); - inst->saturate = instr->dest.saturate; break; case nir_op_fdiv: -- cgit v1.2.3