Skip to content

Commit 21af303

Browse files
committed
[WIP]
1 parent 7ad353c commit 21af303

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

example/std_example.rs

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

262+
#[cfg(not(jit))]
262263
test_mm_cmpestri();
263264

264265
test_mm256_shuffle_epi8();
@@ -437,6 +438,7 @@ unsafe fn test_mm_shuffle_epi8() {
437438
// a bit difficult. Rather than `load` and mutate the __m128i,
438439
// it is easier to memcpy the given string to a local slice with
439440
// length 16 and `load` the local slice.
441+
#[cfg(not(jit))]
440442
#[cfg(target_arch = "x86_64")]
441443
#[target_feature(enable = "sse4.2")]
442444
unsafe fn str_to_m128i(s: &[u8]) -> __m128i {
@@ -446,6 +448,7 @@ unsafe fn str_to_m128i(s: &[u8]) -> __m128i {
446448
_mm_loadu_si128(slice.as_ptr() as *const _)
447449
}
448450

451+
#[cfg(not(jit))]
449452
#[cfg(target_arch = "x86_64")]
450453
#[target_feature(enable = "sse4.2")]
451454
unsafe fn test_mm_cmpestri() {

src/intrinsics/llvm_x86.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,6 @@ 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-
762760
let imm8 =
763761
if let Some(imm8) = crate::constant::mir_operand_get_const_val(fx, &args[4].node) {
764762
imm8

src/intrinsics/simd.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
268268
let val = codegen_operand(fx, &val.node);
269269

270270
// FIXME validate
271-
let idx_const = if let Some(idx_const) =
272-
crate::constant::mir_operand_get_const_val(fx, &idx.node)
273-
{
274-
idx_const
271+
let idx_const = if let Some(idx_const) = idx.node.constant() {
272+
crate::constant::eval_mir_constant(fx, idx_const).0.try_to_scalar_int().unwrap()
275273
} else {
276274
fx.tcx.dcx().span_fatal(span, "Index argument for `simd_insert` is not a constant");
277275
};
@@ -304,22 +302,12 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
304302
return;
305303
}
306304

307-
let idx_const = if let Some(idx_const) =
308-
crate::constant::mir_operand_get_const_val(fx, &idx.node)
309-
{
310-
idx_const
305+
let idx_const = if let Some(idx_const) = idx.node.constant() {
306+
crate::constant::eval_mir_constant(fx, idx_const).0.try_to_scalar_int().unwrap()
311307
} else {
312-
fx.tcx.dcx().span_warn(span, "Index argument for `simd_extract` is not a constant");
313-
let trap_block = fx.bcx.create_block();
314-
let true_ = fx.bcx.ins().iconst(types::I8, 1);
315-
let ret_block = fx.get_block(target);
316-
fx.bcx.ins().brif(true_, trap_block, &[], ret_block, &[]);
317-
fx.bcx.switch_to_block(trap_block);
318-
crate::trap::trap_unimplemented(
319-
fx,
320-
"Index argument for `simd_extract` is not a constant",
321-
);
322-
return;
308+
fx.tcx
309+
.dcx()
310+
.span_fatal(span, "Index argument for `simd_extract` is not a constant");
323311
};
324312

325313
let idx = idx_const.to_u32();

0 commit comments

Comments
 (0)