about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-28 11:54:17 +0000
committerbors <bors@rust-lang.org>2022-02-28 11:54:17 +0000
commitedda7e959d0dea66ec60b064f63bf275ad1c41c5 (patch)
tree79f6bceb2488c9146dc7f636b169a47f527377f6 /src/test/codegen
parent48132caac241b4a278d58e1d791c6d31f7439ad6 (diff)
parent992c27c601db490d4b1f76a6e0e51475b871d315 (diff)
downloadrust-edda7e959d0dea66ec60b064f63bf275ad1c41c5.tar.gz
rust-edda7e959d0dea66ec60b064f63bf275ad1c41c5.zip
Auto merge of #94216 - psumbera:sparc64-abi-fix2, r=nagisa
more complete sparc64 ABI fix for aggregates with floating point members

Previous fix didn't handle nested structures at all.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/sparc-struct-abi.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/codegen/sparc-struct-abi.rs b/src/test/codegen/sparc-struct-abi.rs
index b531dba4607..e8816e4f303 100644
--- a/src/test/codegen/sparc-struct-abi.rs
+++ b/src/test/codegen/sparc-struct-abi.rs
@@ -81,3 +81,23 @@ pub struct FloatLongFloat {
 pub extern "C" fn structfloatlongfloat() -> FloatLongFloat {
     FloatLongFloat { f: 0.1, i: 123, g: 3.14 }
 }
+
+#[repr(C)]
+pub struct FloatFloat {
+    f: f32,
+    g: f32,
+}
+
+#[repr(C)]
+pub struct NestedStructs {
+    a: FloatFloat,
+    b: FloatFloat,
+}
+
+// CHECK: define inreg { float, float, float, float } @structnestestructs()
+// CHECK-NEXT: start:
+// CHECK-NEXT: ret { float, float, float, float } { float 0x3FB99999A0000000, float 0x3FF19999A0000000, float 0x40019999A0000000, float 0x400A666660000000 }
+#[no_mangle]
+pub extern "C" fn structnestestructs() -> NestedStructs {
+    NestedStructs { a: FloatFloat { f: 0.1, g: 1.1 }, b: FloatFloat { f: 2.2, g: 3.3 } }
+}