Closed
Description
#![feature(stdsimd)]
#![feature(target_feature)]
use std::arch::x86_64::*;
#[inline(always)]
#[target_feature(enable = "sse4.2")]
unsafe fn alpha(needle: &[u8], haystack: &[u8]) -> i32 {
let a = _mm_loadu_si128(needle.as_ptr() as *const _);
let b = _mm_loadu_si128(haystack.as_ptr() as *const _);
_mm_cmpestri(a, 3, b, 15, _SIDD_CMP_EQUAL_ORDERED)
}
fn main() {
let haystack = b"Split \r\n\t line ";
let needle = b"\r\n\t ignore this ";
let idx = unsafe { alpha(needle, haystack) };
assert_eq!(idx, 6);
}
LLVM ERROR: Cannot select: 0x7fa0f8e25ea0: i32,i32 = X86ISD::PCMPESTRI 0x7fa0f8e25410, Constant:i32<3>, 0x7fa0f8e259c0, Constant:i32<15>, Constant:i8<12>
0x7fa0f8e25410: v16i8 = bitcast 0x7fa0f8e257b8
0x7fa0f8e257b8: v2i64,ch = load<LD16[ConstantPool]> 0x7fa0f8e7b040, 0x7fa0f8e25208, undef:i64
0x7fa0f8e25208: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<<16 x i8> <i8 13, i8 10, i8 9, i8 32, i8 105, i8 103, i8 110, i8 111, i8 114, i8 101, i8 32, i8 116, i8 104, i8 105, i8 115, i8 32>> 0
0x7fa0f98fa3a8: i64 = TargetConstantPool<<16 x i8> <i8 13, i8 10, i8 9, i8 32, i8 105, i8 103, i8 110, i8 111, i8 114, i8 101, i8 32, i8 116, i8 104, i8 105, i8 115, i8 32>> 0
0x7fa0f8e25d00: i64 = undef
0x7fa0f8e25138: i32 = Constant<3>
0x7fa0f8e259c0: v16i8 = bitcast 0x7fa0f8e25618
0x7fa0f8e25618: v2i64,ch = load<LD16[ConstantPool]> 0x7fa0f8e7b040, 0x7fa0f8e25c30, undef:i64
0x7fa0f8e25c30: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<<16 x i8> <i8 83, i8 112, i8 108, i8 105, i8 116, i8 32, i8 13, i8 10, i8 9, i8 32, i8 108, i8 105, i8 110, i8 101, i8 32, i8 32>> 0
0x7fa0f98fa138: i64 = TargetConstantPool<<16 x i8> <i8 83, i8 112, i8 108, i8 105, i8 116, i8 32, i8 13, i8 10, i8 9, i8 32, i8 108, i8 105, i8 110, i8 101, i8 32, i8 32>> 0
0x7fa0f8e25d00: i64 = undef
0x7fa0f8e25d68: i32 = Constant<15>
0x7fa0f8e25750: i8 = Constant<12>
In function: _ZN10playground4main17ha4aeba89c162948dE
1.26.0-nightly (2018-03-25 482a913fb337855072a53c0d602cd19947f45285)
Metadata
Metadata
Assignees
Labels
No labels