summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuís Marques <luismarques@lowrisc.org>2020-12-07 23:50:35 +0000
committerTom Stellard <tstellar@redhat.com>2020-12-09 11:02:27 -0500
commitba223fa19d35d41ad9eeade8978ab1a17d6aafe1 (patch)
tree027f2253f3778fddfb9a3af9de8501b1e2d06bd1
parentedc57e7e7ca2769d4d63bc939396f0d60666d262 (diff)
downloadllvm-ba223fa19d35d41ad9eeade8978ab1a17d6aafe1.tar.gz
[Clang][CodeGen][RISCV] Add hard float ABI tests with empty struct
This patch adds tests that showcase a behavior that is currently buggy. Fix in a follow-up patch. Differential Revision: https://reviews.llvm.org/D91269 (cherry picked from commit ca93f9abdc0abc96ca8fb7999549a50aadd95caf)
-rw-r--r--clang/test/CodeGen/riscv32-ilp32d-abi.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/CodeGen/riscv32-ilp32d-abi.cpp b/clang/test/CodeGen/riscv32-ilp32d-abi.cpp
new file mode 100644
index 000000000000..ffebb057e230
--- /dev/null
+++ b/clang/test/CodeGen/riscv32-ilp32d-abi.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -triple riscv32 -target-feature +d -target-abi ilp32d \
+// RUN: -Wno-missing-declarations -emit-llvm %s -o - | FileCheck %s
+
+struct empty_float2 { struct {}; float f; float g; };
+
+// CHECK: define float @_Z14f_empty_float212empty_float2(float %0, float %1)
+// FIXME: Extraneous padding before the second float
+// CHECK: { [4 x i8], float, [4 x i8], float }
+float f_empty_float2(empty_float2 a) {
+ return a.g;
+}
+
+struct empty_double2 { struct {}; double f; double g; };
+
+// CHECK: define double @_Z15f_empty_double213empty_double2(double %0, double %1)
+// FIXME: Extraneous padding before the second double
+// CHECK: { [8 x i8], double, [8 x i8], double }
+double f_empty_double2(empty_double2 a) {
+ return a.g;
+}
+
+struct empty_float_double { struct {}; float f; double g; };
+
+// CHECK: define double @_Z20f_empty_float_double18empty_float_double(float %0, double %1)
+// CHECK: { [4 x i8], float, double }
+double f_empty_float_double(empty_float_double a) {
+ return a.g;
+}
+
+struct empty_double_float { struct {}; double f; float g; };
+
+// CHECK: define double @_Z20f_empty_double_float18empty_double_float(double %0, float %1)
+// FIXME: Extraneous padding before the float
+// CHECK: { [8 x i8], double, [8 x i8], float }
+double f_empty_double_float(empty_double_float a) {
+ return a.g;
+}