if (MEM_P (SET_SRC (curr_set))
&& SCALAR_INT_MODE_P (GET_MODE (SET_DEST (curr_set)))
&& REG_P (XEXP (SET_SRC (curr_set), 0))
- && REG_P (XEXP (SET_SRC (curr_set), 0))
&& REGNO (XEXP (SET_SRC (curr_set), 0)) == prev_dest_regno
&& GET_CODE (SET_SRC (prev_set)) == PLUS
&& REG_P (XEXP (SET_SRC (prev_set), 0))
(mem:DI (plus:DI (reg:DI rD) (const_int IMM12)))) */
if (GET_CODE (SET_SRC (prev_set)) == UNSPEC
- && XINT (prev_set, 1) == UNSPEC_AUIPC
+ && XINT (SET_SRC (prev_set), 1) == UNSPEC_AUIPC
&& MEM_P (SET_SRC (curr_set))
&& SCALAR_INT_MODE_P (GET_MODE (SET_DEST (curr_set)))
&& GET_CODE (XEXP (SET_SRC (curr_set), 0)) == PLUS)
bases are the same register. */
if (base_prev != NULL_RTX && base_curr != NULL_RTX
&& REG_P (base_prev) && REG_P (base_curr)
- && REGNO (base_prev) != REGNO (base_curr)
- /* The alignment of hte base pointer is more useful than the
+ && REGNO (base_prev) == REGNO (base_curr)
+ /* The alignment of the base pointer is more useful than the
alignment of the memory reference for determining if we're
on opposite sides of a cache line. */
&& REGNO_POINTER_ALIGN (ORIGINAL_REGNO (base_prev)) >= 128)
&& (INTVAL (offset_prev) + 8 == INTVAL (offset_curr)))
{
if (dump_file)
- fprintf (dump_file, "RISCV_FUSE_ALIGNED_STD\n");
+ fprintf (dump_file, "RISCV_FUSE_CACHE_ALIGNED_STD\n");
return true;
}
}
if (GET_CODE (SET_SRC (prev_set)) == MINUS
&& (XEXP (SET_SRC (prev_set), 0)
== CONST0_RTX (GET_MODE (SET_SRC (prev_set))))
- && CONST_INT_P (XEXP (SET_SRC (prev_set), 0))
&& GET_CODE (SET_SRC (curr_set)) == SMAX
&& REG_P (SET_DEST (prev_set))
&& REG_P (SET_DEST (curr_set))
--- /dev/null
+/* Verify RISCV_FUSE_AUIPC_LD correctly matches auipc+ld pairs.
+ This exercises the fix for XINT accessing SET_SRC (prev_set)
+ instead of prev_set directly. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" "-Os" "-Oz" "-flto" } } */
+/* { dg-options "-march=rv64gc -mabi=lp64d -mtune=sifive-p600-series -mcmodel=medany -mexplicit-relocs -fno-section-anchors -fdump-rtl-sched1" } */
+/* No upstream mtune currently enables RISCV_FUSE_AUIPC_LD. */
+/* { dg-final { scan-rtl-dump "RISCV_FUSE_AUIPC_LD" "sched1" { xfail *-*-* } } } */
+
+extern long x;
+
+long
+load_global (void)
+{
+ return x;
+}
--- /dev/null
+/* Verify RISCV_FUSE_B_ALUI correctly matches sub+smax (abs) pattern.
+ This exercises the removal of the redundant CONST_INT_P check. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" "-Os" "-Oz" "-flto" } } */
+/* { dg-options "-march=rv64gc_zbb -mabi=lp64d -mtune=sifive-p600-series -fdump-rtl-sched1" } */
+/* No upstream mtune currently enables RISCV_FUSE_B_ALUI. */
+/* { dg-final { scan-rtl-dump "RISCV_FUSE_B_ALUI" "sched1" { xfail *-*-* } } } */
+
+long
+abs_val (long x)
+{
+ return x < 0 ? -x : x;
+}
--- /dev/null
+/* Verify RISCV_FUSE_CACHE_ALIGNED_STD correctly matches consecutive
+ stores to the same cache line. This exercises the fix for base
+ register comparison (changed from != to ==). */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" "-Os" "-Oz" "-flto" } } */
+/* { dg-options "-march=rv64gc -mabi=lp64d -mtune=sifive-p600-series -fdump-rtl-sched1" } */
+/* No upstream mtune currently enables RISCV_FUSE_CACHE_ALIGNED_STD. */
+/* { dg-final { scan-rtl-dump "RISCV_FUSE_CACHE_ALIGNED_STD" "sched1" { xfail *-*-* } } } */
+
+struct pair
+{
+ long a;
+ long b;
+} __attribute__ ((aligned (16)));
+
+void
+store_pair (struct pair *p, long x, long y)
+{
+ p->a = x;
+ p->b = y;
+}
--- /dev/null
+/* Verify RISCV_FUSE_LDINDEXED correctly matches add+ld pairs.
+ This exercises the removal of the duplicate REG_P check. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" "-Os" "-Oz" "-flto" } } */
+/* { dg-options "-march=rv64gc -mabi=lp64d -mtune=sifive-p600-series -fdump-rtl-sched1" } */
+/* No upstream mtune currently enables RISCV_FUSE_LDINDEXED. */
+/* { dg-final { scan-rtl-dump "RISCV_FUSE_LDINDEXED" "sched1" { xfail *-*-* } } } */
+
+long
+load_indexed (long *base, long idx)
+{
+ return base[idx];
+}