Skip to content

[DO NOT MERGE] test safe x86 intrinsics #137033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines 21 to 24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, you may need to additionally specify your branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data in .gitmodules doesn't matter, what you need to do is cd library/stdarch and check out your branch in that directory.

[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
Loading