summaryrefslogtreecommitdiff
path: root/test/builtins/Unit/subtf3_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/builtins/Unit/subtf3_test.c')
-rw-r--r--test/builtins/Unit/subtf3_test.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/builtins/Unit/subtf3_test.c b/test/builtins/Unit/subtf3_test.c
index bcf82e0c6..4953d1ceb 100644
--- a/test/builtins/Unit/subtf3_test.c
+++ b/test/builtins/Unit/subtf3_test.c
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include <fenv.h>
#include <stdio.h>
#if __LDBL_MANT_DIG__ == 113
@@ -67,6 +68,35 @@ int main()
UINT64_C(0xa44a7bca780a166c)))
return 1;
+#if (defined(__arm__) || defined(__aarch64__)) && defined(__ARM_FP)
+ // Rounding mode tests on supported architectures
+ const long double m = 1234.02L, n = 0.01L;
+
+ fesetround(FE_UPWARD);
+ if (test__subtf3(m, n,
+ UINT64_C(0x40093480a3d70a3d),
+ UINT64_C(0x70a3d70a3d70a3d7)))
+ return 1;
+
+ fesetround(FE_DOWNWARD);
+ if (test__subtf3(m, n,
+ UINT64_C(0x40093480a3d70a3d),
+ UINT64_C(0x70a3d70a3d70a3d6)))
+ return 1;
+
+ fesetround(FE_TOWARDZERO);
+ if (test__subtf3(m, n,
+ UINT64_C(0x40093480a3d70a3d),
+ UINT64_C(0x70a3d70a3d70a3d6)))
+ return 1;
+
+ fesetround(FE_TONEAREST);
+ if (test__subtf3(m, n,
+ UINT64_C(0x40093480a3d70a3d),
+ UINT64_C(0x70a3d70a3d70a3d7)))
+ return 1;
+#endif
+
#else
printf("skipped\n");