aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel1@de.ibm.com>2009-06-23 12:10:06 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2009-06-23 12:10:06 +0000
commitfef015a857bef16bfc6304fab250ad0195c4fb1a (patch)
tree5b3dc81258ae8c58b8f741a5606cce8a4b23b663 /gcc/tree-ssa-math-opts.c
parent792569a94a163072c0da7c5aaa53a3a31c649888 (diff)
downloadgcc-fef015a857bef16bfc6304fab250ad0195c4fb1a.zip
gcc-fef015a857bef16bfc6304fab250ad0195c4fb1a.tar.gz
gcc-fef015a857bef16bfc6304fab250ad0195c4fb1a.tar.bz2
tree-ssa-math-opts.c (find_bswap): Increase the search depth in order to match bswaps with signed source operands.
2009-06-23 Andreas Krebbel <krebbel1@de.ibm.com> * tree-ssa-math-opts.c (find_bswap): Increase the search depth in order to match bswaps with signed source operands. 2009-06-23 Andreas Krebbel <krebbel1@de.ibm.com> * gcc.dg/optimize-bswapsi-1.c: Add new bswap implementation. * gcc.dg/optimize-bswapdi-1.c: Likewise. From-SVN: r148848
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 7e4e1bd..20ddbad 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1125,9 +1125,14 @@ find_bswap (gimple stmt)
struct symbolic_number n;
tree source_expr;
+ /* The last parameter determines the depth search limit. It usually
+ correlates directly to the number of bytes to be touched. We
+ increase that number by one here in order to also cover signed ->
+ unsigned conversions of the src operand as can be seen in
+ libgcc. */
source_expr = find_bswap_1 (stmt, &n,
TREE_INT_CST_LOW (
- TYPE_SIZE_UNIT (gimple_expr_type (stmt))));
+ TYPE_SIZE_UNIT (gimple_expr_type (stmt))) + 1);
if (!source_expr)
return NULL_TREE;