Skip to content

Commit 3a3e5f5

Browse files
committed
Sync from rust 873d4682c7d285540b8f28bfe637006cef8918a6
2 parents 41b7226 + 156bce9 commit 3a3e5f5

4 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/abi/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ pub(crate) fn conv_to_call_conv(
5555
match c {
5656
CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::C => default_call_conv,
5757

58+
// Cranelift doesn't currently have anything for this.
59+
CanonAbi::RustPreserveNone => default_call_conv,
60+
5861
// Functions with this calling convention can only be called from assembly, but it is
5962
// possible to declare an `extern "custom"` block, so the backend still needs a calling
6063
// convention for declaring foreign functions.

src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl DebugContext {
242242
let generics = tcx.generics_of(enclosing_fn_def_id);
243243
let args = instance.args.truncate_to(tcx, generics);
244244

245-
type_names::push_generic_params(
245+
type_names::push_generic_args(
246246
tcx,
247247
tcx.normalize_erasing_regions(ty::TypingEnv::fully_monomorphized(), args),
248248
&mut name,

src/intrinsics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
15061506
}
15071507

15081508
// FIXME implement variadics in cranelift
1509-
sym::va_copy | sym::va_arg | sym::va_end => {
1509+
sym::va_arg | sym::va_end => {
15101510
fx.tcx.dcx().span_fatal(
15111511
source_info.span,
15121512
"Defining variadic functions is not yet supported by Cranelift",

src/intrinsics/simd.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,31 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
348348
ret.write_cvalue(fx, ret_lane);
349349
}
350350

351+
sym::simd_splat => {
352+
intrinsic_args!(fx, args => (value); intrinsic);
353+
354+
if !ret.layout().ty.is_simd() {
355+
report_simd_type_validation_error(fx, intrinsic, span, ret.layout().ty);
356+
return;
357+
}
358+
let (lane_count, lane_ty) = ret.layout().ty.simd_size_and_type(fx.tcx);
359+
360+
if value.layout().ty != lane_ty {
361+
fx.tcx.dcx().span_fatal(
362+
span,
363+
format!(
364+
"[simd_splat] expected element type {lane_ty:?}, got {got:?}",
365+
got = value.layout().ty
366+
),
367+
);
368+
}
369+
370+
for i in 0..lane_count {
371+
let ret_lane = ret.place_lane(fx, i.into());
372+
ret_lane.write_cvalue(fx, value);
373+
}
374+
}
375+
351376
sym::simd_neg
352377
| sym::simd_bswap
353378
| sym::simd_bitreverse

0 commit comments

Comments
 (0)