Open valarauca opened 4 years ago
The code won't compile regardless the type, because xabort takes constant immediate only.
The current code is reflecting C/C++'s use of unsigned int (https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/intrinsics/intrinsics-for-intel-advanced-vector-extensions-2/intrinsics-for-intel-transactional-synchronization-extensions-intel-tsx/intrinsics-for-restricted-transactional-memory-operations/xabort.html)
because xabort takes constant immediate only.
I am aware, the type error is returned before the constant error.
Irregardless of constant or not, it may only encode 8 bits of data.
I tried this code:
godbolt link, you need to pass platform features.
I expected to see this happen:
Either a clean compile, or a type error that
u8
was expected instead ofi8
.Instead, this happened:
The current code states that
_xabort
takes au32
as an argument. This appears to be incorrect.As the
xabort
instruction can only encode an 8bit argument.The
xbegin
instruction will only encode the abort flag within bits24:31
ofeax
. Meaning that you can't recieve an error code larger than 8bits.Meta
rustc --version --verbose
: