mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 12:59:58 -04:00
Put the signed flag of I2F's source format in bit 13 of the Maxwell encoding, where the decoder reads it.
The Ampere I2F lowering wrote (size | 4) << 10, so the signed flag landed in bit 12, which the Maxwell decoder does not read (ISrcFmt = (op >> 11) & 4 | (op >> 10) & 3). I2F.F32.S16 and the other signed sources converted as unsigned: in Jabu-Jabu's Belly the walls' deformation grid of signed 16-bit offsets turned -5 into 65531 and the room shell into huge stretched triangles (issue 57). The size code stays in bits 10-11, the flag goes to 13, as I2FP already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2265,7 +2265,7 @@ static class AmpereLowering
|
||||
}
|
||||
|
||||
// I2F: source signed (bit 74) and size (84-85: 8/16/32 bits, its byte or half in 60-61), destination size
|
||||
// (75-76: F16, F32, F64), rounding 78-79. Maxwell I2F: ISrcFmt (size code, +4 signed), ByteSel, DstFmt.
|
||||
// (75-76: F16, F32, F64), rounding 78-79. Maxwell I2F: ISrcFmt (size code in 10-11, signed in bit 13), ByteSel, DstFmt.
|
||||
void I2f(uint op)
|
||||
{
|
||||
const uint known = 1u << 10 | 3u << 11 | 3u << 14 | 3u << 20;
|
||||
@@ -2274,7 +2274,7 @@ static class AmpereLowering
|
||||
if ((w2 & ~known) != 0 || src == 3 || dst == 0 || (op != 0xb06 && (_i.W1 & 0xcfffff00u) != 0)) throw Fail("I2F format");
|
||||
int b = op == 0xb06 ? Plain(1, SB) : op == 0xd06 ? Ur(_i.Bits(32, 8)) : Gpr(_i.Bits(32, 8));
|
||||
uint bytesel = src == 0 ? sel : src == 1 ? sel * 2 : 0;
|
||||
EmitG(0x5cb8000000000000UL | ((ulong)dst << 8) | ((ulong)(src | (_i.Bit(74) ? 4u : 0u)) << 10) | ((ulong)b << 20)
|
||||
EmitG(0x5cb8000000000000UL | ((ulong)dst << 8) | ((ulong)src << 10) | (_i.Bit(74) ? 1UL << 13 : 0) | ((ulong)b << 20)
|
||||
| ((ulong)bytesel << 41) | ((ulong)_i.Bits(78, 2) << 39) | (uint)Gpr((uint)Dst));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user