Skip to content

Commit

Permalink
Auto merge of rust-lang#137033 - usamoi:test-safe-x86-intrinsics, r=<…
Browse files Browse the repository at this point in the history
…try>

[DO NOT MERGE] test safe x86 intrinsics

This draft pull request is only used for a crater run, to check for any breakage caused by rust-lang/stdarch#1714 in the ecosystem.

cc `@Amanieu`
  • Loading branch information
bors committed Feb 14, 2025
2 parents d8810e3 + 6ba649a commit ef5216c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
shallow = true
[submodule "library/stdarch"]
path = library/stdarch
url = https://github.com/rust-lang/stdarch.git
url = https://github.com/usamoi/stdarch.git
shallow = true
[submodule "src/doc/edition-guide"]
path = src/doc/edition-guide
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_span/src/analyze_source_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ cfg_match! {

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

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

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

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

Expand Down Expand Up @@ -212,17 +212,17 @@ cfg_match! {

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

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

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

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

Expand Down
3 changes: 3 additions & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,15 @@
#![feature(powerpc_target_feature)]
#![feature(riscv_target_feature)]
#![feature(rtm_target_feature)]
#![feature(s390x_target_feature)]
#![feature(sha512_sm_x86)]
#![feature(sse4a_target_feature)]
#![feature(tbm_target_feature)]
#![feature(wasm_target_feature)]
#![feature(x86_amx_intrinsics)]
// tidy-alphabetical-end
#![allow(stable_features)]
#![feature(target_feature_11)]

// allow using `core::` in intra-doc links
#[allow(unused_extern_crates)]
Expand Down
2 changes: 1 addition & 1 deletion library/stdarch
Submodule stdarch updated 167 files
8 changes: 4 additions & 4 deletions src/tools/rust-analyzer/lib/line-index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,17 @@ unsafe fn analyze_source_file_sse2(

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

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

// Check for newlines in the chunk
let newlines_test = unsafe { _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8)) };
let newlines_mask = unsafe { _mm_movemask_epi8(newlines_test) };
let newlines_test = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8));
let newlines_mask = _mm_movemask_epi8(newlines_test);

if newlines_mask != 0 {
// All control characters are newlines, record them
Expand Down

0 comments on commit ef5216c

Please sign in to comment.