nir: rename fsin_r600/fcos_r600 to fsin_amd/fcos_amd

GCN has better range, but constant folding is the same.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10587>
This commit is contained in:
Rhys Perry 2022-07-01 14:13:25 +01:00 committed by Marge Bot
parent 835364ea0c
commit 69d21a3dee
3 changed files with 9 additions and 9 deletions

View File

@ -1261,11 +1261,11 @@ unop_horiz("cube_r600", 4, tfloat32, 3, tfloat32, """
}
""")
# r600 specific sin and cos
# r600/gcn specific sin and cos
# these trigeometric functions need some lowering because the supported
# input values are expected to be normalized by dividing by (2 * pi)
unop("fsin_r600", tfloat32, "sinf(6.2831853 * src0)")
unop("fcos_r600", tfloat32, "cosf(6.2831853 * src0)")
unop("fsin_amd", tfloat32, "sinf(6.2831853 * src0)")
unop("fcos_amd", tfloat32, "cosf(6.2831853 * src0)")
# AGX specific sin with input expressed in quadrants. Used in the lowering for
# fsin/fcos. This corresponds to a sequence of 3 ALU ops in the backend (where

View File

@ -1175,13 +1175,13 @@ bool AluInstr::from_nir(nir_alu_instr *alu, Shader& shader)
if (shader.chip_class() == ISA_CC_CAYMAN) {
switch (alu->op) {
case nir_op_fcos_r600: return emit_alu_trans_op1_cayman(*alu, op1_cos, shader);
case nir_op_fcos_amd: return emit_alu_trans_op1_cayman(*alu, op1_cos, shader);
case nir_op_fexp2: return emit_alu_trans_op1_cayman(*alu, op1_exp_ieee, shader);
case nir_op_flog2: return emit_alu_trans_op1_cayman(*alu, op1_log_clamped, shader);
case nir_op_frcp: return emit_alu_trans_op1_cayman(*alu, op1_recip_ieee, shader);
case nir_op_frsq: return emit_alu_trans_op1_cayman(*alu, op1_recipsqrt_ieee1, shader);
case nir_op_fsqrt: return emit_alu_trans_op1_cayman(*alu, op1_sqrt_ieee, shader);
case nir_op_fsin_r600: return emit_alu_trans_op1_cayman(*alu, op1_sin, shader);
case nir_op_fsin_amd: return emit_alu_trans_op1_cayman(*alu, op1_sin, shader);
case nir_op_i2f32: return emit_alu_op1(*alu, op1_int_to_flt, shader);
case nir_op_u2f32: return emit_alu_op1(*alu, op1_uint_to_flt, shader);
case nir_op_imul: return emit_alu_trans_op2_cayman(*alu, op2_mullo_int, shader);
@ -1194,12 +1194,12 @@ bool AluInstr::from_nir(nir_alu_instr *alu, Shader& shader)
}
} else {
switch (alu->op) {
case nir_op_fcos_r600: return emit_alu_trans_op1_eg(*alu, op1_cos, shader);
case nir_op_fcos_amd: return emit_alu_trans_op1_eg(*alu, op1_cos, shader);
case nir_op_fexp2: return emit_alu_trans_op1_eg(*alu, op1_exp_ieee, shader);
case nir_op_flog2: return emit_alu_trans_op1_eg(*alu, op1_log_clamped, shader);
case nir_op_frcp: return emit_alu_trans_op1_eg(*alu, op1_recip_ieee, shader);
case nir_op_frsq: return emit_alu_trans_op1_eg(*alu, op1_recipsqrt_ieee1, shader);
case nir_op_fsin_r600: return emit_alu_trans_op1_eg(*alu, op1_sin, shader);
case nir_op_fsin_amd: return emit_alu_trans_op1_eg(*alu, op1_sin, shader);
case nir_op_fsqrt: return emit_alu_trans_op1_eg(*alu, op1_sqrt_ieee, shader);
case nir_op_i2f32: return emit_alu_trans_op1_eg(*alu, op1_int_to_flt, shader);
case nir_op_u2f32: return emit_alu_trans_op1_eg(*alu, op1_uint_to_flt, shader);

View File

@ -83,9 +83,9 @@ nir_ssa_def *LowerSinCos::lower(nir_instr *instr)
nir_imm_float(b, -0.5));
if (alu->op == nir_op_fsin)
return nir_fsin_r600(b, normalized);
return nir_fsin_amd(b, normalized);
else
return nir_fcos_r600(b, normalized);
return nir_fcos_amd(b, normalized);
}