Skip to content

Commit 7ad353c

Browse files
committed
[WIP]
1 parent cebdfe4 commit 7ad353c

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
CARGO_BUILD_INCREMENTAL: false
1717
# Rust's CI denies warnings. Deny them here too to ensure subtree syncs don't
1818
# fail because of warnings.
19-
RUSTFLAGS: "-Dwarnings"
19+
#RUSTFLAGS: "-Dwarnings"
2020

2121
jobs:
2222
rustfmt:

example/std_example.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ unsafe fn test_simd() {
259259
test_mm_insert_epi16();
260260
test_mm_shuffle_epi8();
261261

262+
test_mm_cmpestri();
263+
262264
test_mm256_shuffle_epi8();
263265
test_mm256_permute2x128_si256();
264266
test_mm256_permutevar8x32_epi32();
@@ -430,6 +432,29 @@ unsafe fn test_mm_shuffle_epi8() {
430432
assert_eq_m128i(r, expected);
431433
}
432434

435+
// Currently one cannot `load` a &[u8] that is less than 16
436+
// in length. This makes loading strings less than 16 in length
437+
// a bit difficult. Rather than `load` and mutate the __m128i,
438+
// it is easier to memcpy the given string to a local slice with
439+
// length 16 and `load` the local slice.
440+
#[cfg(target_arch = "x86_64")]
441+
#[target_feature(enable = "sse4.2")]
442+
unsafe fn str_to_m128i(s: &[u8]) -> __m128i {
443+
assert!(s.len() <= 16);
444+
let slice = &mut [0u8; 16];
445+
std::ptr::copy_nonoverlapping(s.as_ptr(), slice.as_mut_ptr(), s.len());
446+
_mm_loadu_si128(slice.as_ptr() as *const _)
447+
}
448+
449+
#[cfg(target_arch = "x86_64")]
450+
#[target_feature(enable = "sse4.2")]
451+
unsafe fn test_mm_cmpestri() {
452+
let a = str_to_m128i(b"bar - garbage");
453+
let b = str_to_m128i(b"foobar");
454+
let i = _mm_cmpestri::<_SIDD_CMP_EQUAL_ORDERED>(a, 3, b, 6);
455+
assert_eq!(3, i);
456+
}
457+
433458
#[cfg(target_arch = "x86_64")]
434459
#[target_feature(enable = "avx2")]
435460
unsafe fn test_mm256_shuffle_epi8() {

src/intrinsics/llvm_x86.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
757757
let b = b.load_scalar(fx);
758758
let lb = lb.load_scalar(fx);
759759

760+
panic!();
761+
760762
let imm8 =
761763
if let Some(imm8) = crate::constant::mir_operand_get_const_val(fx, &args[4].node) {
762764
imm8

0 commit comments

Comments
 (0)