2015-05-22 Jeff Law <law@redhat.com>
+ * combine.c (try_combine): Canonicalize (plus (mult X pow2) Y) into
+ (plus (ashift X log2) Y) if it is a split point.
+
* pa.c (mem_shadd_or_shadd_rtx_p): New function factored out
of hppa_legitimize_address to handle both forms of a multiply
by 2, 4 or 8.
split_code = GET_CODE (*split);
}
+ /* Similarly for (plus (mult FOO (const_int pow2))). */
+ if (split_code == PLUS
+ && GET_CODE (XEXP (*split, 0)) == MULT
+ && CONST_INT_P (XEXP (XEXP (*split, 0), 1))
+ && INTVAL (XEXP (XEXP (*split, 0), 1)) > 0
+ && (i = exact_log2 (UINTVAL (XEXP (XEXP (*split, 0), 1)))) >= 0)
+ {
+ rtx nsplit = XEXP (*split, 0);
+ SUBST (XEXP (*split, 0), gen_rtx_ASHIFT (GET_MODE (nsplit),
+ XEXP (nsplit, 0), GEN_INT (i)));
+ /* Update split_code because we may not have a multiply
+ anymore. */
+ split_code = GET_CODE (*split);
+ }
+
#ifdef INSN_SCHEDULING
/* If *SPLIT is a paradoxical SUBREG, when we split it, it should
be written as a ZERO_EXTEND. */
2015-05-21 Jeff Law <law@redhat.com>
+ * gcc.target/hppa/shadd-3.c: New test.
* gcc.target/hppa/shadd-4.c: New test.
2015-05-21 Michael Matz <matz@suse.de>
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* In this test we want to verify that combine canonicalizes the
+ MULT into an ASHIFT which in turn allows postreload-gcse to
+ find the common subexpression.
+
+ Neither pass dumps stuff in a format that is particularly good
+ for parsing here, so we count the shadd insns. More is not
+ necessarily better in this test. If this test is too fragile
+ over time we'll have to revisit the combine and/or postreload
+ dumps. */
+/* { dg-final { scan-assembler-times "sh.add" 5 } } */
+
+extern void oof (void);
+typedef struct simple_bitmap_def *sbitmap;
+struct simple_bitmap_def
+{
+ unsigned char *popcount;
+ unsigned int n_bits;
+ unsigned long elms[1];
+};
+__inline__ void
+SET_BIT (sbitmap map, unsigned int bitno)
+{
+ if (map->popcount)
+ {
+ unsigned char oldbit;
+ oldbit =
+ ((map)->elms[bitno / 64]);
+ if (!oldbit)
+ oof ();
+ }
+ map->elms[bitno / 64] |= 1;
+}
+
+void
+fix_bb_placements (int indx1, int indx2, sbitmap in_queue)
+{
+ SET_BIT (in_queue, indx1);
+ SET_BIT (in_queue, indx2);
+}