mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
cccf996225
Add autocast support for `x86amx` Builds on rust-lang/rust#140763 by further adding autocasts for `x86amx` from/to vectors of size 8192 bits. This also disables SIMD vector abi checks for the `"unadjusted"` abi because - This is primarily used to link with LLVM intrinsics, which don't actually lower to function calls with vector arguments. Even with other cg backends, this is true. - This ABI is internal and perma-unstable (and also super specific), so it is very unlikely that this will cause breakages. - (The primary reason) Without doing this we can't actually use 8192 bit long vectors to represent `x86amx` > Why do we need a bypass for `x86amx`? Can't we use a `#[lang_item]` or something? If `x86amx` was a normal LLVM type, this approach would've worked and I would also prefer it. But LLVM specifies that > No instruction is allowed for this type. There are no arguments, arrays, pointers, vectors or constants of this type. So we can't treat it like a normal type at all -- even if we add it like a lang-item, we would still have to special-case everywhere to check if we are passing to the correct LLVM intrinsic, and only then use the `x86amx` type. IMO this is needlessly complex, and way worse than this solution, which just adds it to the autocast list in cg_llvm r? codegen
The files here use the LLVM FileCheck framework, documented at https://llvm.org/docs/CommandGuide/FileCheck.html.
One extension worth noting is the use of revisions as custom prefixes for FileCheck. If your codegen test has different behavior based on the chosen target or different compiler flags that you want to exercise, you can use a revisions annotation, like so:
// revisions: aaa bbb
// [bbb] compile-flags: --flags-for-bbb
After specifying those variations, you can write different expected, or
explicitly unexpected output by using <prefix>-SAME: and <prefix>-NOT:,
like so:
// CHECK: expected code
// aaa-SAME: emitted-only-for-aaa
// aaa-NOT: emitted-only-for-bbb
// bbb-NOT: emitted-only-for-aaa
// bbb-SAME: emitted-only-for-bbb