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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144098
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
(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
(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")
+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
--- /dev/null
+/* { 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\]" } } */