diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-05-11 16:49:45 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-05-16 13:52:13 +0100 |
commit | c1adc91f8af052f293a01327be335b66870e24b4 (patch) | |
tree | f3d26deccceb438e293052c7980ce1ae68a06ab3 /math/math_errf.c | |
parent | 5eb9d19608e31a2d9fe5a9e2708e4628524c29d9 (diff) | |
download | arm-optimized-routines-c1adc91f8af052f293a01327be335b66870e24b4.tar.gz |
Fix __math_divzerof for clang
clang does not understand -frounding-math or -ftrapping-math so division
by zero is constant folded, so do the division in a noinline function.
Diffstat (limited to 'math/math_errf.c')
-rw-r--r-- | math/math_errf.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/math/math_errf.c b/math/math_errf.c index c96c5df..bb38a37 100644 --- a/math/math_errf.c +++ b/math/math_errf.c @@ -63,11 +63,17 @@ __math_oflowf (uint32_t sign) return xflowf (sign, 0x1p97f); } +/* NOINLINE prevents fenv semantics breaking optimizations. */ +NOINLINE static float +divzerof (float x) +{ + return with_errnof (x / 0.0f, ERANGE); +} + HIDDEN float __math_divzerof (uint32_t sign) { - float y = 0; - return with_errnof ((sign ? -1 : 1) / y, ERANGE); + return divzerof (sign ? -1.0f : 1.0f); } HIDDEN float |