nir/lower_bit_size: lower uadd_carry

8/16-bit uadd_carry can exist in SPIR-V.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7615
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19473>
(cherry picked from commit da30fb5df7)
This commit is contained in:
Rhys Perry 2022-11-02 16:45:08 +00:00 committed by Dylan Baker
parent cbd39e87c8
commit 32c51fbfa0
2 changed files with 3 additions and 1 deletions

View file

@ -1228,7 +1228,7 @@
"description": "nir/lower_bit_size: lower uadd_carry",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -79,6 +79,8 @@ lower_alu_instr(nir_builder *bld, nir_alu_instr *alu, unsigned bit_size)
lowered_dst = nir_ushr_imm(bld, lowered_dst, dst_bit_size);
else
lowered_dst = nir_ishr_imm(bld, lowered_dst, dst_bit_size);
} else if (op == nir_op_uadd_carry) {
lowered_dst = nir_ushr_imm(bld, nir_iadd(bld, srcs[0], srcs[1]), dst_bit_size);
} else {
lowered_dst = nir_build_alu_src_arr(bld, op, srcs);