-
Notifications
You must be signed in to change notification settings - Fork 91
Closed
Description
./tests/run-make/simd-ffi/simd.rs
// ensures that public symbols are not removed completely
#![crate_type = "lib"]
// we can compile to a variety of platforms, because we don't need
// cross-compiled standard libraries.
#![feature(no_core, auto_traits)]
#![no_core]
#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)]
#[derive(Copy)]
#[repr(simd)]
pub struct f32x4(f32, f32, f32, f32);
extern "C" {
#[link_name = "llvm.sqrt.v4f32"]
fn vsqrt(x: f32x4) -> f32x4;
}
pub fn foo(x: f32x4) -> f32x4 {
unsafe { vsqrt(x) }
}
#[derive(Copy)]
#[repr(simd)]
pub struct i32x4(i32, i32, i32, i32);
extern "C" {
// _mm_sll_epi32
#[cfg(any(target_arch = "x86", target_arch = "x86-64"))]
#[link_name = "llvm.x86.sse2.psll.d"]
fn integer(a: i32x4, b: i32x4) -> i32x4;
// vmaxq_s32
#[cfg(target_arch = "arm")]
#[link_name = "llvm.arm.neon.vmaxs.v4i32"]
fn integer(a: i32x4, b: i32x4) -> i32x4;
// vmaxq_s32
#[cfg(target_arch = "aarch64")]
#[link_name = "llvm.aarch64.neon.maxs.v4i32"]
fn integer(a: i32x4, b: i32x4) -> i32x4;
// just some substitute foreign symbol, not an LLVM intrinsic; so
// we still get type checking, but not as detailed as (ab)using
// LLVM.
#[cfg(not(any(
target_arch = "x86",
target_arch = "x86-64",
target_arch = "arm",
target_arch = "aarch64"
)))]
fn integer(a: i32x4, b: i32x4) -> i32x4;
}
pub fn bar(a: i32x4, b: i32x4) -> i32x4 {
unsafe { integer(a, b) }
}
#[lang = "sized"]
pub trait Sized {}
#[lang = "copy"]
pub trait Copy {}
impl Copy for f32 {}
impl Copy for i32 {}
pub mod marker {
pub use Copy;
}
#[lang = "freeze"]
auto trait Freeze {}
#[macro_export]
#[rustc_builtin_macro]
macro_rules! Copy {
() => {};
}
#[macro_export]
#[rustc_builtin_macro]
macro_rules! derive {
() => {};
}warning: type `f32x4` should have an upper camel case name
--> ./tests/run-make/simd-ffi/simd.rs:11:12
|
11 | pub struct f32x4(f32, f32, f32, f32);
| ^^^^^ help: convert the identifier to upper camel case (notice the capitalization): `F32x4`
|
= note: `#[warn(non_camel_case_types)]` on by default
warning: type `i32x4` should have an upper camel case name
--> ./tests/run-make/simd-ffi/simd.rs:24:12
|
24 | pub struct i32x4(i32, i32, i32, i32);
| ^^^^^ help: convert the identifier to upper camel case (notice the capitalization): `I32x4`
warning: `extern` block uses type `f32x4`, which is not FFI-safe
--> ./tests/run-make/simd-ffi/simd.rs:15:17
|
15 | fn vsqrt(x: f32x4) -> f32x4;
| ^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
--> ./tests/run-make/simd-ffi/simd.rs:11:1
|
11 | pub struct f32x4(f32, f32, f32, f32);
| ^^^^^^^^^^^^^^^^
= note: `#[warn(improper_ctypes)]` on by default
warning: `extern` block uses type `f32x4`, which is not FFI-safe
--> ./tests/run-make/simd-ffi/simd.rs:15:27
|
15 | fn vsqrt(x: f32x4) -> f32x4;
| ^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
--> ./tests/run-make/simd-ffi/simd.rs:11:1
|
11 | pub struct f32x4(f32, f32, f32, f32);
| ^^^^^^^^^^^^^^^^
warning: `extern` block uses type `i32x4`, which is not FFI-safe
--> ./tests/run-make/simd-ffi/simd.rs:50:19
|
50 | fn integer(a: i32x4, b: i32x4) -> i32x4;
| ^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
--> ./tests/run-make/simd-ffi/simd.rs:24:1
|
24 | pub struct i32x4(i32, i32, i32, i32);
| ^^^^^^^^^^^^^^^^
warning: `extern` block uses type `i32x4`, which is not FFI-safe
--> ./tests/run-make/simd-ffi/simd.rs:50:29
|
50 | fn integer(a: i32x4, b: i32x4) -> i32x4;
| ^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
--> ./tests/run-make/simd-ffi/simd.rs:24:1
|
24 | pub struct i32x4(i32, i32, i32, i32);
| ^^^^^^^^^^^^^^^^
warning: `extern` block uses type `i32x4`, which is not FFI-safe
--> ./tests/run-make/simd-ffi/simd.rs:50:39
|
50 | fn integer(a: i32x4, b: i32x4) -> i32x4;
| ^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
--> ./tests/run-make/simd-ffi/simd.rs:24:1
|
24 | pub struct i32x4(i32, i32, i32, i32);
| ^^^^^^^^^^^^^^^^
thread 'rustc' panicked at 'not implemented: ***** unsupported LLVM intrinsic llvm.sqrt.v4f32', src/intrinsic/archs.rs:7998:10
stack backtrace:
0: 0x7f0df134be11 - std::backtrace_rs::backtrace::libunwind::trace::h184786643c1f8146
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f0df134be11 - std::backtrace_rs::backtrace::trace_unsynchronized::h10cef21dd42edd42
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f0df134be11 - std::sys_common::backtrace::_print_fmt::hca8722c6f82eccd9
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f0df134be11 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4b170c65cdf95c48
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f0df13ad4bf - core::fmt::rt::Argument::fmt::h7e50834cab28e102
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/core/src/fmt/rt.rs:138:9
5: 0x7f0df13ad4bf - core::fmt::write::h8bd64fe81f89dd81
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/core/src/fmt/mod.rs:1094:21
6: 0x7f0df133e977 - std::io::Write::write_fmt::hc75a842b3ecac8bc
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/io/mod.rs:1714:15
7: 0x7f0df134bc25 - std::sys_common::backtrace::_print::hdb7a31bd8c54eb49
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f0df134bc25 - std::sys_common::backtrace::print::hbcf968a4222dc0b5
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f0df134e9d3 - std::panicking::default_hook::{{closure}}::h02987b13cfa1387d
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:269:22
10: 0x7f0df134e764 - std::panicking::default_hook::hcb3fd44404995c49
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:288:9
11: 0x7f0df01abd6b - <rustc_driver_impl[7175fdba515aac6e]::install_ice_hook::{closure#0} as core[baaa20f768102eef]::ops::function::FnOnce<(&core[baaa20f768102eef]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
12: 0x7f0df134f1fe - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hec1e31de726d1657
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/alloc/src/boxed.rs:2007:9
13: 0x7f0df134f1fe - std::panicking::rust_panic_with_hook::h223f39091438ac61
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:709:13
14: 0x7f0df134ef87 - std::panicking::begin_panic_handler::{{closure}}::h4644cfd73fc4a198
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:597:13
15: 0x7f0df134c246 - std::sys_common::backtrace::__rust_end_short_backtrace::hfbaa4867b3658893
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:151:18
16: 0x7f0df134ecd2 - rust_begin_unwind
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:593:5
17: 0x7f0df13a9743 - core::panicking::panic_fmt::hbd4e3abda5ea01cd
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/core/src/panicking.rs:67:14
18: 0x7f0de234ab21 - rustc_codegen_gcc::intrinsic::llvm::intrinsic::he71461a27854e677
19: 0x7f0de237c4ed - rustc_codegen_gcc::declare::declare_raw_fn::h65133e9593c28374
20: 0x7f0de22d5b08 - rustc_codegen_gcc::declare::<impl rustc_codegen_gcc::context::CodegenCx>::declare_fn::hec24532cb2441adb
21: 0x7f0de2286629 - rustc_codegen_gcc::callee::get_fn::h82a24d48dcda9255
22: 0x7f0de22d435e - <rustc_codegen_gcc::context::CodegenCx as rustc_codegen_ssa::traits::misc::MiscMethods>::get_fn_addr::h0d8e3094c580bcfd
23: 0x7f0de23a4095 - rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_terminator::hdaf13f128cded52e
24: 0x7f0de239e56f - rustc_codegen_ssa::mir::codegen_mir::h3ad98a26028d240e
25: 0x7f0de2283015 - rustc_codegen_ssa::base::codegen_instance::h4de2a7fcd42b8fec
26: 0x7f0de22b779f - <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define::h3ba430a5d5241f22
27: 0x7f0de237aa8a - rustc_codegen_gcc::base::compile_codegen_unit::module_codegen::he6166c6882b2cbb7
28: 0x7f0de237999e - rustc_codegen_gcc::base::compile_codegen_unit::hee038d1e76e08ed1
29: 0x7f0de22a96fd - <rustc_codegen_gcc::GccCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::h9454ef5ee5ef580e
30: 0x7f0de228276d - rustc_codegen_ssa::base::codegen_crate::h1a4124ddfd8d676d
31: 0x7f0de22a932a - <rustc_codegen_gcc::GccCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::hfb6d3003355e12ad
32: 0x7f0def6dcbc2 - <rustc_session[ebb9057f9195e4cc]::session::Session>::time::<alloc[d1ea88cdd25af2a4]::boxed::Box<dyn core[baaa20f768102eef]::any::Any>, rustc_interface[e3841d12b9b221e7]::passes::start_codegen::{closure#0}>
33: 0x7f0def6dc73b - rustc_interface[e3841d12b9b221e7]::passes::start_codegen
34: 0x7f0def6d749d - <rustc_middle[56c503886228b671]::ty::context::GlobalCtxt>::enter::<<rustc_interface[e3841d12b9b221e7]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[baaa20f768102eef]::result::Result<alloc[d1ea88cdd25af2a4]::boxed::Box<dyn core[baaa20f768102eef]::any::Any>, rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>
35: 0x7f0def6d66cd - <rustc_interface[e3841d12b9b221e7]::queries::Queries>::ongoing_codegen
36: 0x7f0def6d57f0 - <rustc_interface[e3841d12b9b221e7]::interface::Compiler>::enter::<rustc_driver_impl[7175fdba515aac6e]::run_compiler::{closure#1}::{closure#2}, core[baaa20f768102eef]::result::Result<core[baaa20f768102eef]::option::Option<rustc_interface[e3841d12b9b221e7]::queries::Linker>, rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>
37: 0x7f0def6d2e21 - std[755122e38bdf80bb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e3841d12b9b221e7]::util::run_in_thread_pool_with_globals<rustc_interface[e3841d12b9b221e7]::interface::run_compiler<core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>, rustc_driver_impl[7175fdba515aac6e]::run_compiler::{closure#1}>::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>
38: 0x7f0def6d25a5 - <<std[755122e38bdf80bb]::thread::Builder>::spawn_unchecked_<rustc_interface[e3841d12b9b221e7]::util::run_in_thread_pool_with_globals<rustc_interface[e3841d12b9b221e7]::interface::run_compiler<core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>, rustc_driver_impl[7175fdba515aac6e]::run_compiler::{closure#1}>::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>::{closure#1} as core[baaa20f768102eef]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39: 0x7f0df1359685 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h59d6baf462325ed4
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/alloc/src/boxed.rs:1993:9
40: 0x7f0df1359685 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4eca0dd82537346f
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/alloc/src/boxed.rs:1993:9
41: 0x7f0df1359685 - std::sys::unix::thread::Thread::new::thread_start::h38e13b8ca4256fdb
at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys/unix/thread.rs:108:17
42: 0x7f0dece6444b - <unknown>
43: 0x7f0decee7e40 - <unknown>
44: 0x0 - <unknown>
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.72.0-nightly (2d0aa5768 2023-06-18) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z codegen-backend=/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so
query stack during panic:
end of query stack
warning: 7 warnings emitted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels