fixed bit field field the encoding fixes should be
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 1 | 1 | 1 | dest | addr | src1 | src2 | src3 | desc | |||||||||||||||||||||||
bits 31:0: 111x xxxx xxxx xxxx xxxx xxxx xxxx xxxx
Its format is @mad: format 5: MAD, src2 takes the address register. 5i: MADI, src3 takes it.
Runs execute_MAD with Form() 0.
Its operation is 2 opcodes' (Form() tells them apart), so it may read the fields of their layouts too.
| Field | Bits | The Sail reads it in |
|---|---|---|
| dest | 28:24 | execute_MAD |
| addr | 23:22 | execute_MAD |
| src1 | 21:17 | execute_MAD |
| src2 | 16:10 | execute_MAD (16:12), execute_MAD |
| c | 11:5 | execute_MAD (not a field of the file) |
| src3 | 9:5 | execute_MAD |
| desc | 4:0 | execute_MAD |
MAD and MADI (format 5: the destination at 24, the address register at 22, src1 the 5-bit register at 17, src2 at 10 and src3 at 5, the operand descriptor the 5 bits at 0; MAD's src2 is 7 bits and the address register offsets it, MADI's src3): a * b + c
let inverted = Form() == 1; let p = Pattern(UInt(Field(0, 5))); let a = Source(UInt(Field(17, 5)), 0, p, 1); let b = if inverted then Source(UInt(Field(12, 5)), 0, p, 2) else Source(UInt(Field(10, 7)), UInt(Field(22, 2)), p, 2); let c = if inverted then Source(UInt(Field(5, 7)), UInt(Field(22, 2)), p, 3) else Source(UInt(Field(5, 5)), 0, p, 3); let product = V4FMul(a, b); let d = DestVar(UInt(Field(24, 5))); SetDest(p, d, V4FAdd(product, c))
Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from nihstro's shader_bytecode.h (BSD-3-Clause), as Azahar reads them.