| 1 | //go:build ignore |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import . "github.com/mmcloughlin/avo/build" |
| 6 | |
| 7 | func main() { |
| 8 | TEXT("Split", NOSPLIT, "func(x uint64) (q uint64, l uint32, w uint16, b uint8)") |
| 9 | Doc( |
| 10 | "Split returns the low 64, 32, 16 and 8 bits of x.", |
| 11 | "Tests the As() methods of virtual general-purpose registers.", |
| 12 | ) |
| 13 | x := GP64() |
| 14 | Load(Param("x"), x) |
| 15 | Store(x, Return("q")) |
| 16 | Store(x.As32(), Return("l")) |
| 17 | Store(x.As16(), Return("w")) |
| 18 | Store(x.As8(), Return("b")) |
| 19 | RET() |
| 20 | |
| 21 | Generate() |
| 22 | } |