about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-11-16 12:27:08 +0100
committerRalf Jung <post@ralfj.de>2024-11-20 20:41:28 +0100
commit666bcbdb2edb829b76d9c2a4447562b397040f36 (patch)
tree92d8ef93b13fd12a36356a84cf2adf662ec7d385 /tests/codegen
parent46e8d20301cb4abe91ab0a4bea43bb085e1d4e4a (diff)
downloadrust-666bcbdb2edb829b76d9c2a4447562b397040f36.tar.gz
rust-666bcbdb2edb829b76d9c2a4447562b397040f36.zip
aarch64 softfloat target: always pass floats in int registers
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/aarch64-softfloat.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/codegen/aarch64-softfloat.rs b/tests/codegen/aarch64-softfloat.rs
new file mode 100644
index 00000000000..14d0054f80c
--- /dev/null
+++ b/tests/codegen/aarch64-softfloat.rs
@@ -0,0 +1,48 @@
+//@ compile-flags: --target aarch64-unknown-none-softfloat -Zmerge-functions=disabled
+//@ needs-llvm-components: aarch64
+#![crate_type = "lib"]
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+impl Copy for f32 {}
+impl Copy for f64 {}
+
+// CHECK: i64 @pass_f64_C(i64 {{[^,]*}})
+#[no_mangle]
+extern "C" fn pass_f64_C(x: f64) -> f64 {
+    x
+}
+
+// CHECK: i64 @pass_f32_pair_C(i64 {{[^,]*}})
+#[no_mangle]
+extern "C" fn pass_f32_pair_C(x: (f32, f32)) -> (f32, f32) {
+    x
+}
+
+// CHECK: [2 x i64] @pass_f64_pair_C([2 x i64] {{[^,]*}})
+#[no_mangle]
+extern "C" fn pass_f64_pair_C(x: (f64, f64)) -> (f64, f64) {
+    x
+}
+
+// CHECK: i64 @pass_f64_Rust(i64 {{[^,]*}})
+#[no_mangle]
+fn pass_f64_Rust(x: f64) -> f64 {
+    x
+}
+
+// CHECK: i64 @pass_f32_pair_Rust(i64 {{[^,]*}})
+#[no_mangle]
+fn pass_f32_pair_Rust(x: (f32, f32)) -> (f32, f32) {
+    x
+}
+
+// CHECK: void @pass_f64_pair_Rust(ptr {{[^,]*}}, ptr {{[^,]*}})
+#[no_mangle]
+fn pass_f64_pair_Rust(x: (f64, f64)) -> (f64, f64) {
+    x
+}