Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CAFxX/atomics
All the missing AMD64 atomic instructions
https://github.com/CAFxX/atomics
amd64 atomics golang instructions
Last synced: 3 months ago
JSON representation
All the missing AMD64 atomic instructions
- Host: GitHub
- URL: https://github.com/CAFxX/atomics
- Owner: CAFxX
- License: mit
- Created: 2019-05-30T23:05:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-06T15:48:53.000Z (over 5 years ago)
- Last Synced: 2024-08-01T19:46:19.376Z (7 months ago)
- Topics: amd64, atomics, golang, instructions
- Language: Assembly
- Size: 13.7 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-perf - CAFxX/atomics - All the missing AMD64 atomic instructions. (Assembly)
README
# atomics
All the AMD64 atomic instructions, exposed as Go functions: [![GoDoc](https://godoc.org/github.com/CAFxX/atomics?status.svg)](https://godoc.org/github.com/CAFxX/atomics)⚠️ **PRE-ALPHA** ⚠️
## Features
- `LOCK {ADD,ADC,AND,BTC,BTR,BTS,CMPXCHG,CMPXCH8B,CMPXCHG16B,DEC,INC,NEG,NOT,OR,SBB,SUB,XOR,XADD}` and `XCHG`, for all possible operand sizes
- `XBEGIN`, `XABORT`, `XEND` and `XTEST` (Intel TSX RTM transactional memory instructions)## Notes
- This is currently an AMD64-only package; none of the functions are available if not building for `amd64`.
- Some of the functions are hard to use reliably due to the nature of the Go compiler (e.g. those that depend on the contents of the FLAGS register, like `AddWithCarry` or `SubtractWithBorrow`); they are included for completeness and because they can be used, if proper care is used.
- Before using the TSX RTM functions, you must ensure that the processors supports them by using e.g. [github.com/intel-go/cpuid](https://github.com/intel-go/cpuid):
```
if cpuid.HasExtendedFeature(cpuid.RTM) {
// OK to use XBEGIN/XTEST/XABORT/XEND
}
```## Development
The atomics instructions are defined in `gen.go`. `gen.go` will produce the files `atomic_amd64.{go,s}` by running:
```
go generate gen.go
```