aboutsummaryrefslogtreecommitdiff
path: root/test/builtins/Unit/addtf3_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/builtins/Unit/addtf3_test.c')
-rw-r--r--test/builtins/Unit/addtf3_test.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/builtins/Unit/addtf3_test.c b/test/builtins/Unit/addtf3_test.c
index 8f00f6de7..d24d0ebd7 100644
--- a/test/builtins/Unit/addtf3_test.c
+++ b/test/builtins/Unit/addtf3_test.c
@@ -11,11 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "int_lib.h"
+#include <fenv.h>
#include <stdio.h>
#if __LDBL_MANT_DIG__ == 113
+#include "int_lib.h"
#include "fp_test.h"
// Returns: a + b
@@ -74,6 +75,26 @@ int main()
UINT64_C(0x61e58dd6c51eb77c)))
return 1;
+#if (defined(__arm__) || defined(__aarch64__)) && defined(__ARM_FP)
+ // Rounding mode tests on supported architectures
+ long double m = 1234.0L, n = 0.01L;
+ fesetround(FE_UPWARD);
+ if (__addtf3(m, n) != 1235.0L)
+ return 1;
+
+ fesetround(FE_DOWNWARD);
+ if (__addtf3(m, n) != 1234.0L)
+ return 1;
+
+ fesetround(FE_TOWARDZERO);
+ if (__addtf3(m, n) != 1234.0L)
+ return 1;
+
+ fesetround(FE_TONEAREST);
+ if (__addtf3(m, n) != 1234.0L)
+ return 1;
+#endif
+
#else
printf("skipped\n");