]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
tests/tcg/s390x: Add long-double.c
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 21 Oct 2022 06:09:30 +0000 (16:09 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Sat, 4 Feb 2023 16:19:42 +0000 (06:19 -1000)
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tests/tcg/s390x/Makefile.target
tests/tcg/s390x/long-double.c [new file with mode: 0644]

index 79250f31ddebeb05eda2ccc224e81c6066f8ffd7..1d454270c0e69270a448e78972e44ec44eafbf68 100644 (file)
@@ -26,6 +26,7 @@ TESTS+=branch-relative-long
 TESTS+=noexec
 TESTS+=div
 TESTS+=clst
+TESTS+=long-double
 
 Z13_TESTS=vistr
 $(Z13_TESTS): CFLAGS+=-march=z13 -O2
diff --git a/tests/tcg/s390x/long-double.c b/tests/tcg/s390x/long-double.c
new file mode 100644 (file)
index 0000000..757a626
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Perform some basic arithmetic with long double, as a sanity check.
+ * With small integral numbers, we can cross-check with integers.
+ */
+
+#include <assert.h>
+
+int main()
+{
+    int i, j;
+
+    for (i = 1; i < 5; i++) {
+        for (j = 1; j < 5; j++) {
+            long double la = (long double)i + j;
+            long double lm = (long double)i * j;
+            long double ls = (long double)i - j;
+
+            assert(la == i + j);
+            assert(lm == i * j);
+            assert(ls == i - j);
+        }
+    }
+    return 0;
+}