mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-08 01:10:17 +08:00
i386.md: Add two new peephole2 to avoid mov followed by arithmetic with memory operands.
gcc: 2009-02-06 Paolo Bonzini <bonzini@gnu.org> * config/i386/i386.md: Add two new peephole2 to avoid mov followed by arithmetic with memory operands. * config/i386/predicates.md (commutative_operator): New. gcc/testsuite: 2009-02-06 Paolo Bonzini <bonzini@gnu.org> * gcc.target/i386/pr38824.c: New testcase. From-SVN: r144098
This commit is contained in:
parent
bfbe1b687b
commit
bab64f23e9
@ -1,3 +1,9 @@
|
||||
2009-02-11 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* config/i386/i386.md: Add two new peephole2 to avoid mov followed
|
||||
by arithmetic with memory operands.
|
||||
* config/i386/predicates.md (commutative_operator): New.
|
||||
|
||||
2009-02-10 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* doc/extend.texi (Fixed-Point Types): Break long paragraphs into
|
||||
|
@ -20706,6 +20706,38 @@
|
||||
(clobber (reg:CC FLAGS_REG))])]
|
||||
"")
|
||||
|
||||
;; Prefer Load+RegOp to Mov+MemOp. Watch out for cases when the memory address
|
||||
;; refers to the destination of the load!
|
||||
|
||||
(define_peephole2
|
||||
[(set (match_operand:SI 0 "register_operand" "")
|
||||
(match_operand:SI 1 "register_operand" ""))
|
||||
(parallel [(set (match_dup 0)
|
||||
(match_operator:SI 3 "commutative_operator"
|
||||
[(match_dup 0)
|
||||
(match_operand:SI 2 "memory_operand" "")]))
|
||||
(clobber (reg:CC FLAGS_REG))])]
|
||||
"operands[0] != operands[1]"
|
||||
[(set (match_dup 0) (match_dup 4))
|
||||
(parallel [(set (match_dup 0)
|
||||
(match_op_dup 3 [(match_dup 0) (match_dup 1)]))
|
||||
(clobber (reg:CC FLAGS_REG))])]
|
||||
"operands[4] = simplify_replace_rtx (operands[2], operands[0], operands[1]);")
|
||||
|
||||
(define_peephole2
|
||||
[(set (match_operand 0 "register_operand" "")
|
||||
(match_operand 1 "register_operand" ""))
|
||||
(set (match_dup 0)
|
||||
(match_operator 3 "commutative_operator"
|
||||
[(match_dup 0)
|
||||
(match_operand 2 "memory_operand" "")]))]
|
||||
"operands[0] != operands[1]
|
||||
&& (MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]))"
|
||||
[(set (match_dup 0) (match_dup 2))
|
||||
(set (match_dup 0)
|
||||
(match_op_dup 3 [(match_dup 0) (match_dup 1)]))]
|
||||
"")
|
||||
|
||||
; Don't do logical operations with memory outputs
|
||||
;
|
||||
; These two don't make sense for PPro/PII -- we're expanding a 4-uop
|
||||
|
@ -1050,6 +1050,10 @@
|
||||
(match_code "plus,mult,and,ior,xor,smin,smax,umin,umax,compare,minus,div,
|
||||
mod,udiv,umod,ashift,rotate,ashiftrt,lshiftrt,rotatert"))
|
||||
|
||||
;; Return true for COMMUTATIVE_P.
|
||||
(define_predicate "commutative_operator"
|
||||
(match_code "plus,mult,and,ior,xor,smin,smax,umin,umax"))
|
||||
|
||||
;; Return 1 if OP is a binary operator that can be promoted to wider mode.
|
||||
(define_predicate "promotable_binary_operator"
|
||||
(ior (match_code "plus,and,ior,xor,ashift")
|
||||
|
@ -1,3 +1,7 @@
|
||||
2009-02-11 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* gcc.target/i386/pr38824.c: New testcase.
|
||||
|
||||
2009-02-11 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/38649
|
||||
|
21
gcc/testsuite/gcc.target/i386/pr38824.c
Normal file
21
gcc/testsuite/gcc.target/i386/pr38824.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -msse" } */
|
||||
|
||||
typedef float v4sf __attribute__ ((__vector_size__ (16)));
|
||||
|
||||
void bench_1(float * out, float * in, float f, unsigned int n)
|
||||
{
|
||||
n /= 4;
|
||||
v4sf scalar = { f, f, f, f };
|
||||
do
|
||||
{
|
||||
v4sf arg = *(v4sf *)in;
|
||||
v4sf result = arg + scalar;
|
||||
*(v4sf *) out = result;
|
||||
in += 4;
|
||||
out += 4;
|
||||
}
|
||||
while (--n);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "addps\[^\\n\]*%\[er\]" } } */
|
Loading…
Reference in New Issue
Block a user