===================================================================
@@ -32,7 +32,7 @@
(define_constraint "B"
"An offset address."
(and (match_code "mem")
- (match_test "GET_CODE (XEXP (op, 0)) == PLUS")))
+ (match_test "moxie_offset_address_p (op)")))
(define_constraint "W"
"A register indirect memory operand."
===================================================================
@@ -22,3 +22,6 @@
extern int moxie_initial_elimination_offset (int, int);
extern void moxie_print_operand (FILE *, rtx, int);
extern void moxie_print_operand_address (FILE *, rtx);
+extern bool moxie_offset_address_p (rtx);
+
+
===================================================================
@@ -555,7 +555,6 @@
fprintf (f, "\tldi.l $r0, 0x0\n");
fprintf (f, "\tsto.l 0x8($fp), $r0\n");
fprintf (f, "\tpop $sp, $r0\n");
- fprintf (f, "\tnop\n");
fprintf (f, "\tjmpa 0x0\n");
}
@@ -571,10 +570,28 @@
mem = adjust_address (m_tramp, SImode, 4);
emit_move_insn (mem, chain_value);
- mem = adjust_address (m_tramp, SImode, 20);
+ mem = adjust_address (m_tramp, SImode, 16);
emit_move_insn (mem, fnaddr);
}
+/* Return true for memory offset addresses between -32768 and 32767. */
+bool
+moxie_offset_address_p (rtx x)
+{
+ x = XEXP (x, 0);
+
+ if (GET_CODE (x) == PLUS)
+ {
+ x = XEXP (x, 1);
+ if (GET_CODE (x) == CONST_INT)
+ {
+ unsigned int v = INTVAL (x) & 0xFFFF8000;
+ return (v == 0xFFFF8000 || v == 0x00000000);
+ }
+ }
+ return 0;
+}
+
/* The Global `targetm' Variable. */
/* Initialize the GCC target structure. */
===================================================================
@@ -362,7 +362,7 @@
#define FUNCTION_PROFILER(FILE,LABELNO) (abort (), 0)
/* Trampolines for Nested Functions. */
-#define TRAMPOLINE_SIZE (2 + 6 + 6 + 2 + 2 + 6)
+#define TRAMPOLINE_SIZE (2 + 6 + 4 + 2 + 6)
/* Alignment required for trampolines, in bits. */
#define TRAMPOLINE_ALIGNMENT 32
@@ -462,7 +462,8 @@
op1 = XEXP(X,0); \
op2 = XEXP(X,1); \
if (GET_CODE(op1) == REG \
- && CONSTANT_ADDRESS_P(op2) \
+ && GET_CODE(op2) == CONST_INT \
+ && IN_RANGE (INTVAL (op2), -32768, 32767) \
&& REGNO_OK_FOR_BASE_P(REGNO(op1))) \
goto LABEL; \
} \
===================================================================
@@ -266,7 +266,7 @@
lda.l %0, %1
sto.l %0, %1
ldo.l %0, %1"
- [(set_attr "length" "2,2,6,2,6,2,6,6,6")])
+ [(set_attr "length" "2,2,6,2,6,2,6,4,4")])
(define_insn_and_split "zero_extendqisi2"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
@@ -344,7 +344,7 @@
lda.b %0, %1
sto.b %0, %1
ldo.b %0, %1"
- [(set_attr "length" "2,2,6,2,6,2,6,6,6")])
+ [(set_attr "length" "2,2,6,2,6,2,6,4,4")])
(define_expand "movhi"
[(set (match_operand:HI 0 "general_operand" "")
@@ -372,7 +372,7 @@
lda.s %0, %1
sto.s %0, %1
ldo.s %0, %1"
- [(set_attr "length" "2,2,6,2,6,2,6,6,6")])
+ [(set_attr "length" "2,2,6,2,6,2,6,4,4")])
;; -------------------------------------------------------------------------
;; Compare instructions
===================================================================
@@ -34,7 +34,7 @@
if (MEM_P (op)
&& GET_CODE (XEXP (op, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST)
+ && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT)
return 1;
return general_operand (op, mode);