* Commit: RX: Disable extender peepholes at -O3
@ 2011-08-09 11:00 Nick Clifton
2011-08-09 11:35 ` Paul_Koning
0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2011-08-09 11:00 UTC (permalink / raw)
To: gcc-patches
Hi Guys,
I am checking in the patch below to the mainline and 4.6 branch. It
disables the peephole optimizations in the rx.md file that combine a
load followed by a zero- or sign- extend operation. The disabling
only happens at -O3 (or higher) as although the peepholes reduce the
number of instructions they can introduce pipeline stalls that
actually make the program slower. (This is certainly true for the
coremark test).
Cheers
Nick
gcc/ChangeLog
2011-08-09 Nick Clifton <nickc@redhat.com>
* config/rx/rx.md: Disable extender peepholes at -O3.
Index: gcc/config/rx/rx.md
===================================================================
--- gcc/config/rx/rx.md (revision 177584)
+++ gcc/config/rx/rx.md (working copy)
@@ -1598,7 +1598,7 @@
(memex_commutative:SI (match_dup 0)
(match_dup 2)))
(clobber (reg:CC CC_REG))])]
- "peep2_regno_dead_p (2, REGNO (operands[0]))"
+ "peep2_regno_dead_p (2, REGNO (operands[0])) && (optimize < 3 || optimize_size)"
[(parallel [(set:SI (match_dup 2)
(memex_commutative:SI (match_dup 2)
(extend_types:SI (match_dup 1))))
@@ -1612,7 +1612,7 @@
(memex_commutative:SI (match_dup 2)
(match_dup 0)))
(clobber (reg:CC CC_REG))])]
- "peep2_regno_dead_p (2, REGNO (operands[0]))"
+ "peep2_regno_dead_p (2, REGNO (operands[0])) && (optimize < 3 || optimize_size)"
[(parallel [(set:SI (match_dup 2)
(memex_commutative:SI (match_dup 2)
(extend_types:SI (match_dup 1))))
@@ -1626,7 +1626,7 @@
(memex_noncomm:SI (match_dup 2)
(match_dup 0)))
(clobber (reg:CC CC_REG))])]
- "peep2_regno_dead_p (2, REGNO (operands[0]))"
+ "peep2_regno_dead_p (2, REGNO (operands[0])) && (optimize < 3 || optimize_size)"
[(parallel [(set:SI (match_dup 2)
(memex_noncomm:SI (match_dup 2)
(extend_types:SI (match_dup 1))))
@@ -1639,7 +1639,7 @@
(set (match_operand:SI 2 "register_operand")
(memex_nocc:SI (match_dup 0)
(match_dup 2)))]
- "peep2_regno_dead_p (2, REGNO (operands[0]))"
+ "peep2_regno_dead_p (2, REGNO (operands[0])) && (optimize < 3 || optimize_size)"
[(set:SI (match_dup 2)
(memex_nocc:SI (match_dup 2)
(extend_types:SI (match_dup 1))))]
@@ -1651,7 +1651,7 @@
(set (match_operand:SI 2 "register_operand")
(memex_nocc:SI (match_dup 2)
(match_dup 0)))]
- "peep2_regno_dead_p (2, REGNO (operands[0]))"
+ "peep2_regno_dead_p (2, REGNO (operands[0])) && (optimize < 3 || optimize_size)"
[(set:SI (match_dup 2)
(memex_nocc:SI (match_dup 2)
(extend_types:SI (match_dup 1))))]
@@ -1662,7 +1662,7 @@
(memex_commutative:SI (match_operand:SI 1 "register_operand" "%0")
(extend_types:SI (match_operand:small_int_modes 2 "rx_restricted_mem_operand" "Q"))))
(clobber (reg:CC CC_REG))]
- ""
+ "(optimize < 3 || optimize_size)"
"<memex_commutative:op>\t%<extend_types:letter>2, %0"
[(set_attr "timings" "33")
(set_attr "length" "5")] ;; This length is corrected in rx_adjust_insn_length
@@ -1673,7 +1673,7 @@
(memex_noncomm:SI (match_operand:SI 1 "register_operand" "0")
(extend_types:SI (match_operand:small_int_modes 2 "rx_restricted_mem_operand" "Q"))))
(clobber (reg:CC CC_REG))]
- ""
+ "(optimize < 3 || optimize_size)"
"<memex_noncomm:op>\t%<extend_types:letter>2, %0"
[(set_attr "timings" "33")
(set_attr "length" "5")] ;; This length is corrected in rx_adjust_insn_length
@@ -1683,7 +1683,7 @@
[(set (match_operand:SI 0 "register_operand" "=r")
(memex_nocc:SI (match_operand:SI 1 "register_operand" "%0")
(extend_types:SI (match_operand:small_int_modes 2 "rx_restricted_mem_operand" "Q"))))]
- ""
+ "(optimize < 3 || optimize_size)"
"<memex_nocc:op>\t%<extend_types:letter>2, %0"
[(set_attr "timings" "33")
(set_attr "length" "5")] ;; This length is corrected in rx_adjust_insn_length
@@ -1695,7 +1695,7 @@
(set (reg:CC CC_REG)
(compare:CC (match_operand:SI 2 "register_operand")
(match_dup 0)))]
- "peep2_regno_dead_p (2, REGNO (operands[0]))"
+ "peep2_regno_dead_p (2, REGNO (operands[0])) && (optimize < 3 || optimize_size)"
[(set (reg:CC CC_REG)
(compare:CC (match_dup 2)
(extend_types:SI (match_dup 1))))]
@@ -1734,7 +1734,7 @@
[(set (reg:CC CC_REG)
(compare:CC (match_operand:SI 0 "register_operand" "=r")
(extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand" "Q"))))]
- ""
+ "(optimize < 3 || optimize_size)"
"cmp\t%<extend_types:letter>1, %0"
[(set_attr "timings" "33")
(set_attr "length" "5")] ;; This length is corrected in rx_adjust_insn_length
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Commit: RX: Disable extender peepholes at -O3
2011-08-09 11:00 Commit: RX: Disable extender peepholes at -O3 Nick Clifton
@ 2011-08-09 11:35 ` Paul_Koning
2011-08-09 12:00 ` Nick Clifton
0 siblings, 1 reply; 3+ messages in thread
From: Paul_Koning @ 2011-08-09 11:35 UTC (permalink / raw)
To: nickc, gcc-patches
> I am checking in the patch below to the mainline and 4.6 branch. It
> disables the peephole optimizations in the rx.md file that combine a
> load followed by a zero- or sign- extend operation. The disabling
> only happens at -O3 (or higher) as although the peepholes reduce the
> number of instructions they can introduce pipeline stalls that
> actually make the program slower. (This is certainly true for the
> coremark test).
Doesn't that mean it should be disabled for any optimization other than optimize_size? It seems surprising to have a "size but not speed" optimization done at -O2.
paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Commit: RX: Disable extender peepholes at -O3
2011-08-09 11:35 ` Paul_Koning
@ 2011-08-09 12:00 ` Nick Clifton
0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2011-08-09 12:00 UTC (permalink / raw)
To: Paul_Koning; +Cc: gcc-patches
Hi Paul,
>> It disables the peephole optimizations in the rx.md file that combine a
>> load followed by a zero- or sign- extend operation. The disabling
>> only happens at -O3 (or higher) as although the peepholes reduce the
>> number of instructions they can introduce pipeline stalls that
>> actually make the program slower.
>
> Doesn't that mean it should be disabled for any optimization other than
> optimize_size?
That is what I thought as well. But Renesas have specifically asked for
this arrangement, so that is what I have done.
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-09 11:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-09 11:00 Commit: RX: Disable extender peepholes at -O3 Nick Clifton
2011-08-09 11:35 ` Paul_Koning
2011-08-09 12:00 ` Nick Clifton
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).