Commit 551cc6fd by Richard Henderson Committed by Richard Henderson

alpha.c (some_operand): Accept HIGH.

	* config/alpha/alpha.c (some_operand): Accept HIGH.
	(input_operand): Likewise; accept simple references to globals.
	(alpha_const_ok_for_letter_p): New, outlined from alpha.h.
	(alpha_const_double_ok_for_letter_p): Likewise.
	(alpha_extra_constraint): Likewise.
	(alpha_preferred_reload_class): Likewise.  Do not force
	symbolic constants to memory.
	(alpha_legitimate_address_p): Accept simple references
	to small_symbolic_operand.
	(alpha_legitimize_address): New arg scratch.  Be prepared to be
	called when no_new_pseudos.  Emit simple symbolic references.
	Split integers into low, high, and rest.
	(alpha_expand_mov): Use alpha_legitimize_address.
	(some_small_symbolic_mem_operand): New.
	(split_small_symbolic_mem_operand): New.
	* config/alpha/alpha-protos.h: Update.
	* config/alpha/alpha.h (CONST_OK_FOR_LETTER_P): Out-line.
	(CONST_DOUBLE_OK_FOR_LETTER_P): Likewise.
	(EXTRA_CONSTRAINT): Likewise.
	(PREFERRED_RELOAD_CLASS): Likewise.
	(LEGITIMIZE_ADDRESS): Update for alpha_legitimize_address change.
	(PREDICATE_CODES): Update.
	* config/alpha/alpha.md: New post-reload splitters to convert
	simplfied symbolic operands to the form that references $29.
	(divide expanders): Use emit_move_insn, not gen_movdi_er_high_g.
	(movdi_er_nofix, movdi_er_fix): Accept any symbolic operand.

