Skip to content

Commit 0d77317

Browse files
committed
Add support for simd_insert_dyn and simd_extract_dyn
1 parent bb1e6a3 commit 0d77317

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: src/intrinsic/simd.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
399399
}
400400

401401
#[cfg(feature = "master")]
402-
if name == sym::simd_insert {
402+
if name == sym::simd_insert || name == sym::simd_insert_dyn {
403403
require!(
404404
in_elem == arg_tys[2],
405405
InvalidMonomorphization::InsertedType {
@@ -410,6 +410,8 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
410410
out_ty: arg_tys[2]
411411
}
412412
);
413+
414+
// TODO(antoyo): For simd_insert, check if the index is a constant of the correct size.
413415
let vector = args[0].immediate();
414416
let index = args[1].immediate();
415417
let value = args[2].immediate();
@@ -422,13 +424,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
422424
}
423425

424426
#[cfg(feature = "master")]
425-
if name == sym::simd_extract {
427+
if name == sym::simd_extract || name == sym::simd_extract_dyn {
426428
require!(
427429
ret_ty == in_elem,
428430
InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
429431
);
432+
// TODO(antoyo): For simd_extract, check if the index is a constant of the correct size.
430433
let vector = args[0].immediate();
431-
return Ok(bx.context.new_vector_access(None, vector, args[1].immediate()).to_rvalue());
434+
let index = args[1].immediate();
435+
return Ok(bx.context.new_vector_access(None, vector, index).to_rvalue());
432436
}
433437

434438
if name == sym::simd_select {

0 commit comments

Comments
 (0)