nak: Implement nir_op_i(eq|ne) for booleans

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand 2023-04-10 17:23:27 -05:00 committed by Marge Bot
parent 3fd47a68a1
commit ed42571e83

View file

@ -273,13 +273,23 @@ impl<'a> ShaderFromNir<'a> {
}
}
nir_op_ieq => {
self.instrs.push(Instr::new_isetp(
dst,
IntCmpType::I32,
IntCmpOp::Eq,
srcs[0],
srcs[1],
));
if alu.get_src(0).bit_size() == 1 {
self.instrs.push(Instr::new_plop3(
dst,
LogicOp::new_lut(&|x, y, _| !(x ^ y)),
srcs[0],
srcs[1],
Src::new_imm_bool(true),
));
} else {
self.instrs.push(Instr::new_isetp(
dst,
IntCmpType::I32,
IntCmpOp::Eq,
srcs[0],
srcs[1],
));
}
}
nir_op_ige => {
self.instrs.push(Instr::new_isetp(
@ -300,13 +310,23 @@ impl<'a> ShaderFromNir<'a> {
));
}
nir_op_ine => {
self.instrs.push(Instr::new_isetp(
dst,
IntCmpType::I32,
IntCmpOp::Ne,
srcs[0],
srcs[1],
));
if alu.get_src(0).bit_size() == 1 {
self.instrs.push(Instr::new_plop3(
dst,
LogicOp::new_lut(&|x, y, _| !(x ^ y)),
srcs[0],
srcs[1],
Src::new_imm_bool(true),
));
} else {
self.instrs.push(Instr::new_isetp(
dst,
IntCmpType::I32,
IntCmpOp::Ne,
srcs[0],
srcs[1],
));
}
}
nir_op_ineg => {
self.instrs.push(Instr::new(Op::IMov(OpIMov {