2018-12-30 18:40:45 -08:00
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
. "github.com/mmcloughlin/avo/build"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
2019-01-06 20:04:51 -08:00
|
|
|
TEXT("Split", NOSPLIT, "func(x uint64) (q uint64, l uint32, w uint16, b uint8)")
|
2018-12-30 18:40:45 -08:00
|
|
|
Doc(
|
|
|
|
|
"Split returns the low 64, 32, 16 and 8 bits of x.",
|
|
|
|
|
"Tests the As() methods of virtual general-purpose registers.",
|
|
|
|
|
)
|
2019-01-04 18:23:44 -08:00
|
|
|
x := GP64()
|
2018-12-30 18:40:45 -08:00
|
|
|
Load(Param("x"), x)
|
|
|
|
|
Store(x, Return("q"))
|
|
|
|
|
Store(x.As32(), Return("l"))
|
|
|
|
|
Store(x.As16(), Return("w"))
|
|
|
|
|
Store(x.As8(), Return("b"))
|
|
|
|
|
RET()
|
|
|
|
|
|
|
|
|
|
Generate()
|
|
|
|
|
}
|