about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorJörn Horstmann <git@jhorstmann.net>2024-03-02 10:59:11 +0100
committerJörn Horstmann <git@jhorstmann.net>2024-03-12 08:52:54 +0100
commite91f93777997ee647768afa60d565a0a62aefa49 (patch)
tree595c287796f4a44717c0c63922e4f584ff662aed /compiler/rustc_codegen_llvm/src
parentb0696a5160711c068cb1f01b7437db7990d15750 (diff)
downloadrust-e91f93777997ee647768afa60d565a0a62aefa49.tar.gz
rust-e91f93777997ee647768afa60d565a0a62aefa49.zip
Add tests for the generated assembly of mask related simd instructions.
The tests show that the code generation currently uses the least
significant bits of <iX x N> vector masks when converting to <i1 xN>.
This leads to an additional left shift operation in the assembly for
x86, since mask operations on x86 operate based on the most significant
bit. On aarch64 the left shift is followed by a comparison against zero,
which repeats the sign bit across the whole lane.

The exception, which does not introduce an unneeded shift, is
simd_bitmask, because the code generation already shifts before
truncating.

By using the "C" calling convention the tests should be stable regarding
changes in register allocation, but it is possible that future llvm
updates will require updating some of the checks.

This additional instruction would be removed by the fix in #104693,
which uses the most significant bit for all mask operations.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions