This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Possible change to gen* for splits
- To: gcc at gcc dot gnu dot org
- Subject: Possible change to gen* for splits
- From: Clinton Popetz <cpopetz at cygnus dot com>
- Date: Fri, 10 Mar 2000 09:21:29 -0600
I'm wondering if it's possible to eliminate some of the redundancy in the md
files w.r.t. splits. It seems we often have an define_insn that forces a
split, followed by a define_split with the same rtl template. For instance,
from sparc.md:
(define_insn "*neg_snesi_zero"
[(set (match_operand:SI 0 "register_operand" "=r")
(neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r")
(const_int 0))))
(clobber (reg:CC 100))]
"! TARGET_LIVE_G0"
"#"
[(set_attr "length" "2")])
(define_split
[(set (match_operand:SI 0 "register_operand" "")
(neg:SI (ne:SI (match_operand:SI 1 "register_operand" "")
(const_int 0))))
(clobber (reg:CC 100))]
""
[(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
(const_int 0)))
(set (match_dup 0) (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))]
"")
This is pretty common, and it's somewhat of a maintenance problem (e.g. if I
add a clobber to the insn, I have to add a clobber to the split. I'm running
into this trying to add clobbers for the xer register to every insn and split
in rs6000.md that set the carry bit. Yuck.) Since the two rtl templates have
to match for the split to work, it seems overkill to type them twice. By
having gen* grok this:
(define_insn_and_split "name"
...normal insn...
[split pattern]
"split condition"
"split preparation statements"
)
the above two patterns would be:
(define_insn_and_split "*neg_snesi_zero"
[(set (match_operand:SI 0 "register_operand" "=r")
(neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r")
(const_int 0))))
(clobber (reg:CC 100))]
"! TARGET_LIVE_G0"
"#"
[(set_attr "length" "2")]
[(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
(const_int 0)))
(set (match_dup 0) (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))]
""
""
)
Does this seem reasonable/useful? I'd also like it to grok "* condition" for
the split condition, which means "append condition to whatever condition was in
the insn" so that the common case of:
(define_insn
[pattern]
"complex_condition"
...
)
(define_split
[pattern]
[split]
"complex_condition && reload_completed"
...
)
could be
(define_insn_and_split
[pattern]
"condition"
...
[split]
"* && reload_completed"
)
The above change would be worth several hundred lines in rs6000.md, so I'd
be willing to do the work to gen*, as it would save me time in the long run.
-Clint