From-SVN: r48531
parent 1eaea054
2002-01-04 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.c (some_operand): Accept HIGH.
(input_operand): Likewise; accept simple references to globals.
(alpha_const_ok_for_letter_p): New, outlined from alpha.h.
(alpha_const_double_ok_for_letter_p): Likewise.
(alpha_extra_constraint): Likewise.
(alpha_preferred_reload_class): Likewise. Do not force
symbolic constants to memory.
(alpha_legitimate_address_p): Accept simple references
to small_symbolic_operand.
(alpha_legitimize_address): New arg scratch. Be prepared to be
called when no_new_pseudos. Emit simple symbolic references.
Split integers into low, high, and rest.
(alpha_expand_mov): Use alpha_legitimize_address.
(some_small_symbolic_mem_operand): New.
(split_small_symbolic_mem_operand): New.
* config/alpha/alpha-protos.h: Update.
* config/alpha/alpha.h (CONST_OK_FOR_LETTER_P): Out-line.
(CONST_DOUBLE_OK_FOR_LETTER_P): Likewise.
(EXTRA_CONSTRAINT): Likewise.
(PREFERRED_RELOAD_CLASS): Likewise.
(LEGITIMIZE_ADDRESS): Update for alpha_legitimize_address change.
(PREDICATE_CODES): Update.
* config/alpha/alpha.md: New post-reload splitters to convert
simplfied symbolic operands to the form that references $29.
(divide expanders): Use emit_move_insn, not gen_movdi_er_high_g.
(movdi_er_nofix, movdi_er_fix): Accept any symbolic operand.
2002-01-03 Richard Henderson <rth@redhat.com>
* local-alloc.c (function_invariant_p): Update commentary.
......
......@@ -59,6 +59,7 @@ extern int current_file_function_operand PARAMS ((rtx, enum machine_mode));
extern int direct_call_operand PARAMS ((rtx, enum machine_mode));
extern int local_symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int small_symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int some_small_symbolic_mem_operand PARAMS ((rtx, enum machine_mode));
extern int global_symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int call_operand PARAMS ((rtx, enum machine_mode));
extern int symbolic_operand PARAMS ((rtx, enum machine_mode));
......@@ -77,6 +78,10 @@ extern int normal_memory_operand PARAMS ((rtx, enum machine_mode));
extern int reg_no_subreg_operand PARAMS ((rtx, enum machine_mode));
extern int addition_operation PARAMS ((rtx, enum machine_mode));
extern bool alpha_const_ok_for_letter_p PARAMS ((HOST_WIDE_INT, int));
extern bool alpha_const_double_ok_for_letter_p PARAMS ((rtx, int));
extern bool alpha_extra_constraint PARAMS ((rtx, int));
extern rtx alpha_tablejump_addr_vec PARAMS ((rtx));
extern rtx alpha_tablejump_best_label PARAMS ((rtx));
......@@ -85,11 +90,16 @@ extern rtx alpha_legitimize_address PARAMS ((rtx, rtx, enum machine_mode));
extern rtx alpha_legitimize_reload_address PARAMS ((rtx, enum machine_mode,
int, int, int));
extern rtx split_small_symbolic_mem_operand PARAMS ((rtx));
extern void get_aligned_mem PARAMS ((rtx, rtx *, rtx *));
extern rtx get_unaligned_address PARAMS ((rtx, int));
extern enum reg_class alpha_preferred_reload_class PARAMS ((rtx,
enum reg_class));
extern enum reg_class secondary_reload_class PARAMS ((enum reg_class,
enum machine_mode,
rtx, int));
extern void alpha_set_memflags PARAMS ((rtx, rtx));
extern rtx alpha_emit_set_const PARAMS ((rtx, enum machine_mode,
HOST_WIDE_INT, int));
......
......@@ -812,17 +812,7 @@ enum reg_class {
`O' is used for negated 8-bit constants.
`P' is used for the constants 1, 2 and 3. */
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
((C) == 'I' ? (unsigned HOST_WIDE_INT) (VALUE) < 0x100 \
: (C) == 'J' ? (VALUE) == 0 \
: (C) == 'K' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \
: (C) == 'L' ? (((VALUE) & 0xffff) == 0 \
&& (((VALUE)) >> 31 == -1 || (VALUE) >> 31 == 0)) \
: (C) == 'M' ? zap_mask (VALUE) \
: (C) == 'N' ? (unsigned HOST_WIDE_INT) (~ (VALUE)) < 0x100 \
: (C) == 'O' ? (unsigned HOST_WIDE_INT) (- (VALUE)) < 0x100 \
: (C) == 'P' ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 3 \
: 0)
#define CONST_OK_FOR_LETTER_P alpha_const_ok_for_letter_p
/* Similar, but for floating or large integer constants, and defining letters
G and H. Here VALUE is the CONST_DOUBLE rtx itself.
......@@ -830,13 +820,7 @@ enum reg_class {
For Alpha, `G' is the floating-point constant zero. `H' is a CONST_DOUBLE
that is the operand of a ZAP insn. */
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
&& (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
: (C) == 'H' ? (GET_MODE (VALUE) == VOIDmode \
&& zap_mask (CONST_DOUBLE_LOW (VALUE)) \
&& zap_mask (CONST_DOUBLE_HIGH (VALUE))) \
: 0)
#define CONST_DOUBLE_OK_FOR_LETTER_P alpha_const_double_ok_for_letter_p
/* Optional extra constraints for this machine.
......@@ -848,31 +832,18 @@ enum reg_class {
'S' is a 6-bit constant (valid for a shift insn).
'T' is a HIGH.
'U' is a symbolic operand. */
#define EXTRA_CONSTRAINT(OP, C) \
((C) == 'Q' ? normal_memory_operand (OP, VOIDmode) \
: (C) == 'R' ? direct_call_operand (OP, Pmode) \
: (C) == 'S' ? (GET_CODE (OP) == CONST_INT \
&& (unsigned HOST_WIDE_INT) INTVAL (OP) < 64) \
: (C) == 'T' ? GET_CODE (OP) == HIGH \
: (TARGET_ABI_UNICOSMK && (C) == 'U') \
? symbolic_operand (OP, VOIDmode) \
: 0)
#define EXTRA_CONSTRAINT alpha_extra_constraint
/* Given an rtx X being reloaded into a reg required to be
in class CLASS, return the class of reg to actually use.
In general this is just CLASS; but on some machines
in some cases it is preferable to use a more restrictive class.
On the Alpha, all constants except zero go into a floating-point
register via memory. */
in some cases it is preferable to use a more restrictive class. */
#define PREFERRED_RELOAD_CLASS(X, CLASS) \
(CONSTANT_P (X) && (X) != const0_rtx && (X) != CONST0_RTX (GET_MODE (X)) \
? ((CLASS) == FLOAT_REGS || (CLASS) == NO_REGS ? NO_REGS \
: (CLASS) == ALL_REGS ? GENERAL_REGS : (CLASS)) \
: (CLASS))
#define PREFERRED_RELOAD_CLASS alpha_preferred_reload_class
/* Loading and storing HImode or QImode values to and from memory
usually requires a scratch register. The exceptions are loading
......@@ -1479,14 +1450,14 @@ do { \
to be legitimate. If we find one, return the new, valid address.
This macro is used in only one place: `memory_address' in explow.c. */
#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
do { \
rtx new_x = alpha_legitimize_address (X, OLDX, MODE); \
if (new_x) \
{ \
X = new_x; \
goto WIN; \
} \
#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
do { \
rtx new_x = alpha_legitimize_address (X, NULL_RTX, MODE); \
if (new_x) \
{ \
X = new_x; \
goto WIN; \
} \
} while (0)
/* Try a machine-dependent way of reloading an illegitimate address
......@@ -2117,9 +2088,9 @@ do { \
{"global_symbolic_operand", {SYMBOL_REF, CONST}}, \
{"call_operand", {REG, SYMBOL_REF}}, \
{"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
SYMBOL_REF, CONST, LABEL_REF}}, \
SYMBOL_REF, CONST, LABEL_REF, HIGH}}, \
{"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
SYMBOL_REF, CONST, LABEL_REF}}, \
SYMBOL_REF, CONST, LABEL_REF, HIGH}}, \
{"some_ni_operand", {SUBREG, REG, MEM}}, \
{"aligned_memory_operand", {MEM}}, \
{"unaligned_memory_operand", {MEM}}, \
......@@ -2130,7 +2101,9 @@ do { \
{"reg_not_elim_operand", {SUBREG, REG}}, \
{"reg_no_subreg_operand", {REG}}, \
{"addition_operation", {PLUS}}, \
{"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}},
{"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST}}, \
{"some_small_symbolic_mem_operand", {MEM, SIGN_EXTEND, ZERO_EXTEND, \
FLOAT_EXTEND}},
/* Define the `__builtin_va_list' type for the ABI. */
#define BUILD_VA_LIST_TYPE(VALIST) \
......
......@@ -649,6 +649,14 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
"TARGET_EXPLICIT_RELOCS"
"ldah %0,%2(%1)\t\t!gprelhigh")
(define_split
[(set (match_operand:DI 0 "register_operand" "")
(high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
"TARGET_EXPLICIT_RELOCS && reload_completed"
[(set (match_dup 0)
(plus:DI (match_dup 2) (high:DI (match_dup 1))))]
"operands[2] = pic_offset_table_rtx;")
;; We used to expend quite a lot of effort choosing addq/subq/lda.
;; With complications like
;;
......@@ -1225,9 +1233,7 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
default:
abort ();
}
emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
gen_rtx_SYMBOL_REF (DImode, str),
const0_rtx));
emit_move_insn (operands[0], gen_rtx_SYMBOL_REF (DImode, str));
}
[(set_attr "type" "jsr")
(set_attr "length" "8")])
......@@ -1290,9 +1296,7 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
default:
abort ();
}
emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
gen_rtx_SYMBOL_REF (DImode, str),
const0_rtx));
emit_move_insn (operands[0], gen_rtx_SYMBOL_REF (DImode, str));
}
[(set_attr "type" "jsr")
(set_attr "length" "8")])
......@@ -5459,7 +5463,39 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
return "lda %0,%2(%1)\t\t!gprellow";
})
(define_insn "movdi_er_high_g"
(define_split
[(set (match_operand:DI 0 "register_operand" "")
(match_operand:DI 1 "small_symbolic_operand" ""))]
"TARGET_EXPLICIT_RELOCS && reload_completed"
[(set (match_dup 0)
(lo_sum:DI (match_dup 2) (match_dup 1)))]
"operands[2] = pic_offset_table_rtx;")
(define_split
[(set (match_operand:DI 0 "register_operand" "")
(match_operand:DI 1 "local_symbolic_operand" ""))]
"TARGET_EXPLICIT_RELOCS && reload_completed"
[(set (match_dup 0)
(plus:DI (match_dup 2) (high:DI (match_dup 1))))
(set (match_dup 0)
(lo_sum:DI (match_dup 0) (match_dup 1)))]
"operands[2] = pic_offset_table_rtx;")
(define_split
[(set (match_operand 0 "some_small_symbolic_mem_operand" "")
(match_operand 1 "" ""))]
"TARGET_EXPLICIT_RELOCS && reload_completed"
[(set (match_dup 0) (match_dup 1))]
"operands[0] = split_small_symbolic_mem_operand (operands[0]);")
(define_split
[(set (match_operand 0 "" "")
(match_operand 1 "some_small_symbolic_mem_operand" ""))]
"TARGET_EXPLICIT_RELOCS && reload_completed"
[(set (match_dup 0) (match_dup 1))]
"operands[1] = split_small_symbolic_mem_operand (operands[1]);")
(define_insn "*movdi_er_high_g"
[(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(match_operand:DI 1 "register_operand" "r")
(match_operand:DI 2 "global_symbolic_operand" "")
......@@ -5469,9 +5505,19 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
"ldq %0,%2(%1)\t\t!literal"
[(set_attr "type" "ldsym")])
(define_split
[(set (match_operand:DI 0 "register_operand" "")
(match_operand:DI 1 "global_symbolic_operand" ""))]
"TARGET_EXPLICIT_RELOCS && reload_completed"
[(set (match_dup 0)
(unspec:DI [(match_dup 2)
(match_dup 1)
(const_int 0)] UNSPEC_LITERAL))]
"operands[2] = pic_offset_table_rtx;")
(define_insn "*movdi_er_nofix"
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q")
(match_operand:DI 1 "input_operand" "rJ,K,L,T,m,rJ,*fJ,Q,*f"))]
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
(match_operand:DI 1 "input_operand" "rJ,K,L,T,s,m,rJ,*fJ,Q,*f"))]
"TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
&& (register_operand (operands[0], DImode)
|| reg_or_0_operand (operands[1], DImode))"
......@@ -5479,13 +5525,14 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
mov %r1,%0
lda %0,%1($31)
ldah %0,%h1($31)
ldah %0,%H1
#
#
ldq%A1 %0,%1
stq%A0 %r1,%0
fmov %R1,%0
ldt %0,%1
stt %R1,%0"
[(set_attr "type" "ilog,iadd,iadd,iadd,ild,ist,fcpys,fld,fst")])
[(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
;; have been split up by the rules above but we shouldn't reject the
......@@ -5512,8 +5559,10 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
(set_attr "length" "*,*,*,16,*,*,*,*,*,*")])
(define_insn "*movdi_er_fix"
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
(match_operand:DI 1 "input_operand" "rJ,K,L,T,m,rJ,*fJ,Q,*f,*f,r"))]
[(set (match_operand:DI 0 "nonimmediate_operand"
"=r,r,r,r,r,r, m, *f,*f, Q, r,*f")
(match_operand:DI 1 "input_operand"
"rJ,K,L,T,s,m,rJ,*fJ, Q,*f,*f, r"))]
"TARGET_EXPLICIT_RELOCS && TARGET_FIX
&& (register_operand (operands[0], DImode)
|| reg_or_0_operand (operands[1], DImode))"
......@@ -5521,7 +5570,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
mov %r1,%0
lda %0,%1($31)
ldah %0,%h1($31)
ldah %0,%H1
#
#
ldq%A1 %0,%1
stq%A0 %r1,%0
fmov %R1,%0
......@@ -5529,7 +5579,7 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
stt %R1,%0
ftoit %1,%0
itoft %1,%0"
[(set_attr "type" "ilog,iadd,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
[(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
(define_insn "*movdi_fix"
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment