aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@freesoft.cz>2000-01-04 15:44:03 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2000-01-04 14:44:03 +0000
commitd7a2940444f631047d220da22884d19c69984aaf (patch)
tree6e0eb21d8b3748e75a902332e47aa2b50ede898a
parent28cefcd2b6d1d5c7a7683f8c72def31fcc30b89e (diff)
downloadgcc-d7a2940444f631047d220da22884d19c69984aaf.zip
gcc-d7a2940444f631047d220da22884d19c69984aaf.tar.gz
gcc-d7a2940444f631047d220da22884d19c69984aaf.tar.bz2
i386.c (ix86_expand_move): Allow pushes of memory, offload to memory all FP constants for constant->reg moves.
* i386.c (ix86_expand_move): Allow pushes of memory, offload to memory all FP constants for constant->reg moves. (ix86_split_to_parts): Try to convert memory address into immediate when available in the constant pool. * i386.h (PREFERRED_RELOAD_CLASS): Allow CONST_DOUBLE->integer reg moves. (LEGITIMATE_CONSTANT_P): Return 1. * i386.md (pushsf): New splitter to convert constant pool memory reference to immediate. (mov?f): Likewise; do not allow CONST_DOUBLE for reg moves before reload. From-SVN: r31203
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/i386/i386.c23
-rw-r--r--gcc/config/i386/i386.h13
-rw-r--r--gcc/config/i386/i386.md100
4 files changed, 119 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7ff670c..a879274 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+Tue Jan 4 15:34:34 MET 2000 Jan Hubicka <hubicka@freesoft.cz>
+
+ * i386.c (ix86_expand_move): Allow pushes of memory, offload to memory
+ all FP constants for constant->reg moves.
+ (ix86_split_to_parts): Try to convert memory address into immediate
+ when available in the constant pool.
+ * i386.h (PREFERRED_RELOAD_CLASS): Allow CONST_DOUBLE->integer reg
+ moves.
+ (LEGITIMATE_CONSTANT_P): Return 1.
+ * i386.md (pushsf): New splitter to convert constant pool memory
+ reference to immediate.
+ (mov?f): Likewise; do not allow CONST_DOUBLE for reg moves before
+ reload.
+
2000-01-04 Bernd Schmidt <bernds@cygnus.co.uk>
* i386.md (ashlsi3_cmpno): Don't accept variables shifts.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 091e734..47460f0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3690,21 +3690,22 @@ ix86_expand_move (mode, operands)
}
else
{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
+ if (GET_CODE (operands[0]) == MEM
+ && (GET_MODE (operands[0]) == QImode
+ || !push_operand (operands[0], mode))
+ && GET_CODE (operands[1]) == MEM)
operands[1] = force_reg (mode, operands[1]);
if (FLOAT_MODE_P (mode))
{
- /* If we are loading a floating point constant that isn't 0 or 1
- into a register, force the value to memory now, since we'll
- get better code out the back end. */
+ /* If we are loading a floating point constant to a register,
+ force the value to memory now, since we'll get better code
+ out the back end. */
if (strict)
;
- else if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (mode, operands[1]);
else if (GET_CODE (operands[1]) == CONST_DOUBLE
- && ! standard_80387_constant_p (operands[1]))
+ && register_operand (operands[0], mode))
operands[1] = validize_mem (force_const_mem (mode, operands[1]));
}
}
@@ -4759,6 +4760,14 @@ ix86_split_to_parts (operand, parts, mode)
if (size < 2 || size > 3)
abort ();
+ /* Optimize constant pool reference to immediates. This is used by fp moves,
+ that force all constants to memory to allow combining. */
+
+ if (GET_CODE (operand) == MEM
+ && GET_CODE (XEXP (operand, 0)) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (XEXP (operand, 0)))
+ operand = get_pool_constant (XEXP (operand, 0));
+
if (GET_CODE (operand) == MEM && !offsettable_memref_p (operand))
{
/* The only non-offsetable memories we handle are pushes. */
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 1d911f0..7d5fd29 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler for IA-32.
- Copyright (C) 1988, 92, 94-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1988, 92, 94-99, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -1004,11 +1004,11 @@ enum reg_class
#define PREFERRED_RELOAD_CLASS(X,CLASS) \
(GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode \
? (standard_80387_constant_p (X) \
- ? reg_class_subset_p (CLASS, FLOAT_REGS) ? CLASS : FLOAT_REGS \
- : NO_REGS) \
+ ? CLASS \
+ : (reg_class_subset_p (CLASS, FLOAT_REGS) \
+ ? NO_REGS \
+ : reg_class_subset_p (CLASS, GENERAL_REGS) ? CLASS : GENERAL_REGS)) \
: GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
- : ((CLASS) == ALL_REGS \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \
: (CLASS))
/* If we are copying between general and FP registers, we need a memory
@@ -1525,8 +1525,7 @@ do { \
/* Nonzero if the constant value X is a legitimate general operand.
It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_CODE (X) == CONST_DOUBLE ? standard_80387_constant_p (X) : 1)
+#define LEGITIMATE_CONSTANT_P(X) 1
#ifdef REG_OK_STRICT
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 95bc075..3addccb 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1662,7 +1662,7 @@
(define_insn "*pushdi"
[(set (match_operand:DI 0 "push_operand" "=<")
- (match_operand:DI 1 "nonmemory_operand" "riF"))]
+ (match_operand:DI 1 "general_operand" "riF*m"))]
""
"#")
@@ -1721,6 +1721,18 @@
}"
[(set_attr "type" "multi,push")])
+(define_split
+ [(set (match_operand:SF 0 "push_operand" "")
+ (match_operand:SF 1 "memory_operand" ""))]
+ "reload_completed
+ && GET_CODE (operands[1]) == MEM
+ && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+ [(set (match_dup 0)
+ (match_dup 1))]
+ "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+
+
;; %%% Kill this when call knows how to work this out.
(define_split
[(set (match_operand:SF 0 "push_operand" "")
@@ -1732,7 +1744,10 @@
(define_insn "*movsf_1"
[(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,m")
(match_operand:SF 1 "general_operand" "fm#r,f#r,G,rmF#f,Fr#f"))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
+ "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
+ && (reload_in_progress || reload_completed
+ || GET_CODE (operands[1]) != CONST_DOUBLE
+ || memory_operand (operands[0], SFmode))"
"*
{
switch (which_alternative)
@@ -1772,6 +1787,21 @@
}"
[(set_attr "type" "fmov,fmov,fmov,imov,imov")])
+(define_split
+ [(set (match_operand:SF 0 "general_operand" "")
+ (match_operand:SF 1 "memory_operand" ""))]
+ "reload_completed
+ && GET_CODE (operands[1]) == MEM
+ && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))
+ && (!(FP_REG_P (operands[0]) ||
+ (GET_CODE (operands[0]) == SUBREG
+ && FP_REG_P (SUBREG_REG (operands[0]))))
+ || standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0))))"
+ [(set (match_dup 0)
+ (match_dup 1))]
+ "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+
(define_insn "swapsf"
[(set (match_operand:SF 0 "register_operand" "+f")
(match_operand:SF 1 "register_operand" "+f"))
@@ -1849,7 +1879,10 @@
[(set (match_operand:DF 0 "nonimmediate_operand" "=f,m,f,*r,o")
(match_operand:DF 1 "general_operand" "fm,f,G,*roF,F*r"))]
"(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- && optimize_size"
+ && optimize_size
+ && (reload_in_progress || reload_completed
+ || GET_CODE (operands[1]) != CONST_DOUBLE
+ || memory_operand (operands[0], DFmode))"
"*
{
switch (which_alternative)
@@ -1893,7 +1926,10 @@
[(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
(match_operand:DF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
"(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- && !optimize_size"
+ && !optimize_size
+ && (reload_in_progress || reload_completed
+ || GET_CODE (operands[1]) != CONST_DOUBLE
+ || memory_operand (operands[0], DFmode))"
"*
{
switch (which_alternative)
@@ -1948,6 +1984,18 @@
(set (match_dup 3) (match_dup 6))]
"if (ix86_split_long_move (operands)) DONE;")
+(define_split
+ [(set (match_operand:DF 0 "register_operand" "")
+ (match_operand:DF 1 "memory_operand" ""))]
+ "reload_completed
+ && GET_CODE (operands[1]) == MEM
+ && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))
+ && standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0)))"
+ [(set (match_dup 0)
+ (match_dup 1))]
+ "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+
(define_insn "swapdf"
[(set (match_operand:DF 0 "register_operand" "+f")
(match_operand:DF 1 "register_operand" "+f"))
@@ -2051,7 +2099,10 @@
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o")
(match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))]
"(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- && optimize_size"
+ && optimize_size
+ && (reload_in_progress || reload_completed
+ || GET_CODE (operands[1]) != CONST_DOUBLE
+ || memory_operand (operands[0], XFmode))"
"*
{
switch (which_alternative)
@@ -2094,7 +2145,10 @@
[(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o")
(match_operand:XF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))]
"(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- && !optimize_size"
+ && !optimize_size
+ && (reload_in_progress || reload_completed
+ || GET_CODE (operands[1]) != CONST_DOUBLE
+ || memory_operand (operands[0], XFmode))"
"*
{
switch (which_alternative)
@@ -2149,6 +2203,18 @@
(set (match_dup 4) (match_dup 7))]
"if (ix86_split_long_move (operands)) DONE;")
+(define_split
+ [(set (match_operand:XF 0 "register_operand" "")
+ (match_operand:XF 1 "memory_operand" ""))]
+ "reload_completed
+ && GET_CODE (operands[1]) == MEM
+ && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))
+ && standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0)))"
+ [(set (match_dup 0)
+ (match_dup 1))]
+ "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+
(define_insn "swapxf"
[(set (match_operand:XF 0 "register_operand" "+f")
(match_operand:XF 1 "register_operand" "+f"))
@@ -2380,7 +2446,7 @@
(sign_extend:DI (match_operand:SI 1 "register_operand" "")))
(clobber (match_operand:SI 2 "register_operand" ""))
(clobber (reg:CC 17))]
- "(flow2_completed
+ "(reload_completed
&& dead_or_set_p (insn, operands[1])
&& !reg_mentioned_p (operands[1], operands[0]))"
[(set (match_dup 3) (match_dup 1))
@@ -2395,7 +2461,7 @@
(sign_extend:DI (match_operand:SI 1 "register_operand" "")))
(clobber (match_operand:SI 2 "register_operand" ""))
(clobber (reg:CC 17))]
- "flow2_completed"
+ "reload_completed"
[(const_int 0)]
"
{
@@ -3119,7 +3185,7 @@
(plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
(match_operand:DI 2 "general_operand" "")))
(clobber (reg:CC 17))]
- "cse_not_expected"
+ "reload_completed"
[(parallel [(set (reg:CC 17) (plus:CC (match_dup 1) (match_dup 2)))
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
(parallel [(set (match_dup 3)
@@ -3620,7 +3686,7 @@
(minus:DI (match_operand:DI 1 "nonimmediate_operand" "")
(match_operand:DI 2 "general_operand" "")))
(clobber (reg:CC 17))]
- "cse_not_expected"
+ "reload_completed"
[(parallel [(set (reg:CC 17) (minus:CC (match_dup 1) (match_dup 2)))
(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))])
(parallel [(set (match_dup 3)
@@ -4798,7 +4864,7 @@
[(set (match_operand:DI 0 "nonimmediate_operand" "")
(neg:DI (match_operand:DI 1 "general_operand" "")))
(clobber (reg:CC 17))]
- "cse_not_expected"
+ "reload_completed"
[(parallel
[(set (reg:CCNO 17)
(compare:CCNO (neg:SI (match_dup 2)) (const_int 0)))
@@ -5458,7 +5524,7 @@
(match_operand:QI 2 "nonmemory_operand" "")))
(clobber (match_scratch:SI 3 ""))
(clobber (reg:CC 17))]
- "TARGET_CMOVE && cse_not_expected"
+ "TARGET_CMOVE && reload_completed"
[(const_int 0)]
"ix86_split_ashldi (operands, operands[3]); DONE;")
@@ -5467,7 +5533,7 @@
(ashift:DI (match_operand:DI 1 "register_operand" "")
(match_operand:QI 2 "nonmemory_operand" "")))
(clobber (reg:CC 17))]
- "cse_not_expected"
+ "reload_completed"
[(const_int 0)]
"ix86_split_ashldi (operands, NULL_RTX); DONE;")
@@ -5842,7 +5908,7 @@
(match_operand:QI 2 "nonmemory_operand" "")))
(clobber (match_scratch:SI 3 ""))
(clobber (reg:CC 17))]
- "TARGET_CMOVE && cse_not_expected"
+ "TARGET_CMOVE && reload_completed"
[(const_int 0)]
"ix86_split_ashrdi (operands, operands[3]); DONE;")
@@ -5851,7 +5917,7 @@
(ashiftrt:DI (match_operand:DI 1 "register_operand" "")
(match_operand:QI 2 "nonmemory_operand" "")))
(clobber (reg:CC 17))]
- "cse_not_expected"
+ "reload_completed"
[(const_int 0)]
"ix86_split_ashrdi (operands, NULL_RTX); DONE;")
@@ -6062,7 +6128,7 @@
(match_operand:QI 2 "nonmemory_operand" "")))
(clobber (match_scratch:SI 3 ""))
(clobber (reg:CC 17))]
- "TARGET_CMOVE && cse_not_expected"
+ "TARGET_CMOVE && reload_completed"
[(const_int 0)]
"ix86_split_lshrdi (operands, operands[3]); DONE;")
@@ -6071,7 +6137,7 @@
(lshiftrt:DI (match_operand:DI 1 "register_operand" "")
(match_operand:QI 2 "nonmemory_operand" "")))
(clobber (reg:CC 17))]
- "cse_not_expected"
+ "reload_completed"
[(const_int 0)]
"ix86_split_lshrdi (operands, NULL_RTX); DONE;")