Module Name: src
Committed By: matt
Date: Tue Jun 3 22:34:28 UTC 2014
Modified Files:
src/external/gpl3/gcc/dist/gcc/config/vax: vax-protos.h vax.c vax.md
Log Message:
Add some peepholes to help pushing of adjacent registers or memory locations
on the stack. Add a peephole to translate two pushes on integers into
one push of a DImode register.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/dist/gcc/config/vax/vax.c \
src/external/gpl3/gcc/dist/gcc/config/vax/vax.md
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h:1.2 src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h:1.3
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h:1.2 Fri May 23 13:35:26 2014
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h Tue Jun 3 22:34:28 2014
@@ -29,6 +29,7 @@ extern void print_operand_address (FILE
extern void print_operand (FILE *, rtx, int);
extern void vax_notice_update_cc (rtx, rtx);
extern void vax_expand_addsub_di_operands (rtx *, enum rtx_code);
+extern bool vax_decomposed_dimode_operand_p (rtx, rtx);
extern const char * vax_output_int_move (rtx, rtx *, enum machine_mode);
extern const char * vax_output_int_add (rtx, rtx *, enum machine_mode);
extern const char * vax_output_int_subtract (rtx, rtx *, enum machine_mode);
Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.c
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.7 src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.8
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.7 Tue Jun 3 22:31:48 2014
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.c Tue Jun 3 22:34:28 2014
@@ -2325,3 +2325,50 @@ vax_function_arg_advance (cumulative_arg
? (GET_MODE_SIZE (mode) + 3) & ~3
: (int_size_in_bytes (type) + 3) & ~3);
}
+
+bool
+vax_decomposed_dimode_operand_p (rtx lo, rtx hi)
+{
+ HOST_WIDE_INT lo_offset = 0;
+ HOST_WIDE_INT hi_offset = 0;
+
+ /* If the codes aren't the same, can't be a DImode operand. */
+ if (GET_CODE (lo) != GET_CODE (hi))
+ return false;
+
+ /* If a register, hi regno must be one more than the lo regno. */
+ if (REG_P (lo))
+ return REGNO (lo) + 1 == REGNO (hi);
+
+ /* If not memory, can't be a DImode operand. */
+ if (!MEM_P (lo))
+ return false;
+
+ /* Get addresses of memory operands. */
+ lo = XEXP(lo, 0);
+ hi = XEXP(hi, 0);
+
+ /* If POST_INC, regno must match. */
+ if (GET_CODE (lo) == POST_INC && GET_CODE (hi) == POST_INC)
+ return REGNO (XEXP (lo, 0)) == REGNO (XEXP (hi, 0));
+
+ if (GET_CODE (lo) == PLUS)
+ {
+ /* If PLUS, this must an indexed address so fail. */
+ if (GET_CODE (XEXP (lo, 0)) == PLUS || !CONST_INT_P (XEXP (lo, 1)))
+ return false;
+ lo_offset = INTVAL (XEXP (lo, 1));
+ lo = XEXP(lo, 0);
+ }
+
+ if (GET_CODE (hi) == PLUS)
+ {
+ /* If PLUS, this must an indexed address so fail. */
+ if (GET_CODE (XEXP (hi, 0)) == PLUS || !CONST_INT_P (XEXP (hi, 1)))
+ return false;
+ hi_offset = INTVAL (XEXP (hi, 1));
+ hi = XEXP(hi, 0);
+ }
+
+ return rtx_equal_p(lo, hi) && lo_offset + 4 == hi_offset;
+}
Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.7 src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.8
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.7 Thu Mar 20 16:53:55 2014
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.md Tue Jun 3 22:34:28 2014
@@ -1678,3 +1678,48 @@
})
(include "builtins.md")
+
+(define_peephole2
+ [(set (match_operand:SI 0 "push_operand" "")
+ (const_int 0))
+ (set (match_dup 0)
+ (match_operand:SI 1 "const_int_operand" ""))]
+ "INTVAL (operands[1]) >= 0"
+ [(set (match_dup 0)
+ (match_dup 1))]
+ "operands[0] = gen_rtx_MEM(DImode, XEXP (operands[0], 0));")
+
+(define_peephole2
+ [(set (match_operand:SI 0 "push_operand" "")
+ (match_operand:SI 1 "general_operand" ""))
+ (set (match_dup 0)
+ (match_operand:SI 2 "general_operand" ""))]
+ "vax_decomposed_dimode_operand_p (operands[2], operands[1])"
+ [(set (match_dup 0)
+ (match_dup 2))]
+ "{
+ operands[0] = gen_rtx_MEM(DImode, XEXP (operands[0], 0));
+ operands[2] = REG_P (operands[2])
+ ? gen_rtx_REG(DImode, REGNO (operands[2]))
+ : gen_rtx_MEM(DImode, XEXP (operands[2], 0));
+}")
+
+; Leave this commented out until we can determine whether the second move
+; precedes a jump which relies on the CC flags being set correctly.
+(define_peephole2
+ [(set (match_operand:SI 0 "nonimmediate_operand" "")
+ (match_operand:SI 1 "general_operand" ""))
+ (set (match_operand:SI 2 "nonimmediate_operand" "")
+ (match_operand:SI 3 "general_operand" ""))]
+ "0 && vax_decomposed_dimode_operand_p (operands[1], operands[3])
+ && vax_decomposed_dimode_operand_p (operands[0], operands[2])"
+ [(set (match_dup 0)
+ (match_dup 1))]
+ "{
+ operands[0] = REG_P (operands[0])
+ ? gen_rtx_REG(DImode, REGNO (operands[0]))
+ : gen_rtx_MEM(DImode, XEXP (operands[0], 0));
+ operands[1] = REG_P (operands[1])
+ ? gen_rtx_REG(DImode, REGNO (operands[1]))
+ : gen_rtx_MEM(DImode, XEXP (operands[1], 0));
+}")