mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
nir: use more nir_ffma_imm variants
nir_ffma_imm has several variants that allows specific arguments to be immediates. Use them for simplicity. Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23179>
This commit is contained in:
parent
c4d2ebd285
commit
4cfb8005f0
2 changed files with 7 additions and 7 deletions
|
|
@ -146,8 +146,8 @@ lower_rcp(nir_builder *b, nir_ssa_def *src)
|
|||
* See https://en.wikipedia.org/wiki/Division_algorithm for more details.
|
||||
*/
|
||||
|
||||
ra = nir_ffma(b, nir_fneg(b, ra), nir_ffma(b, ra, src, nir_imm_double(b, -1)), ra);
|
||||
ra = nir_ffma(b, nir_fneg(b, ra), nir_ffma(b, ra, src, nir_imm_double(b, -1)), ra);
|
||||
ra = nir_ffma(b, nir_fneg(b, ra), nir_ffma_imm2(b, ra, src, -1), ra);
|
||||
ra = nir_ffma(b, nir_fneg(b, ra), nir_ffma_imm2(b, ra, src, -1), ra);
|
||||
|
||||
return fix_inv_result(b, ra, src, new_exp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,15 +111,15 @@ LowerSinCos::lower(nir_instr *instr)
|
|||
assert(alu->op == nir_op_fsin || alu->op == nir_op_fcos);
|
||||
|
||||
auto fract = nir_ffract(b,
|
||||
nir_ffma(b,
|
||||
nir_ssa_for_alu_src(b, alu, 0),
|
||||
nir_imm_float(b, 0.15915494),
|
||||
nir_imm_float(b, 0.5)));
|
||||
nir_ffma_imm12(b,
|
||||
nir_ssa_for_alu_src(b, alu, 0),
|
||||
0.15915494,
|
||||
0.5));
|
||||
|
||||
auto normalized =
|
||||
m_gxf_level != R600
|
||||
? nir_fadd_imm(b, fract, -0.5)
|
||||
: nir_ffma(b, fract, nir_imm_float(b, 2.0f * M_PI), nir_imm_float(b, -M_PI));
|
||||
: nir_ffma_imm12(b, fract, 2.0f * M_PI, -M_PI);
|
||||
|
||||
if (alu->op == nir_op_fsin)
|
||||
return nir_fsin_amd(b, normalized);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue