diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-19 12:37:28 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-19 12:37:28 +0000 |
commit | 4e2a2fb45c465c9e0d6e0b010dde4e0678bf915f (patch) | |
tree | 750b7bfe08e957981b58a98957f22c84fb66776e | |
parent | 3ec419bfa38623ba4d1e56f82ec2e78d7c53ac93 (diff) | |
download | gcc-4e2a2fb45c465c9e0d6e0b010dde4e0678bf915f.tar.gz |
PR 43305
* builtins.c (expand_builtin_interclass_mathfn,
expand_builtin_signbit): Use maybe_emit_unop_insn, emit libcalls
if that fails.
testsuite/
* gcc.dg/pr43305.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157567 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/builtins.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr43305.c | 16 |
4 files changed, 38 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce98eb4f594..d0176663e3c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-03-19 Michael Matz <matz@suse.de> + + PR target/43305 + * builtins.c (expand_builtin_interclass_mathfn, + expand_builtin_signbit): Use maybe_emit_unop_insn, emit libcalls + if that fails. + 2010-03-19 Richard Guenther <rguenther@suse.de> PR tree-optimization/43415 diff --git a/gcc/builtins.c b/gcc/builtins.c index 705a25598b0..a68e743b616 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2312,6 +2312,8 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget) if (icode != CODE_FOR_nothing) { + rtx last = get_last_insn (); + tree orig_arg = arg; /* Make a suitable register to place result in. */ if (!target || GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp))) @@ -2332,8 +2334,10 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget) /* Compute into TARGET. Set TARGET to wherever the result comes back. */ - emit_unop_insn (icode, target, op0, UNKNOWN); - return target; + if (maybe_emit_unop_insn (icode, target, op0, UNKNOWN)) + return target; + delete_insns_since (last); + CALL_EXPR_ARG (exp, 0) = orig_arg; } return NULL_RTX; @@ -5197,9 +5201,11 @@ expand_builtin_signbit (tree exp, rtx target) icode = signbit_optab->handlers [(int) fmode].insn_code; if (icode != CODE_FOR_nothing) { + rtx last = get_last_insn (); target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp))); - emit_unop_insn (icode, target, temp, UNKNOWN); - return target; + if (maybe_emit_unop_insn (icode, target, temp, UNKNOWN)) + return target; + delete_insns_since (last); } /* For floating point formats without a sign bit, implement signbit diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 09f644d2e7f..39705477a34 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-19 Michael Matz <matz@suse.de> + + PR target/43305 + * gcc.dg/pr43305.c: New testcase. + 2010-03-19 Richard Guenther <rguenther@suse.de> PR tree-optimization/43415 diff --git a/gcc/testsuite/gcc.dg/pr43305.c b/gcc/testsuite/gcc.dg/pr43305.c new file mode 100644 index 00000000000..c8aeaf23ccc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr43305.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -ffast-math" } */ +extern int ilogbl(long double); +extern int printf(const char *format, ...); + +__attribute__((noinline, noclone)) +int foo(long double x) +{ + return ilogbl(x); +} + +int main() +{ + printf("%d\n", foo(100)); + return 0; +} |