Skip to content

Commit b74da96

Browse files
committed
Auto merge of rust-lang#136831 - ehuss:update-stdarch, r=Amanieu
Update stdarch Updates stdarch - core_arch: Add LoongArch basic intrinsics: rust-lang/stdarch#1688 - New ARM intrinsic generator: rust-lang/stdarch#1693 - Fix the bug in CMPINT intrinsics with IMM3=7: rust-lang/stdarch#1694 - Expand feature detection on AArch64 Darwin: rust-lang/stdarch#1695 - Tidying x86 `as_*` functions: rust-lang/stdarch#1696 - Fix typo and prettify comment: rust-lang/stdarch#1697 - add is_s390x_feature_detected: rust-lang/stdarch#1699 - add vec_add for s390x: rust-lang/stdarch#1703 - s390x: add vec_sub, vec_mul, vec_min, vec_max, vec_abs and vec_splats: rust-lang/stdarch#1704 - Fix build and CLI behaviour for stdarch-gen-arm. rust-lang/stdarch#1705 - Fix some test naming, and refactor stdarch-verify in general: rust-lang/stdarch#1707 - Update all stdarch crates to Rust 2024: rust-lang/stdarch#1710 - Add keylocker (kl and widekl) intrinsics and runtime feature detection: rust-lang/stdarch#1706 - S390x vector bitwise operations: rust-lang/stdarch#1709 - Update CI to FreeBSD 13.4: rust-lang/stdarch#1715 - Update wasm sub sat intrinsics for LLVM 20: rust-lang/stdarch#1719 - powerpc: use more target-independent llvm intrinsics (min, max, round, countlz): rust-lang/stdarch#1713 - S390x float rounding: rust-lang/stdarch#1712 - mark riscv intrinsics as safe: rust-lang/stdarch#1717 - change redundant transmutations of sign to cast_unsigned: rust-lang/stdarch#1711 - Fix - AArch64 Big Endian Intrinsics: rust-lang/stdarch#1708 - mark x86 intrinsics as safe: rust-lang/stdarch#1714 - AArch64: Add NEON fp16 intrinsics: rust-lang/stdarch#1726 - wasm: use simd_as for float to integer conversions: rust-lang/stdarch#1724 - nvptx: use simd_fmin and simd_fmax for minnum and maxnum: rust-lang/stdarch#1725 - powerpc: use simd_ceil and simd_floor: rust-lang/stdarch#1723 - Changed altivec.rs to new intrinsic declaration: rust-lang/stdarch#1722 - Remove some allow(unsafe_op_in_unsafe_fn)s and use target_feature 1.1 in examples: rust-lang/stdarch#1727 - fix - neon type signed unsigned conversions: rust-lang/stdarch#1729 - s390x_is_feature_detected!: detect more features: rust-lang/stdarch#1720 - Fix doctests failing due to unused_unsafe: rust-lang/stdarch#1731 - fix compilation on armebv7r-none-eabi: rust-lang/stdarch#1733 - wasm: update for rintf intrinsic rename: rust-lang/stdarch#1721 - powerpc: use the simd_fma intrinsic for vec_madd: rust-lang/stdarch#1734 - powerpc: use llvm.fshl for vec_rl: rust-lang/stdarch#1735 - s390x: add more intrinsics: rust-lang/stdarch#1728 - make _mm256_zero{upper,all} safe: rust-lang/stdarch#1736 - fix unnecessary unsafe error in doctest: rust-lang/stdarch#1739 - Feat - Aarch64 FEAT_FAMINMAX: rust-lang/stdarch#1732 - feat - FEAT_LUT neon instrinsics: rust-lang/stdarch#1741
2 parents e6af292 + a78d1b0 commit b74da96

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

compiler/rustc_span/src/analyze_source_file.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ cfg_match! {
8383

8484
// For character in the chunk, see if its byte value is < 0, which
8585
// indicates that it's part of a UTF-8 char.
86-
let multibyte_test = unsafe { _mm_cmplt_epi8(chunk, _mm_set1_epi8(0)) };
86+
let multibyte_test = _mm_cmplt_epi8(chunk, _mm_set1_epi8(0));
8787
// Create a bit mask from the comparison results.
88-
let multibyte_mask = unsafe { _mm_movemask_epi8(multibyte_test) };
88+
let multibyte_mask = _mm_movemask_epi8(multibyte_test);
8989

9090
// If the bit mask is all zero, we only have ASCII chars here:
9191
if multibyte_mask == 0 {
9292
assert!(intra_chunk_offset == 0);
9393

9494
// Check for newlines in the chunk
95-
let newlines_test = unsafe { _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8)) };
96-
let mut newlines_mask = unsafe { _mm_movemask_epi8(newlines_test) };
95+
let newlines_test = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8));
96+
let mut newlines_mask = _mm_movemask_epi8(newlines_test);
9797

9898
let output_offset = RelativeBytePos::from_usize(chunk_index * CHUNK_SIZE + 1);
9999

