Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions tests/codegen-llvm/preserve-vec-element-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled --target=aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ add-minicore
#![feature(no_core, repr_simd, f16, f128)]
#![feature(no_core, f16, f128)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
Expand All @@ -12,11 +12,9 @@
// useful for optimization. It prevents additional bitcasts that make LLVM patterns fail.

extern crate minicore;
use minicore::simd::Simd;
use minicore::*;

#[repr(simd)]
pub struct Simd<T, const N: usize>([T; N]);

#[repr(C)]
struct Pair<T>(T, T);

Expand Down
11 changes: 5 additions & 6 deletions tests/codegen-llvm/regparm-inreg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@

#![crate_type = "lib"]
#![no_core]
#![feature(no_core, lang_items, repr_simd)]
#![feature(no_core, lang_items)]

extern crate minicore;
use minicore::*;

pub mod tests {
use minicore::simd::Simd;

// regparm doesn't work for "fastcall" calling conv (only 2 inregs)
// CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3)
#[no_mangle]
Expand Down Expand Up @@ -98,8 +99,7 @@ pub mod tests {
pub extern "C" fn f10(_: f32, _: f64, _: bool, _: i16) {}

#[allow(non_camel_case_types)]
#[repr(simd)]
pub struct __m128([f32; 4]);
type __m128 = Simd<f32, 4>;

// regparm0: @f11(i32 noundef %_1, <4 x float> %_2, i32 noundef %_3, i32 noundef %_4)
// regparm1: @f11(i32 inreg noundef %_1, <4 x float> %_2, i32 noundef %_3, i32 noundef %_4)
Expand All @@ -111,8 +111,7 @@ pub mod tests {
pub extern "C" fn f11(_: i32, _: __m128, _: i32, _: i32) {}

#[allow(non_camel_case_types)]
#[repr(simd)]
pub struct __m256([f32; 8]);
type __m256 = Simd<f32, 8>;

// regparm0: @f12(i32 noundef %_1, <8 x float> %_2, i32 noundef %_3, i32 noundef %_4)
// regparm1: @f12(i32 inreg noundef %_1, <8 x float> %_2, i32 noundef %_3, i32 noundef %_4)
Expand Down
26 changes: 2 additions & 24 deletions tests/codegen-llvm/s390x-simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,13 @@

#![crate_type = "rlib"]
#![feature(no_core, asm_experimental_arch)]
#![feature(simd_ffi, intrinsics, repr_simd)]
#![feature(simd_ffi, intrinsics)]
#![no_core]

extern crate minicore;
use minicore::simd::*;
use minicore::*;

#[repr(simd)]
struct i8x16([i8; 16]);

#[repr(simd)]
struct i16x8([i16; 8]);

#[repr(simd)]
struct i32x4([i32; 4]);

#[repr(simd)]
struct i64x2([i64; 2]);

#[repr(simd)]
struct f32x4([f32; 4]);

#[repr(simd)]
struct f64x2([f64; 2]);

impl Copy for i8x16 {}
impl Copy for i16x8 {}
impl Copy for i32x4 {}
impl Copy for i64x2 {}

#[rustc_intrinsic]
unsafe fn simd_ge<T, U>(x: T, y: T) -> U;

Expand Down
10 changes: 3 additions & 7 deletions tests/ui/abi/arm-unadjusted-intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@
//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
//@[aarch64] needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![feature(
no_core, lang_items, link_llvm_intrinsics,
abi_unadjusted, repr_simd, arm_target_feature,
)]
#![feature(no_core, lang_items, link_llvm_intrinsics, abi_unadjusted, arm_target_feature)]
#![no_std]
#![no_core]
#![crate_type = "lib"]
#![allow(non_camel_case_types)]

extern crate minicore;
use minicore::simd::Simd;
use minicore::*;

// Regression test for https://github.com/rust-lang/rust/issues/118124.

#[repr(simd)]
pub struct int8x16_t(pub(crate) [i8; 16]);
impl Copy for int8x16_t {}
pub type int8x16_t = Simd<i8, 16>;

#[repr(C)]
pub struct int8x16x4_t(pub int8x16_t, pub int8x16_t, pub int8x16_t, pub int8x16_t);
Expand Down
13 changes: 5 additions & 8 deletions tests/ui/abi/simd-abi-checks-empty-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
//@ build-fail
//@ ignore-backends: gcc
#![no_core]
#![feature(no_core, repr_simd)]
#![allow(improper_ctypes_definitions)]
#![feature(no_core)]

extern crate minicore;
use minicore::*;
use minicore::simd::Simd;

#[repr(simd)]
pub struct SimdVec([i32; 4]);

pub extern "C" fn pass_by_vec(_: SimdVec) {}
//~^ ERROR: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI
#[expect(improper_ctypes_definitions)]
pub extern "C" fn pass_by_vec(_: Simd<i32, 4>) {}
//~^ ERROR: this function definition uses SIMD vector type `Simd<i32, 4>` which is not currently supported with the chosen ABI
8 changes: 4 additions & 4 deletions tests/ui/abi/simd-abi-checks-empty-list.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI
--> $DIR/simd-abi-checks-empty-list.rs:18:1
error: this function definition uses SIMD vector type `Simd<i32, 4>` which is not currently supported with the chosen ABI
--> $DIR/simd-abi-checks-empty-list.rs:15:1
|
LL | pub extern "C" fn pass_by_vec(_: SimdVec) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
LL | pub extern "C" fn pass_by_vec(_: Simd<i32, 4>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here

error: aborting due to 1 previous error

16 changes: 4 additions & 12 deletions tests/ui/abi/simd-abi-checks-s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,21 @@
//[z13_soft_float]~? WARN must be disabled to ensure that the ABI of the current target can be implemented correctly
//[z13_soft_float]~? WARN target feature `soft-float` cannot be enabled with `-Ctarget-feature`

#![feature(no_core, repr_simd)]
#![feature(no_core)]
#![no_core]
#![crate_type = "lib"]
#![allow(non_camel_case_types, improper_ctypes_definitions)]

extern crate minicore;
use minicore::simd::*;
use minicore::*;

#[repr(simd)]
pub struct i8x8([i8; 8]);
#[repr(simd)]
pub struct i8x16([i8; 16]);
#[repr(simd)]
pub struct i8x32([i8; 32]);
#[repr(C)]
pub struct Wrapper<T>(T);
impl<T: Copy> Copy for Wrapper<T> {}

#[repr(transparent)]
pub struct TransparentWrapper<T>(T);

impl Copy for i8x8 {}
impl Copy for i8x16 {}
impl Copy for i8x32 {}
impl<T: Copy> Copy for Wrapper<T> {}
impl<T: Copy> Copy for TransparentWrapper<T> {}

#[no_mangle]
Expand Down
40 changes: 20 additions & 20 deletions tests/ui/abi/simd-abi-checks-s390x.z10.stderr
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:41:1
error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:33:1
|
LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:46:1
error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:38:1
|
LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:92:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:84:1
|
LL | / extern "C" fn vector_transparent_wrapper_ret_small(
LL | | x: &TransparentWrapper<i8x8>,
Expand All @@ -24,8 +24,8 @@ LL | | ) -> TransparentWrapper<i8x8> {
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:99:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:91:1
|
LL | / extern "C" fn vector_transparent_wrapper_ret(
LL | | x: &TransparentWrapper<i8x16>,
Expand All @@ -34,48 +34,48 @@ LL | | ) -> TransparentWrapper<i8x16> {
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:114:1
error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:106:1
|
LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:119:1
error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:111:1
|
LL | extern "C" fn vector_arg(x: i8x16) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:130:1
error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:122:1
|
LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:135:1
error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:127:1
|
LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:146:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:138:1
|
LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:151:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:143:1
|
LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
Expand Down
40 changes: 20 additions & 20 deletions tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:41:1
error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:33:1
|
LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:46:1
error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:38:1
|
LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:92:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:84:1
|
LL | / extern "C" fn vector_transparent_wrapper_ret_small(
LL | | x: &TransparentWrapper<i8x8>,
Expand All @@ -24,8 +24,8 @@ LL | | ) -> TransparentWrapper<i8x8> {
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:99:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:91:1
|
LL | / extern "C" fn vector_transparent_wrapper_ret(
LL | | x: &TransparentWrapper<i8x16>,
Expand All @@ -34,48 +34,48 @@ LL | | ) -> TransparentWrapper<i8x16> {
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:114:1
error: this function definition uses SIMD vector type `Simd<i8, 8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:106:1
|
LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:119:1
error: this function definition uses SIMD vector type `Simd<i8, 16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:111:1
|
LL | extern "C" fn vector_arg(x: i8x16) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:130:1
error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:122:1
|
LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:135:1
error: this function definition uses SIMD vector type `Wrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:127:1
|
LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:146:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 8>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:138:1
|
LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
|
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)

error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:151:1
error: this function definition uses SIMD vector type `TransparentWrapper<Simd<i8, 16>>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
--> $DIR/simd-abi-checks-s390x.rs:143:1
|
LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
Expand Down
Loading
Loading