public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Fix inconsistency in LEA splitters
@ 2011-07-26 16:56 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2011-07-26 16:56 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Hello!

Using mode iterator, we can use x86_64_nonmemory_operand where
appropriate and remove extra pattern (and ??? comment) on the way.

2011-07-26  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (add->lea splitter): Implement using SWI
	mode iterator.  Change operand 2 predicate to <nonmemory_operand>.
	(add->lea zext splitter): Change operand 2 predicate to
	x86_64_nonmemory_operand.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,
-m32}. Committed to mainline SVN.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 2329 bytes --]

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 176790)
+++ config/i386/i386.md	(working copy)
@@ -5805,17 +5805,14 @@
 
 ;; Convert add to the lea pattern to avoid flags dependency.
 (define_split
-  [(set (match_operand 0 "register_operand" "")
-	(plus (match_operand 1 "register_operand" "")
-              (match_operand 2 "nonmemory_operand" "")))
+  [(set (match_operand:SWI 0 "register_operand" "")
+	(plus (match_operand:SWI 1 "register_operand" "")
+              (match_operand:SWI 2 "<nonmemory_operand>" "")))
    (clobber (reg:CC FLAGS_REG))]
-  "GET_MODE (operands[0]) == GET_MODE (operands[1])
-   && (GET_MODE (operands[0]) == GET_MODE (operands[2])
-       || GET_MODE (operands[2]) == VOIDmode)
-   && reload_completed && ix86_lea_for_add_ok (insn, operands)" 
+  "reload_completed && ix86_lea_for_add_ok (insn, operands)" 
   [(const_int 0)]
 {
-  enum machine_mode mode = GET_MODE (operands[0]);
+  enum machine_mode mode = <MODE>mode;
   rtx pat;
 
   if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (SImode))
@@ -5833,27 +5830,13 @@
 })
 
 ;; Convert add to the lea pattern to avoid flags dependency.
-;; ??? This pattern handles immediate operands that do not satisfy immediate
-;; operand predicate (TARGET_LEGITIMATE_CONSTANT_P) in the previous pattern.
 (define_split
   [(set (match_operand:DI 0 "register_operand" "")
-	(plus:DI (match_operand:DI 1 "register_operand" "")
-		 (match_operand:DI 2 "x86_64_immediate_operand" "")))
-   (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && reload_completed 
-   && true_regnum (operands[0]) != true_regnum (operands[1])"
-  [(set (match_dup 0)
-	(plus:DI (match_dup 1) (match_dup 2)))])
-
-;; Convert add to the lea pattern to avoid flags dependency.
-(define_split
-  [(set (match_operand:DI 0 "register_operand" "")
 	(zero_extend:DI
 	  (plus:SI (match_operand:SI 1 "register_operand" "")
-		   (match_operand:SI 2 "nonmemory_operand" ""))))
+		   (match_operand:SI 2 "x86_64_nonmemory_operand" ""))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && reload_completed
-   && ix86_lea_for_add_ok (insn, operands)"
+  "TARGET_64BIT && reload_completed && ix86_lea_for_add_ok (insn, operands)"
   [(set (match_dup 0)
 	(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))])
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-26 16:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 16:56 [PATCH, i386]: Fix inconsistency in LEA splitters Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).