fixing a bug with ITF selecting based of input instead of output type

Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
Jakub Doka 2024-12-16 10:35:11 +01:00
parent ef36e21475
commit bfac81c807
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -414,10 +414,8 @@ impl Nodes {
&& op.cond_op(self[o].ty).is_none()) && op.cond_op(self[o].ty).is_none())
}), }),
Kind::BinOp { op: TokenKind::Mul } if node.ty.is_float() => { Kind::BinOp { op: TokenKind::Mul } if node.ty.is_float() => {
false node.outputs.iter().all(|&n| {
&& node.outputs.iter().all(|&n| { self[n].kind == Kind::BinOp { op: TokenKind::Add } && self[n].inputs[1] == nid
self[n].kind == Kind::BinOp { op: TokenKind::Add }
&& self[n].inputs[1] == nid
}) })
} }
Kind::BinOp { op: TokenKind::Add | TokenKind::Sub } => { Kind::BinOp { op: TokenKind::Add | TokenKind::Sub } => {
@ -624,7 +622,7 @@ impl TokenKind {
(dst.simple_size(), src.simple_size()), (dst.simple_size(), src.simple_size()),
(Some(4 | 8), Some(8)) (Some(4 | 8), Some(8))
); );
[instrs::itf32, instrs::itf64][src_idx - 2] [instrs::itf32, instrs::itf64][dst.simple_size().unwrap().ilog2() as usize - 2]
} }
Self::Number if src.is_float() && dst.is_integer() => { Self::Number if src.is_float() && dst.is_integer() => {
[|a, b| instrs::fti32(a, b, 1), |a, b| instrs::fti64(a, b, 1)][src_idx - 2] [|a, b| instrs::fti32(a, b, 1), |a, b| instrs::fti64(a, b, 1)][src_idx - 2]