This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Canocialize i386.md
- To: rth at cygnus dot com, gcc-patches at gcc dot gnu dot org
- Subject: Canocialize i386.md
- From: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 1 Aug 2000 10:46:14 +0200
Hi
This patch canonicalizes some patterns in i386.md as well as redesigns
the DImode plus/minus code to avoid CCmode arithmetics (that is probably
not well defined). I don't see any purpose why not use default way
using comparions.
Tue Aug 1 00:41:02 CEST 2000 Jan Hubicka <jh@suse.cz>
* i386.md (addsi3_cc, addqi3_cc): Remove.
(adddi expander, addsi3_carry,
subdi expander, subdi3_carry): Canonicalize.
(addqi_3): Rename to addqi3_cc
(prologue_set_got): Canonicalize.
(string operation patterns): Likewise.
*** i386.md.can Mon Jul 31 20:41:56 2000
--- i386.md Tue Aug 1 00:30:38 2000
***************
*** 3682,3723 ****
(match_operand:DI 2 "general_operand" "")))
(clobber (reg:CC 17))]
"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)
! (plus:SI (match_dup 4)
! (plus:SI (match_dup 5)
! (ltu:SI (reg:CC 17) (const_int 0)))))
(clobber (reg:CC 17))])]
"split_di (operands+0, 1, operands+0, operands+3);
split_di (operands+1, 1, operands+1, operands+4);
split_di (operands+2, 1, operands+2, operands+5);")
- (define_insn "*addsi3_cc"
- [(set (reg:CC 17) (plus:CC (match_operand:SI 1 "nonimmediate_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "ri,rm")))
- (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "ix86_binary_operator_ok (PLUS, SImode, operands)"
- "add{l}\\t{%2, %0|%0, %2}"
- [(set_attr "type" "alu")
- (set_attr "mode" "SI")])
-
- (define_insn "addqi3_cc"
- [(set (reg:CC 17) (plus:CC (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qi,qm")))
- (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (plus:QI (match_dup 1) (match_dup 2)))]
- "ix86_binary_operator_ok (PLUS, QImode, operands)"
- "add{b}\\t{%2, %0|%0, %2}"
- [(set_attr "type" "alu")
- (set_attr "mode" "QI")])
-
(define_insn "*addsi3_carry"
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
! (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
! (plus:SI (match_operand:SI 2 "general_operand" "ri,rm")
! (ltu:SI (reg:CC 17) (const_int 0)))))
(clobber (reg:CC 17))]
"ix86_binary_operator_ok (PLUS, SImode, operands)"
"adc{l}\\t{%2, %0|%0, %2}"
--- 3682,3705 ----
(match_operand:DI 2 "general_operand" "")))
(clobber (reg:CC 17))]
"reload_completed"
! [(parallel [(set (reg:CC 17)
! (compare:CC (plus:SI (match_dup 1) (match_dup 2))
! (const_int 0)))
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
(parallel [(set (match_dup 3)
! (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
! (match_dup 4))
! (match_dup 5)))
(clobber (reg:CC 17))])]
"split_di (operands+0, 1, operands+0, operands+3);
split_di (operands+1, 1, operands+1, operands+4);
split_di (operands+2, 1, operands+2, operands+5);")
(define_insn "*addsi3_carry"
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
! (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
! (match_operand:SI 1 "nonimmediate_operand" "%0,0"))
! (match_operand:SI 2 "general_operand" "ri,rm")))
(clobber (reg:CC 17))]
"ix86_binary_operator_ok (PLUS, SImode, operands)"
"adc{l}\\t{%2, %0|%0, %2}"
***************
*** 4299,4305 ****
(const_string "alu")))
(set_attr "mode" "QI")])
! (define_insn "*addqi_3"
[(set (reg:CC 17)
(compare:CC (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
(match_operand:QI 2 "general_operand" "qmni,qni"))
--- 4281,4287 ----
(const_string "alu")))
(set_attr "mode" "QI")])
! (define_insn "addqi3_cc"
[(set (reg:CC 17)
(compare:CC (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
(match_operand:QI 2 "general_operand" "qmni,qni"))
***************
*** 4408,4439 ****
(match_operand:DI 2 "general_operand" "")))
(clobber (reg:CC 17))]
"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)
(minus:SI (match_dup 4)
! (plus:SI (match_dup 5)
! (ltu:SI (reg:CC 17) (const_int 0)))))
(clobber (reg:CC 17))])]
"split_di (operands+0, 1, operands+0, operands+3);
split_di (operands+1, 1, operands+1, operands+4);
split_di (operands+2, 1, operands+2, operands+5);")
- (define_insn "*subsi3_cc"
- [(set (reg:CC 17) (minus:CC (match_operand:SI 1 "nonimmediate_operand" "0,0")
- (match_operand:SI 2 "general_operand" "ri,rm")))
- (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "ix86_binary_operator_ok (MINUS, SImode, operands)"
- "sub{l}\\t{%2, %0|%0, %2}"
- [(set_attr "type" "alu")
- (set_attr "mode" "SI")])
-
(define_insn "subsi3_carry"
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
! (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
! (plus:SI (match_operand:SI 2 "general_operand" "ri,rm")
! (ltu:SI (reg:CC 17) (const_int 0)))))
(clobber (reg:CC 17))]
"ix86_binary_operator_ok (MINUS, SImode, operands)"
"sbb{l}\\t{%2, %0|%0, %2}"
--- 4390,4413 ----
(match_operand:DI 2 "general_operand" "")))
(clobber (reg:CC 17))]
"reload_completed"
! [(parallel [(set (reg:CC 17)
! (compare:CC (minus:SI (match_dup 1) (match_dup 2))
! (const_int 0)))
(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))])
(parallel [(set (match_dup 3)
(minus:SI (match_dup 4)
! (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
! (match_dup 5))))
(clobber (reg:CC 17))])]
"split_di (operands+0, 1, operands+0, operands+3);
split_di (operands+1, 1, operands+1, operands+4);
split_di (operands+2, 1, operands+2, operands+5);")
(define_insn "subsi3_carry"
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
! (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
! (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
! (match_operand:SI 2 "general_operand" "ri,rm"))))
(clobber (reg:CC 17))]
"ix86_binary_operator_ok (MINUS, SImode, operands)"
"sbb{l}\\t{%2, %0|%0, %2}"
***************
*** 5718,5726 ****
(set (match_dup 0) (neg:SI (match_dup 2)))])
(parallel
[(set (match_dup 1)
! (plus:SI (match_dup 3)
! (plus:SI (const_int 0)
! (ltu:SI (reg:CC 17) (const_int 0)))))
(clobber (reg:CC 17))])
(parallel
[(set (match_dup 1)
--- 5692,5700 ----
(set (match_dup 0) (neg:SI (match_dup 2)))])
(parallel
[(set (match_dup 1)
! (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0))
! (const_int 0))
! (match_dup 3)))
(clobber (reg:CC 17))])
(parallel
[(set (match_dup 1)
***************
*** 8325,8331 ****
(minus:SI (match_dup 8)
(mem:SI (plus:SI (plus:SI (mult:SI (match_dup 6) (const_int 4))
(match_dup 8))
! (const (unspec [(label_ref (match_operand 3 "" ""))] 7))))))
(clobber (reg:CC 17))])
(parallel [(set (pc) (match_dup 7))
(use (label_ref (match_dup 3)))])]
--- 8299,8305 ----
(minus:SI (match_dup 8)
(mem:SI (plus:SI (plus:SI (mult:SI (match_dup 6) (const_int 4))
(match_dup 8))
! (const:SI (unspec [(label_ref (match_operand 3 "" ""))] 7))))))
(clobber (reg:CC 17))])
(parallel [(set (pc) (match_dup 7))
(use (label_ref (match_dup 3)))])]
***************
*** 8786,8794 ****
(define_insn "prologue_set_got"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec_volatile:SI
! [(plus:SI (match_dup 0)
! (plus:SI (match_operand:SI 1 "symbolic_operand" "")
! (minus:SI (pc) (match_operand 2 "" ""))))] 1))
(clobber (reg:CC 17))]
""
"*
--- 8760,8768 ----
(define_insn "prologue_set_got"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec_volatile:SI
! [(plus:SI (plus:SI (minus:SI (pc) (match_operand 2 "" ""))
! (match_operand:SI 1 "symbolic_operand" ""))
! (match_dup 0))] 1))
(clobber (reg:CC 17))]
""
"*
***************
*** 9727,9737 ****
[(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
(use (match_operand:SI 5 "register_operand" "2"))
(set (match_operand:SI 0 "register_operand" "=D")
! (plus:SI (match_operand:SI 3 "address_operand" "0")
! (ashift:SI (match_dup 5) (const_int 2))))
(set (match_operand:SI 1 "register_operand" "=S")
! (plus:SI (match_operand:SI 4 "address_operand" "1")
! (ashift:SI (match_dup 5) (const_int 2))))
(set (mem:BLK (match_dup 3))
(mem:BLK (match_dup 4)))
(use (reg:SI 19))]
--- 9701,9711 ----
[(set (match_operand:SI 2 "register_operand" "=c") (const_int 0))
(use (match_operand:SI 5 "register_operand" "2"))
(set (match_operand:SI 0 "register_operand" "=D")
! (plus:SI (ashift:SI (match_dup 5) (const_int 2))
! (match_operand:SI 3 "address_operand" "0")))
(set (match_operand:SI 1 "register_operand" "=S")
! (plus:SI (ashift:SI (match_dup 5) (const_int 2))
! (match_operand:SI 4 "address_operand" "1")))
(set (mem:BLK (match_dup 3))
(mem:BLK (match_dup 4)))
(use (reg:SI 19))]
***************
*** 10023,10030 ****
(use (match_operand:SI 2 "register_operand" "a"))
(use (match_operand:SI 4 "register_operand" "1"))
(set (match_operand:SI 0 "register_operand" "=D")
! (plus:SI (match_operand:SI 3 "address_operand" "0")
! (ashift:SI (match_dup 3) (const_int 2))))
(set (mem:BLK (match_dup 3))
(const_int 0))
(use (reg:SI 19))]
--- 9997,10004 ----
(use (match_operand:SI 2 "register_operand" "a"))
(use (match_operand:SI 4 "register_operand" "1"))
(set (match_operand:SI 0 "register_operand" "=D")
! (plus:SI (ashift:SI (match_dup 3) (const_int 2))
! (match_operand:SI 3 "address_operand" "0")))
(set (mem:BLK (match_dup 3))
(const_int 0))
(use (reg:SI 19))]