nak: Implement nir_op_b2b1 and nir_op_b2b32

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand 2023-05-05 23:22:49 -05:00 committed by Marge Bot
parent 3bf0882ea8
commit fa0891d37c

View file

@ -177,6 +177,23 @@ impl<'a> ShaderFromNir<'a> {
let dst = self.get_dst(&alu.def);
match alu.op {
nir_op_b2b1 => {
assert!(alu.get_src(0).bit_size() > 1);
self.instrs.push(Instr::new_isetp(
dst,
IntCmpType::I32,
IntCmpOp::Ne,
srcs[0],
Src::new_zero(),
));
}
nir_op_b2b32 | nir_op_b2i32 => {
self.instrs.push(Instr::new(Op::Sel(OpSel {
dst: dst,
cond: srcs[0].bnot(),
srcs: [Src::new_zero(), Src::new_imm_u32(1)],
})));
}
nir_op_b2f32 => {
self.instrs.push(Instr::new(Op::Sel(OpSel {
dst: dst,
@ -184,13 +201,6 @@ impl<'a> ShaderFromNir<'a> {
srcs: [Src::new_zero(), Src::new_imm_u32(0x3f800000)],
})));
}
nir_op_b2i32 => {
self.instrs.push(Instr::new(Op::Sel(OpSel {
dst: dst,
cond: srcs[0].bnot(),
srcs: [Src::new_zero(), Src::new_imm_u32(1)],
})));
}
nir_op_bcsel => {
self.instrs
.push(Instr::new_sel(dst, srcs[0], srcs[1], srcs[2]));