aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2014-07-02 22:19:19 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2014-07-02 22:19:19 +0200
commit4ed3092ff8fe1a769f8c18d3f215cfafaf44a95d (patch)
tree55483e0c6041d55004fd9e1326e9f7d35571d985 /gcc
parent1680a432083fd5e3c7e84a246595f3df9e9165d7 (diff)
downloadgcc-4ed3092ff8fe1a769f8c18d3f215cfafaf44a95d.zip
gcc-4ed3092ff8fe1a769f8c18d3f215cfafaf44a95d.tar.gz
gcc-4ed3092ff8fe1a769f8c18d3f215cfafaf44a95d.tar.bz2
Only transform rotate to rotatert and v.v. if target has both
Many targets do not have both rotate and rotatert. Of the 47 targets in the tree, 17 have both, 9 have only rotate, 2 have only rotatert, and 19 have neither (this is based on "grep -wil" so it can be slightly off). rs6000 has only rotate, and mips has only rotatert. For such targets simplifying rotate to rotatert and vice versa is not simplifying things at all. rs6000 has already way too many rotate patterns (some days it seems like two thousand, but it is somewhat less in reality still); I would prefer not to double that again. So, this patch makes genrecog define HAVE_rotate and HAVE_rotatert if those RTL codes are mentioned anywhere in the machine description, and then does the transformation in simplify-rtx.c only if both these flags are set. From-SVN: r212239
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/genconfig.c18
-rw-r--r--gcc/simplify-rtx.c2
3 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af05c98c..1aec9ad 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2014-07-02 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * genconfig.c (have_rotate_flag, have_rotatert_flag): New variables.
+ (walk_insn_part) <ROTATE, ROTATERT>: New cases.
+ (main): Conditionally write HAVE_rotate resp. HAVE_rotatert.
+ * simplify-rtx.c (simplify_binary_operation_1) <ROTATE, ROTATERT>:
+ Only do the transformation if both HAVE_rotate and HAVE_rotatert.
+
2014-07-02 Christian Bruel <christian.bruel@st.com>
PR target/29349
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index cafa8d3..d1996c3 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -36,6 +36,8 @@ static int have_cc0_flag;
static int have_cmove_flag;
static int have_cond_exec_flag;
static int have_lo_sum_flag;
+static int have_rotate_flag;
+static int have_rotatert_flag;
static int have_peephole_flag;
static int have_peephole2_flag;
@@ -117,6 +119,16 @@ walk_insn_part (rtx part, int recog_p, int non_pc_set_src)
have_lo_sum_flag = 1;
return;
+ case ROTATE:
+ if (recog_p)
+ have_rotate_flag = 1;
+ return;
+
+ case ROTATERT:
+ if (recog_p)
+ have_rotatert_flag = 1;
+ return;
+
case SET:
walk_insn_part (SET_DEST (part), 0, recog_p);
walk_insn_part (SET_SRC (part), recog_p,
@@ -346,6 +358,12 @@ main (int argc, char **argv)
if (have_lo_sum_flag)
printf ("#define HAVE_lo_sum 1\n");
+ if (have_rotate_flag)
+ printf ("#define HAVE_rotate 1\n");
+
+ if (have_rotatert_flag)
+ printf ("#define HAVE_rotatert 1\n");
+
if (have_peephole_flag)
printf ("#define HAVE_peephole 1\n");
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 181b56f..07b9353 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3076,6 +3076,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
prefer left rotation, if op1 is from bitsize / 2 + 1 to
bitsize - 1, use other direction of rotate with 1 .. bitsize / 2 - 1
amount instead. */
+#if defined(HAVE_rotate) && defined(HAVE_rotatert)
if (CONST_INT_P (trueop1)
&& IN_RANGE (INTVAL (trueop1),
GET_MODE_BITSIZE (mode) / 2 + (code == ROTATE),
@@ -3083,6 +3084,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
return simplify_gen_binary (code == ROTATE ? ROTATERT : ROTATE,
mode, op0, GEN_INT (GET_MODE_BITSIZE (mode)
- INTVAL (trueop1)));
+#endif
/* FALLTHRU */
case ASHIFTRT:
if (trueop1 == CONST0_RTX (mode))