This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
remove a little bit of x86 regalloc hackery
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 Jan 2005 01:26:29 -0800
- Subject: remove a little bit of x86 regalloc hackery
While doing some assembly reading recently, it became apparent that
the hackery we've got in the i386 backend trying to give the register
allocator more freedom is really screwing us.
Given,
(set (reg/v:SF 59 [ x ])
(mem/i:SF (reg/f:SI 16 argp) [0 x+0 S4 A32])) 60 {*movsf_1}
(parallel [
(set (reg:SF 61)
(abs:SF (reg/v:SF 59 [ x ])))
(use (const_int 0 [0x0]))
(clobber (reg:CC 17 flags))
]) 250 {*absnegsf2_i387}
(parallel [
(set (reg:SF 63)
(neg:SF (reg:SF 61)))
(use (const_int 0 [0x0]))
(clobber (reg:CC 17 flags))
]) 250 {*absnegsf2_i387}
Before:
Register 59 pref FLOAT_INT_REGS or none
Register 61 pref FP_TOP_REG, else FLOAT_INT_REGS
Register 63 pref FLOAT_INT_REGS or none
Note that regclass is doing exactly what we had told it. It found the
union of the two classes in "f#r". Except that, with the way our
register allocator works, we will choose the first register in the
class, in REG_ALLOC_ORDER, that is free. Which is quite often an
integer register. Which, for floating point values, is stupid.
What we actually want the register allocator to do is to choose a fp
register, and if we run out of those, then choose a general register.
After:
Register 59 pref FLOAT_INT_REGS or none
Register 61 pref FP_TOP_REG, else INDEX_REGS
Register 63 pref FLOAT_REGS, else INDEX_REGS
Which is exactly what we get if we play no tricks at all.
r~
* config/i386/i386.c (absnegsf2_mixed): Remove all of the # hackery.
(absnegsf2_sse, absnegsf2_i387, absnegdf2_mixed, absnegdf2_sse,
absnegdf2_i387, absnegxf2_i387): Likewise.
Index: gcc/config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.616
diff -u -p -d -r1.616 i386.md
--- gcc/config/i386/i386.md 30 Jan 2005 17:48:01 -0000 1.616
+++ gcc/config/i386/i386.md 31 Jan 2005 08:57:42 -0000
@@ -9422,27 +9422,27 @@
"ix86_expand_fp_absneg_operator (ABS, SFmode, operands); DONE;")
(define_insn "*absnegsf2_mixed"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=x#f,x#f,f#x,rm")
(match_operator:SF 3 "absneg_operator"
- [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#fr,0 ,0")]))
- (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X ,X"))
+ [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#f,0 ,0")]))
+ (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X ,X"))
(clobber (reg:CC FLAGS_REG))]
"TARGET_SSE_MATH && TARGET_MIX_SSE_I387
&& ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
"#")
(define_insn "*absnegsf2_sse"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=x#r,x#r,rm#x")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=x,x,rm")
(match_operator:SF 3 "absneg_operator"
- [(match_operand:SF 1 "nonimmediate_operand" "0 ,x#r,0")]))
- (use (match_operand:V4SF 2 "nonimmediate_operand" "xm ,0 ,X"))
+ [(match_operand:SF 1 "nonimmediate_operand" "0 ,x,0")]))
+ (use (match_operand:V4SF 2 "nonimmediate_operand" "xm,0,X"))
(clobber (reg:CC FLAGS_REG))]
"TARGET_SSE_MATH
&& ix86_unary_operator_ok (GET_CODE (operands[3]), SFmode, operands)"
"#")
(define_insn "*absnegsf2_i387"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=f#r,rm#f")
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=f,rm")
(match_operator:SF 3 "absneg_operator"
[(match_operand:SF 1 "nonimmediate_operand" "0,0")]))
(use (match_operand 2 "" ""))
@@ -9518,27 +9518,27 @@
"ix86_expand_fp_absneg_operator (ABS, DFmode, operands); DONE;")
(define_insn "*absnegdf2_mixed"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf")
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#f,Y#f,f#Y,rm")
(match_operator:DF 3 "absneg_operator"
- [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#fr,0 ,0")]))
- (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X ,X"))
+ [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#f,0 ,0")]))
+ (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X ,X"))
(clobber (reg:CC FLAGS_REG))]
"TARGET_SSE2 && TARGET_SSE_MATH && TARGET_MIX_SSE_I387
&& ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
"#")
(define_insn "*absnegdf2_sse"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#r,Y#r,rm#Y")
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,Y,rm")
(match_operator:DF 3 "absneg_operator"
- [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y#r,0")]))
- (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym ,0 ,X"))
+ [(match_operand:DF 1 "nonimmediate_operand" "0 ,Y,0")]))
+ (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,X"))
(clobber (reg:CC FLAGS_REG))]
"TARGET_SSE2 && TARGET_SSE_MATH
&& ix86_unary_operator_ok (GET_CODE (operands[3]), DFmode, operands)"
"#")
(define_insn "*absnegdf2_i387"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=f#r,rm#f")
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=f,rm")
(match_operator:DF 3 "absneg_operator"
[(match_operand:DF 1 "nonimmediate_operand" "0,0")]))
(use (match_operand 2 "" ""))
@@ -9614,7 +9614,7 @@
"ix86_expand_fp_absneg_operator (ABS, XFmode, operands); DONE;")
(define_insn "*absnegxf2_i387"
- [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f")
+ [(set (match_operand:XF 0 "nonimmediate_operand" "=f,?rm")
(match_operator:XF 3 "absneg_operator"
[(match_operand:XF 1 "nonimmediate_operand" "0,0")]))
(use (match_operand 2 "" ""))