| ... | ... | @@ -1642,6 +1642,29 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1642 | 1642 | if (!inst.is_volatile and inst.base.isUnused()) |
| 1643 | 1643 | return MCValue.dead; |
| 1644 | 1644 | switch (arch) { |
| 1645 | .spu_2 => { |
| 1646 | if (inst.inputs.len > 0 or inst.output != null) { |
| 1647 | return self.fail(inst.base.src, "TODO implement inline asm inputs / outputs for SPU Mark II", .{}); |
| 1648 | } |
| 1649 | if (mem.eql(u8, inst.asm_source, "undefined0")) { |
| 1650 | // Instructions are 16-bits, plus up to two sixteen bit immediates. |
| 1651 | // Upper three bits of first byte are the execution |
| 1652 | // condition; for now, only always (0b000) is supported. |
| 1653 | // Next, there are two two-bit sequences indicating inputs; |
| 1654 | // we only care to use zero (0b00). |
| 1655 | // The lowest bit of byte one indicates whether flags |
| 1656 | // should be updated; TODO: support that somehow. |
| 1657 | // In all, we use a zero byte for the first half of the |
| 1658 | // instruction. |
| 1659 | // The second byte is 0bOOCCCCCR; OO is output behavior (we |
| 1660 | // use zero, which discards the output), CCCCC is the |
| 1661 | // command (8 for undefined0), R is reserved. |
| 1662 | try self.code.appendSlice(&[_]u8{ 0x00, 0b00010000 }); |
| 1663 | return MCValue.none; |
| 1664 | } else { |
| 1665 | return self.fail(inst.base.src, "TODO implement support for more SPU II assembly instructions", .{}); |
| 1666 | } |
| 1667 | }, |
| 1645 | 1668 | .riscv64 => { |
| 1646 | 1669 | for (inst.inputs) |input, i| { |
| 1647 | 1670 | if (input.len < 3 or input[0] != '{' or input[input.len - 1] != '}') { |