library/core/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ check-cfg = [
3232
'cfg(bootstrap)',
3333
'cfg(no_fp_fmt_parse)',
3434
'cfg(stdarch_intel_sde)',
35+
# #[cfg(bootstrap)]
36+
'cfg(target_feature, values("vector-enhancements-1"))',
3537
# core use #[path] imports to portable-simd `core_simd` crate
3638
# and to stdarch `core_arch` crate which messes-up with Cargo list
3739
# of declared features, we therefor expect any feature cfg

library/core/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,17 @@
202202
//
203203
// Target features:
204204
// tidy-alphabetical-start
205+
#![feature(aarch64_unstable_target_feature)]
205206
#![feature(arm_target_feature)]
206207
#![feature(avx512_target_feature)]
207208
#![feature(hexagon_target_feature)]
209+
#![feature(keylocker_x86)]
208210
#![feature(loongarch_target_feature)]
209211
#![feature(mips_target_feature)]
210212
#![feature(powerpc_target_feature)]
211213
#![feature(riscv_target_feature)]
212214
#![feature(rtm_target_feature)]
215+
#![feature(s390x_target_feature)]
213216
#![feature(sha512_sm_x86)]
214217
#![feature(sse4a_target_feature)]
215218
#![feature(tbm_target_feature)]

library/stdarch

Submodule stdarch updated 190 files

src/tools/rust-analyzer/lib/line-index/src/lib.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ fn analyze_source_file_dispatch(
257257
/// SSE2 intrinsics to quickly find all newlines.
258258
#[target_feature(enable = "sse2")]
259259
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
260+
// This can be removed once 1.87 is stable due to some intrinsics switching to safe.
261+
#[allow(unsafe_op_in_unsafe_fn)]
260262
unsafe fn analyze_source_file_sse2(
261263
src: &str,
262264
lines: &mut Vec<TextSize>,
@@ -287,17 +289,17 @@ unsafe fn analyze_source_file_sse2(
287289

288290
// For character in the chunk, see if its byte value is < 0, which
289291
// indicates that it's part of a UTF-8 char.
290-
let multibyte_test = unsafe { _mm_cmplt_epi8(chunk, _mm_set1_epi8(0)) };
292+
let multibyte_test = _mm_cmplt_epi8(chunk, _mm_set1_epi8(0));
291293
// Create a bit mask from the comparison results.
292-
let multibyte_mask = unsafe { _mm_movemask_epi8(multibyte_test) };
294+
let multibyte_mask = _mm_movemask_epi8(multibyte_test);
293295

294296
// If the bit mask is all zero, we only have ASCII chars here:
295297
if multibyte_mask == 0 {
296298
assert!(intra_chunk_offset == 0);
297299

298300
// Check for newlines in the chunk
299-
let newlines_test = unsafe { _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8)) };
300-
let newlines_mask = unsafe { _mm_movemask_epi8(newlines_test) };
301+
let newlines_test = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8));
302+
let newlines_mask = _mm_movemask_epi8(newlines_test);
301303

302304
if newlines_mask != 0 {
303305
// All control characters are newlines, record them
@@ -354,15 +356,19 @@ unsafe fn analyze_source_file_sse2(
354356
// The mask is a 64-bit integer, where each 4-bit corresponds to a u8 in the
355357
// input vector. The least significant 4 bits correspond to the first byte in
356358
// the vector.
359+
// This can be removed once 1.87 is stable due to some intrinsics switching to safe.
360+
#[allow(unsafe_op_in_unsafe_fn)]
357361
unsafe fn move_mask(v: std::arch::aarch64::uint8x16_t) -> u64 {
358362
use std::arch::aarch64::*;
359363

360-
let nibble_mask = unsafe { vshrn_n_u16(vreinterpretq_u16_u8(v), 4) };
361-
unsafe { vget_lane_u64(vreinterpret_u64_u8(nibble_mask), 0) }
364+
let nibble_mask = vshrn_n_u16(vreinterpretq_u16_u8(v), 4);
365+
vget_lane_u64(vreinterpret_u64_u8(nibble_mask), 0)
362366
}
363367

364368
#[target_feature(enable = "neon")]
365369
#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
370+
// This can be removed once 1.87 is stable due to some intrinsics switching to safe.
371+
#[allow(unsafe_op_in_unsafe_fn)]
366372
unsafe fn analyze_source_file_neon(
367373
src: &str,
368374
lines: &mut Vec<TextSize>,
@@ -376,7 +382,7 @@ unsafe fn analyze_source_file_neon(
376382

377383
let chunk_count = src.len() / CHUNK_SIZE;
378384

379-
let newline = unsafe { vdupq_n_s8(b'\n' as i8) };
385+
let newline = vdupq_n_s8(b'\n' as i8);
380386

381387
// This variable keeps track of where we should start decoding a
382388
// chunk. If a multi-byte character spans across chunk boundaries,
@@ -390,7 +396,7 @@ unsafe fn analyze_source_file_neon(
390396

391397
// For character in the chunk, see if its byte value is < 0, which
392398
// indicates that it's part of a UTF-8 char.
393-
let multibyte_test = unsafe { vcltzq_s8(chunk) };
399+
let multibyte_test = vcltzq_s8(chunk);
394400
// Create a bit mask from the comparison results.
395401
let multibyte_mask = unsafe { move_mask(multibyte_test) };
396402

@@ -399,7 +405,7 @@ unsafe fn analyze_source_file_neon(
399405
assert!(intra_chunk_offset == 0);
400406

401407
// Check for newlines in the chunk
402-
let newlines_test = unsafe { vceqq_s8(chunk, newline) };
408+
let newlines_test = vceqq_s8(chunk, newline);
403409
let mut newlines_mask = unsafe { move_mask(newlines_test) };
404410

405411
// If the bit mask is not all zero, there are newlines in this chunk.

0 commit comments

Comments
 (0)