gitee.com/quant1x/num@v0.3.2/asm/asm2plan9/README.md (about) 1 asm2plan9s 2 ========== 3 4 Tool to generate BYTE sequences for Go assembly as generated by YASM/GAS (for Intel) or GAS (for ARM). 5 6 Installation 7 ------------ 8 9 Make sure either YASM or GAS is installed on your platform. Note that YASM takes precedence over GAS if both are 10 installed. 11 12 ##### GAS (Intel/AMD64 or ARM): 13 14 Typically `as` or `gas` (GNU Assembler) will already be installed as it is part of binutils, but if need be, you can eg. 15 do as follows: 16 17 ``` 18 sudo apt-get install build-essential 19 ``` 20 21 ##### YASM (Intel/AMD64): 22 23 ``` 24 $ yasm --version 25 yasm 1.2.0 26 Compiled on Sep 30 2013. 27 Copyright (c) 2001-2011 Peter Johnson and other Yasm developers. 28 Run yasm --license for licensing overview and summary. 29 ``` 30 31 ### asm2plan9s 32 33 `go get -u github.com/minio/asm2plan9s` 34 35 ### AVX512 support 36 37 Note that AVX512 support is currently only available for GAS. 38 39 Example 40 ------- 41 42 ``` 43 $ more example.s 44 // VPADDQ XMM0,XMM1,XMM8 45 $ asm2plan9s example.s 46 $ echo example.s 47 LONG $0xd471c1c4; BYTE $0xc0 // VPADDQ XMM0,XMM1,XMM8 48 ``` 49 50 The instruction to be assembled needs to start with a `//` preceded by either a single space or a tab character. 51 The preceding characters will be overwitten by the correct sequence (irrespective of its contents) so when changing the 52 instruction, rerunning `asm2plan9s` will update the BYTE sequence generated. 53 54 Starting position of instruction 55 -------------------------------- 56 57 The starting position of the `//` comment needs to follow the (imaginary) sequence with either a single space or a space 58 followed by a back slash plus another space (see support for defines below). 59 Upon first entering an instruction you can also type eg `LONG $0x00000000; BYTE $0x00 // VZEROUPPER` to trigger the 60 assembler. 61 62 Support for defines 63 ------------------- 64 65 If you are using #define for 'macros' with the back-slash delimiter to continue on the next line, this will be 66 preserved. 67 68 For instance: 69 70 ``` 71 \ // VPADDQ XMM0,XMM1,XMM8 72 ``` 73 74 will be assembled into 75 76 ``` 77 LONG $0xd471c1c4; BYTE $0xc0 \ // VPADDQ XMM0,XMM1,XMM8 78 ``` 79 80 asmfmt 81 ------ 82 83 asm2plan9s works nicely together with [asmfmt](https://github.com/klauspost/asmfmt) in order to format the assembly 84 code (in a similar style to `go fmt`). 85 86 Extensive example 87 ----------------- 88 89 For a more extensive example see (for 90 Intel) [compressAvx_amd64.s](https://github.com/minio/blake2b-simd/blob/master/compressAvx_amd64.s) or (for 91 ARM) [highwayhash_arm64.s](https://github.com/minio/highwayhash/blob/master/highwayhash_arm64.s). 92 93 License 94 ------- 95 96 Released under the Apache License v2.0. You can find the complete text in the file LICENSE. 97 98 Contributing 99 ------------ 100 101 Contributions are welcome, please send PRs for any enhancements.