1
Fork 0
rust/compiler/rustc_codegen_llvm/src
Jörn Horstmann 3779b8e32e Consistently use the most significant bit of vector masks
This improves the codegen for vector `select`, `gather`, `scatter` and
boolean reduction intrinsics and fixes rust-lang/portable-simd#316.

The current behavior of most mask operations during llvm codegen is to
truncate the mask vector to <N x i1>, telling llvm to use the least
significat bit. The exception is the `simd_bitmask` intrinsics, which
already used the most signifiant bit.

Since sse/avx instructions are defined to use the most significant bit,
truncating means that llvm has to insert a left shift to move the bit
into the most significant position, before the mask can actually be
used.

Similarly on aarch64, mask operations like blend work bit by bit,
repeating the least significant bit across the whole lane involves
shifting it into the sign position and then comparing against zero.

By shifting before truncating to <N x i1>, we tell llvm that we only
consider the most significant bit, removing the need for additional
shift instructions in the assembly.
2025-01-26 16:44:23 +01:00
..
back rustc_codegen_llvm: remove outdated asm-to-obj codegen note 2025-01-22 17:58:50 -05:00
builder Make CodegenCx and Builder generic 2025-01-24 16:05:26 -05:00
coverageinfo coverage: Make query coverage_ids_info return an Option 2025-01-24 16:13:11 +11:00
debuginfo Auto merge of #135643 - khuey:135332, r=jieyouxu 2025-01-20 14:16:22 +00:00
llvm Rollup merge of #135156 - Zalathar:debuginfo-flags, r=cuviper 2025-01-22 19:29:39 +01:00
abi.rs Add gpu-kernel calling convention 2025-01-16 00:26:55 +01:00
allocator.rs Clean up FFI calls for operand bundles 2024-10-30 13:26:24 +11:00
asm.rs Auto merge of #129181 - beetrees:asm-spans, r=pnkfelix,compiler-errors 2024-12-12 02:34:06 +00:00
attributes.rs Rename OptimizeAttr::None to Default 2025-01-24 19:34:01 +00:00
base.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
builder.rs Make CodegenCx and Builder generic 2025-01-24 16:05:26 -05:00
callee.rs rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structures 2024-12-16 19:08:19 +01:00
common.rs Treat undef bytes as equal to any other byte 2025-01-21 08:27:21 +00:00
consts.rs Rollup merge of #127483 - BertalanD:no_sanitize-global-var, r=rcvalle 2024-11-23 20:19:51 +08:00
context.rs Rollup merge of #135581 - EnzymeAD:refactor-codgencx, r=oli-obk 2025-01-24 23:25:42 +01:00
declare.rs Rollup merge of #135581 - EnzymeAD:refactor-codgencx, r=oli-obk 2025-01-24 23:25:42 +01:00
errors.rs Auto merge of #134794 - RalfJung:abi-required-target-features, r=workingjubilee 2025-01-05 23:21:06 +00:00
intrinsic.rs Consistently use the most significant bit of vector masks 2025-01-26 16:44:23 +01:00
lib.rs Make CodegenCx and Builder generic 2025-01-24 16:05:26 -05:00
llvm_util.rs Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubilee 2025-01-06 22:04:13 -05:00
mono_item.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
type_.rs Make CodegenCx and Builder generic 2025-01-24 16:05:26 -05:00
type_of.rs make no-variant types a dedicated Variants variant 2024-12-18 11:01:54 +01:00
va_arg.rs Teach rust core about Xtensa VaListImpl and add a custom lowering of vaarg for xtensa. 2024-12-03 10:54:08 +00:00
value.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00