From badba92036e9728a499e118e7a6646fffd33d098 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 29 Jul 2023 17:28:42 -0700 Subject: tests/codegen/ffi-* -> cffi/ffi-* --- tests/codegen/cffi/ffi-const.rs | 13 +++++++++++++ tests/codegen/cffi/ffi-out-of-bounds-loads.rs | 25 +++++++++++++++++++++++++ tests/codegen/cffi/ffi-pure.rs | 13 +++++++++++++ tests/codegen/cffi/ffi-returns-twice.rs | 11 +++++++++++ tests/codegen/ffi-const.rs | 13 ------------- tests/codegen/ffi-out-of-bounds-loads.rs | 25 ------------------------- tests/codegen/ffi-pure.rs | 13 ------------- tests/codegen/ffi-returns-twice.rs | 11 ----------- 8 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 tests/codegen/cffi/ffi-const.rs create mode 100644 tests/codegen/cffi/ffi-out-of-bounds-loads.rs create mode 100644 tests/codegen/cffi/ffi-pure.rs create mode 100644 tests/codegen/cffi/ffi-returns-twice.rs delete mode 100644 tests/codegen/ffi-const.rs delete mode 100644 tests/codegen/ffi-out-of-bounds-loads.rs delete mode 100644 tests/codegen/ffi-pure.rs delete mode 100644 tests/codegen/ffi-returns-twice.rs (limited to 'tests/codegen') diff --git a/tests/codegen/cffi/ffi-const.rs b/tests/codegen/cffi/ffi-const.rs new file mode 100644 index 00000000000..93720503480 --- /dev/null +++ b/tests/codegen/cffi/ffi-const.rs @@ -0,0 +1,13 @@ +// compile-flags: -C no-prepopulate-passes +#![crate_type = "lib"] +#![feature(ffi_const)] + +pub fn bar() { unsafe { foo() } } + +extern "C" { + // CHECK-LABEL: declare{{.*}}void @foo() + // CHECK-SAME: [[ATTRS:#[0-9]+]] + // The attribute changed from `readnone` to `memory(none)` with LLVM 16.0. + // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} } + #[ffi_const] pub fn foo(); +} diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs new file mode 100644 index 00000000000..099726b2f08 --- /dev/null +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs @@ -0,0 +1,25 @@ +// Regression test for #29988 + +// compile-flags: -C no-prepopulate-passes +// only-x86_64 +// ignore-windows + +#[repr(C)] +struct S { + f1: i32, + f2: i32, + f3: i32, +} + +extern "C" { + fn foo(s: S); +} + +fn main() { + let s = S { f1: 1, f2: 2, f3: 3 }; + unsafe { + // CHECK: load { i64, i32 }, {{.*}}, align 4 + // CHECK: call void @foo({ i64, i32 } {{.*}}) + foo(s); + } +} diff --git a/tests/codegen/cffi/ffi-pure.rs b/tests/codegen/cffi/ffi-pure.rs new file mode 100644 index 00000000000..2ed73581358 --- /dev/null +++ b/tests/codegen/cffi/ffi-pure.rs @@ -0,0 +1,13 @@ +// compile-flags: -C no-prepopulate-passes +#![crate_type = "lib"] +#![feature(ffi_pure)] + +pub fn bar() { unsafe { foo() } } + +extern "C" { + // CHECK-LABEL: declare{{.*}}void @foo() + // CHECK-SAME: [[ATTRS:#[0-9]+]] + // The attribute changed from `readonly` to `memory(read)` with LLVM 16.0. + // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} } + #[ffi_pure] pub fn foo(); +} diff --git a/tests/codegen/cffi/ffi-returns-twice.rs b/tests/codegen/cffi/ffi-returns-twice.rs new file mode 100644 index 00000000000..0fbe03f0bb6 --- /dev/null +++ b/tests/codegen/cffi/ffi-returns-twice.rs @@ -0,0 +1,11 @@ +// compile-flags: -C no-prepopulate-passes +#![crate_type = "lib"] +#![feature(ffi_returns_twice)] + +pub fn bar() { unsafe { foo() } } + +extern "C" { + // CHECK: declare{{( dso_local)?}} void @foo(){{.*}}[[ATTRS:#[0-9]+]] + // CHECK: attributes [[ATTRS]] = { {{.*}}returns_twice{{.*}} } + #[ffi_returns_twice] pub fn foo(); +} diff --git a/tests/codegen/ffi-const.rs b/tests/codegen/ffi-const.rs deleted file mode 100644 index 93720503480..00000000000 --- a/tests/codegen/ffi-const.rs +++ /dev/null @@ -1,13 +0,0 @@ -// compile-flags: -C no-prepopulate-passes -#![crate_type = "lib"] -#![feature(ffi_const)] - -pub fn bar() { unsafe { foo() } } - -extern "C" { - // CHECK-LABEL: declare{{.*}}void @foo() - // CHECK-SAME: [[ATTRS:#[0-9]+]] - // The attribute changed from `readnone` to `memory(none)` with LLVM 16.0. - // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} } - #[ffi_const] pub fn foo(); -} diff --git a/tests/codegen/ffi-out-of-bounds-loads.rs b/tests/codegen/ffi-out-of-bounds-loads.rs deleted file mode 100644 index 099726b2f08..00000000000 --- a/tests/codegen/ffi-out-of-bounds-loads.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Regression test for #29988 - -// compile-flags: -C no-prepopulate-passes -// only-x86_64 -// ignore-windows - -#[repr(C)] -struct S { - f1: i32, - f2: i32, - f3: i32, -} - -extern "C" { - fn foo(s: S); -} - -fn main() { - let s = S { f1: 1, f2: 2, f3: 3 }; - unsafe { - // CHECK: load { i64, i32 }, {{.*}}, align 4 - // CHECK: call void @foo({ i64, i32 } {{.*}}) - foo(s); - } -} diff --git a/tests/codegen/ffi-pure.rs b/tests/codegen/ffi-pure.rs deleted file mode 100644 index 2ed73581358..00000000000 --- a/tests/codegen/ffi-pure.rs +++ /dev/null @@ -1,13 +0,0 @@ -// compile-flags: -C no-prepopulate-passes -#![crate_type = "lib"] -#![feature(ffi_pure)] - -pub fn bar() { unsafe { foo() } } - -extern "C" { - // CHECK-LABEL: declare{{.*}}void @foo() - // CHECK-SAME: [[ATTRS:#[0-9]+]] - // The attribute changed from `readonly` to `memory(read)` with LLVM 16.0. - // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} } - #[ffi_pure] pub fn foo(); -} diff --git a/tests/codegen/ffi-returns-twice.rs b/tests/codegen/ffi-returns-twice.rs deleted file mode 100644 index 0fbe03f0bb6..00000000000 --- a/tests/codegen/ffi-returns-twice.rs +++ /dev/null @@ -1,11 +0,0 @@ -// compile-flags: -C no-prepopulate-passes -#![crate_type = "lib"] -#![feature(ffi_returns_twice)] - -pub fn bar() { unsafe { foo() } } - -extern "C" { - // CHECK: declare{{( dso_local)?}} void @foo(){{.*}}[[ATTRS:#[0-9]+]] - // CHECK: attributes [[ATTRS]] = { {{.*}}returns_twice{{.*}} } - #[ffi_returns_twice] pub fn foo(); -} -- cgit 1.4.1-3-g733a5