gitee.com/quant1x/gox@v1.7.6/num/asm/README.md (about) 1 # Converting C++ to Assembly 2 3 All SIMD functions are generated from C++. Most of it is portable, auto-vectorized code. To add a new function: 4 5 1. Compile the C++ source code to AT&T assembly with Clang, 6 flags `-Ofast -mfma -mavx2 -funroll-loops -fomit-frame-pointer -std=c++17` 7 2. Convert the output to [avo](https://github.com/mmcloughlin/avo) instructions 8 with `python asm/asm2avo.py --suffix AVX2 input.s --out output.go` 9 3. Fix potential issues with the output. Data sections need to be added manually and moves changed to unaligned access 10 4. Add the avo section to `asm/gen.go` and generate Go assembly and stubs with `go generate asm/gen.go` 11 12 The C++ code was mostly compiled and analyzed with [godbolt](https://godbolt.org/). Other assembly output may need 13 additional cleanup. To compile code that uses vcl run 14 godbolt [locally](https://github.com/compiler-explorer/compiler-explorer) and add `-I/path/to/vcl` to the compiler 15 flags.