mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
nir/spirv: Implement extended add, sub, and mul
This commit is contained in:
parent
3a3c4aecf1
commit
b8f0bea07a
1 changed files with 28 additions and 0 deletions
|
|
@ -2715,6 +2715,30 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
|
|||
}
|
||||
break;
|
||||
|
||||
case SpvOpIAddCarry:
|
||||
assert(glsl_type_is_struct(val->ssa->type));
|
||||
val->ssa->elems[0]->def = nir_iadd(&b->nb, src[0], src[1]);
|
||||
val->ssa->elems[1]->def = nir_uadd_carry(&b->nb, src[0], src[1]);
|
||||
return;
|
||||
|
||||
case SpvOpISubBorrow:
|
||||
assert(glsl_type_is_struct(val->ssa->type));
|
||||
val->ssa->elems[0]->def = nir_isub(&b->nb, src[0], src[1]);
|
||||
val->ssa->elems[1]->def = nir_usub_borrow(&b->nb, src[0], src[1]);
|
||||
return;
|
||||
|
||||
case SpvOpUMulExtended:
|
||||
assert(glsl_type_is_struct(val->ssa->type));
|
||||
val->ssa->elems[0]->def = nir_imul(&b->nb, src[0], src[1]);
|
||||
val->ssa->elems[1]->def = nir_umul_high(&b->nb, src[0], src[1]);
|
||||
return;
|
||||
|
||||
case SpvOpSMulExtended:
|
||||
assert(glsl_type_is_struct(val->ssa->type));
|
||||
val->ssa->elems[0]->def = nir_imul(&b->nb, src[0], src[1]);
|
||||
val->ssa->elems[1]->def = nir_imul_high(&b->nb, src[0], src[1]);
|
||||
return;
|
||||
|
||||
case SpvOpShiftRightLogical: op = nir_op_ushr; break;
|
||||
case SpvOpShiftRightArithmetic: op = nir_op_ishr; break;
|
||||
case SpvOpShiftLeftLogical: op = nir_op_ishl; break;
|
||||
|
|
@ -3635,6 +3659,10 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
case SpvOpFMod:
|
||||
case SpvOpVectorTimesScalar:
|
||||
case SpvOpDot:
|
||||
case SpvOpIAddCarry:
|
||||
case SpvOpISubBorrow:
|
||||
case SpvOpUMulExtended:
|
||||
case SpvOpSMulExtended:
|
||||
case SpvOpShiftRightLogical:
|
||||
case SpvOpShiftRightArithmetic:
|
||||
case SpvOpShiftLeftLogical:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue