This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A thought about cc0 migration. (Re: How aggressive is CSE aboutremoving redundant CC sets?)
Hi,
Recently Ulrich suggested to have three patterns for each machine
instruction like so
;; compare and 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)))]
;; compare only
[(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"))]
;; basic insn
[(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))]
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.
Just a thought.
Kazu Hirata