pan/bi: Implement vectorized f32_to_f16
f2f16 needs special treatment since it can access multiple 32-bit words. Corresponds to the two-op instruction V2F32_TO_V2F16. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
This commit is contained in:
committed by
Marge Bot
parent
1fb681e51d
commit
d43c0f35ff
@@ -1522,9 +1522,9 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
|
||||
{
|
||||
bi_index dst = bi_dest_index(&instr->dest.dest);
|
||||
unsigned sz = nir_dest_bit_size(instr->dest.dest);
|
||||
|
||||
unsigned srcs = nir_op_infos[instr->op].num_inputs;
|
||||
unsigned comps = nir_dest_num_components(instr->dest.dest);
|
||||
unsigned src_sz = srcs > 0 ? nir_src_bit_size(instr->src[0].src) : 0;
|
||||
|
||||
if (!instr->dest.dest.is_ssa) {
|
||||
for (unsigned i = 0; i < comps; ++i)
|
||||
@@ -1598,6 +1598,16 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
|
||||
return;
|
||||
}
|
||||
|
||||
case nir_op_f2f16:
|
||||
assert(src_sz == 32);
|
||||
bi_index idx = bi_src_index(&instr->src[0].src);
|
||||
bi_index s0 = bi_word(idx, instr->src[0].swizzle[0]);
|
||||
bi_index s1 = comps > 1 ?
|
||||
bi_word(idx, instr->src[0].swizzle[1]) : s0;
|
||||
|
||||
bi_v2f32_to_v2f16_to(b, dst, s0, s1, BI_ROUND_NONE);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1606,8 +1616,6 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
|
||||
bi_index s1 = srcs > 1 ? bi_alu_src_index(instr->src[1], comps) : bi_null();
|
||||
bi_index s2 = srcs > 2 ? bi_alu_src_index(instr->src[2], comps) : bi_null();
|
||||
|
||||
unsigned src_sz = srcs > 0 ? nir_src_bit_size(instr->src[0].src) : 0;
|
||||
|
||||
switch (instr->op) {
|
||||
case nir_op_ffma:
|
||||
bi_fma_to(b, sz, dst, s0, s1, s2, BI_ROUND_NONE);
|
||||
@@ -1783,10 +1791,6 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_op_f2f16:
|
||||
bi_v2f32_to_v2f16_to(b, dst, s0, s0, BI_ROUND_NONE);
|
||||
break;
|
||||
|
||||
case nir_op_f2f32:
|
||||
bi_f16_to_f32_to(b, dst, s0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user