spirv: Clean up OpSignBitSet

For some reason, we were doing a signed shift vectors and an unsigned
shift for scalars.  We then plug it into i2b so it should make no
difference whatsoever.  The fact that we're doing different things for
vectors vs. scalars is bonkers.  Let's simplify the code a bit.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5278>
This commit is contained in:
Jason Ekstrand
2020-05-28 17:14:30 -05:00
parent 62c53ad20b
commit 8dfee57bdc

View File

@@ -646,18 +646,10 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
break;
}
case SpvOpSignBitSet: {
unsigned src_bit_size = glsl_get_bit_size(vtn_src[0]->type);
if (src[0]->num_components == 1)
val->ssa->def =
nir_ushr(&b->nb, src[0], nir_imm_int(&b->nb, src_bit_size - 1));
else
val->ssa->def =
nir_ishr(&b->nb, src[0], nir_imm_int(&b->nb, src_bit_size - 1));
val->ssa->def = nir_i2b(&b->nb, val->ssa->def);
case SpvOpSignBitSet:
val->ssa->def = nir_i2b(&b->nb,
nir_ushr(&b->nb, src[0], nir_imm_int(&b->nb, src[0]->bit_size - 1)));
break;
}
case SpvOpUCountTrailingZerosINTEL:
val->ssa->def = nir_umin(&b->nb,