diff options
author | Richard Guenther <rguenther@suse.de> | 2006-10-29 15:25:52 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-10-29 15:25:52 +0000 |
commit | c7d32ff6193ad93643fda556bc0db619771241f1 (patch) | |
tree | 38f06c5cf989a34603cefe1af8322e66282f0d4b /gcc/builtins.c | |
parent | c3a4177fe14190fda53e6a31236dcb8e23cf28f8 (diff) | |
download | gcc-c7d32ff6193ad93643fda556bc0db619771241f1.zip gcc-c7d32ff6193ad93643fda556bc0db619771241f1.tar.gz gcc-c7d32ff6193ad93643fda556bc0db619771241f1.tar.bz2 |
builtins.c (expand_builtin_mathfn): Expand nearbyint as rint in case -fno-trapping-math is enabled.
2006-10-29 Richard Guenther <rguenther@suse.de>
* builtins.c (expand_builtin_mathfn): Expand nearbyint as
rint in case -fno-trapping-math is enabled.
* config/i386/i386-protos.h (ix86_expand_rint): Declare.
* config/i386/i386.c (ix86_gen_TWO52): New static helper function.
(ix86_expand_sse_fabs): Likewise.
(ix86_expand_rint): New function expanding rint to x87 or SSE math.
* config/i386/i386.md (rintdf2): Enable for SSE math if
-fno-trapping-math is enabled, use ix86_expand_rint for expansion.
(rintsf2): Likewise.
* gcc.target/i386/math-torture/rint.c: New testcase.
* gcc.target/i386/math-torture/nearbyint.c: Likewise.
From-SVN: r118144
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index b7d23c3..5375c5c 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1835,7 +1835,10 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) CASE_FLT_FN (BUILT_IN_ROUND): builtin_optab = round_optab; break; CASE_FLT_FN (BUILT_IN_NEARBYINT): - builtin_optab = nearbyint_optab; break; + builtin_optab = nearbyint_optab; + if (flag_trapping_math) + break; + /* Else fallthrough and expand as rint. */ CASE_FLT_FN (BUILT_IN_RINT): builtin_optab = rint_optab; break; default: |