This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A thought about cc0 migration. (Re: How aggressive is CSE about
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: kazu at cs dot umass dot edu (Kazu Hirata)
- Cc: gcc at gcc dot gnu dot org, weigand at i1 dot informatik dot uni-erlangen dot de
- Date: Mon, 16 Feb 2004 16:21:32 +0000 (GMT)
- Subject: Re: A thought about cc0 migration. (Re: How aggressive is CSE about
> According to him, the first two are used mainly (only?) by the
> combiner. I'm wondering if it's a good idea to improve the combiner
> as follows. When the "compare only" version fails to be recognized,
> fall back to the "compare and set" version. This way, we can reduce
> the number of arithmetic insns by 1/3 or so. Of course, there is a
> possibility that passes after the combiner don't like the "compare and
> test" version very much.
I think there are more useful things that combine can spend its time on,
like try combining insns both have the same input, or generating.
The extra patterns work just fine, it's only a bit tedious to write them.
If you want to get rid of that tedium, how about adding a macro facility
so that you can define one or more patterns with a shorthand?
E.g.:
(defmacro opcc (op_str result_predicate result_constraint op_rtl predicate asm)
(list 'define_insn (concat op_str "_cmp_set")
(vector
(list 'set '(reg 33) (list 'compare op_rtl (const_int 0)))
(list 'set (list 'match_operand:DI 0 result_predicate result_constraint)
(dup_expr op_rtl)))
predicate asm)
(list 'define_insn (concat op_str "_cmp")
(vector
(list 'set '(reg 33) (list 'compare op_rtl (const_int 0)))
(list 'clobber (list 'match_scratch:DI 0 result_constraint)))
predicate asm)
(list 'define_insn (concat op_str "_set")
(vector
(list 'set (list 'match_operand:DI 0 result_predicate result_constraint)
op_rtl)
(list 'clobber '(reg:CC 33)))
predicate asm)
(opcc "xor"
"register_operand" "=d,d"
(xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
(match_operand:DI 2 "general_operand" "d,m"))
""
"xor %0, %2")
where dup_expr expands to its argument with match_operands replaced with
match_dups, could expand into:
(define_insn "xor_cmp_set"
[(set (reg 33)
(compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
(match_operand:DI 2 "general_operand" "d,m"))
(const_int 0)))
(set (match_operand:DI 0 "register_operand" "=d,d")
(xor:DI (match_dup 1) (match_dup 2)))]
""
"xor %0, %2")
(define_insn "xor_cmp"
[(set (reg 33)
(compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
(match_operand:DI 2 "general_operand" "d,m"))
(const_int 0)))
(clobber (match_scratch:DI 0 "=d,d"))]
""
"xor %0, %2")
(define_insn "xor_set"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
(match_operand:DI 2 "general_operand" "d,m")))
(clobber (reg:CC 33))]
""
"xor %0, %2")