aboutsummaryrefslogtreecommitdiff
path: root/gcc/generic-match-head.c
diff options
context:
space:
mode:
authorJames Greenhalgh <james.greenhalgh@arm.com>2017-06-22 08:39:04 +0000
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>2017-06-22 08:39:04 +0000
commit71f82be94fad1597696b14c325eed203b75dde70 (patch)
tree22777f9ae20fbb5df987fa57c59a17698606807b /gcc/generic-match-head.c
parenta78f698034a2ab7fabd0d6ca3d35e688670b6d2f (diff)
downloadgcc-71f82be94fad1597696b14c325eed203b75dde70.zip
gcc-71f82be94fad1597696b14c325eed203b75dde70.tar.gz
gcc-71f82be94fad1597696b14c325eed203b75dde70.tar.bz2
[Patch match.pd] Fold (A / (1 << B)) to (A >> B)
For the testcase in the patch: unsigned long f2 (unsigned long a, int b) { unsigned long x = 1UL << b; return a / x; } We currently generate an unsigned division and a left shift, where we could instead generate a right shift. gcc/ 2017-06-21 James Greenhalgh <james.greenhalgh@arm.com> * match.pd (A / (1 << B) -> A >> B): New. * generic-match-head.c: Include optabs-tree.h. * gimple-match-head.c: Likewise. * optabs-tree.h (target_supports_op_p): New. * optabs-tree.c (target_supports_op_p): New. gcc/testsuite/ 2017-06-21 James Greenhalgh <james.greenhalgh@arm.com> * gcc.dg/tree-ssa/forwprop-37.c: New. From-SVN: r249502
Diffstat (limited to 'gcc/generic-match-head.c')
-rw-r--r--gcc/generic-match-head.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/generic-match-head.c b/gcc/generic-match-head.c
index 0c0d182..4504401 100644
--- a/gcc/generic-match-head.c
+++ b/gcc/generic-match-head.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "case-cfn-macros.h"
#include "gimplify.h"
+#include "optabs-tree.h"
/* Routine to determine if the types T1 and T2 are effectively