* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
@ 2010-06-02 19:14 ` rguenth at gcc dot gnu dot org
2010-06-02 22:52 ` raj dot khem at gmail dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-02 19:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2010-06-02 19:14 -------
Heh. arm does have a bswapsi pattern though - why is that expanding to a call
at -Os?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|regression |target
Summary|libgcc compile with -- |[4.5/4.6 Regression] libgcc
|enable-target-optspace (-Os)|compile with --enable-
|causes recursion in |target-optspace (-Os) causes
|__bswapsi2 |recursion in __bswapsi2
Target Milestone|--- |4.5.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
2010-06-02 19:14 ` [Bug target/44392] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
@ 2010-06-02 22:52 ` raj dot khem at gmail dot com
2010-06-06 19:54 ` mikpe at it dot uu dot se
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: raj dot khem at gmail dot com @ 2010-06-02 22:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from raj dot khem at gmail dot com 2010-06-02 22:52 -------
(In reply to comment #1)
> Heh. arm does have a bswapsi pattern though - why is that expanding to a call
> at -Os?
>
IIUC this pattern only triggers for armv6+ architectures. The problem I see is
on
a armv5te
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
2010-06-02 19:14 ` [Bug target/44392] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
2010-06-02 22:52 ` raj dot khem at gmail dot com
@ 2010-06-06 19:54 ` mikpe at it dot uu dot se
2010-06-06 20:22 ` rguenth at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mikpe at it dot uu dot se @ 2010-06-06 19:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mikpe at it dot uu dot se 2010-06-06 19:54 -------
I've looked at this, and as far as I can tell it's caused by two separate
improvements in 4.5 that are Ok individually but cause libgcc's __bswapsi2 to
call itself when combined (and certain build options are selected).
1. The middle-end now recognises C idioms for bswap and represents them as
calls to the builtin bswap.
2. The ARM backend now generates much better code for the builtin bswap, but
for archs prior to ARMv6 when -Os is enabled the .md expander arranges to have
a libcall emitted instead.
Consequently, then building for (say) ARMv5 with --enable-target-optspace:
a) the middle-end represents the C bswap idiom in libgcc2.c:__bswapsi2 () as a
call to the builtin
b) the ARM backend (not knowing it's compiling libgcc) emits a libcall
c) hence __bswapsi2 () calls itself
The only way I see around this is to add a compiler option (-fin-libgcc say),
set it when compiling libgcc routines (similar to -DIN_LIBGCC2), check for it
in the ARM bswap expander, and if set ignore -Os in the arch < v6 case.
--
mikpe at it dot uu dot se changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (2 preceding siblings ...)
2010-06-06 19:54 ` mikpe at it dot uu dot se
@ 2010-06-06 20:22 ` rguenth at gcc dot gnu dot org
2010-06-22 0:46 ` ramana at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-06 20:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2010-06-06 20:22 -------
No, the arm backend should not claim to implement bswapsi when it in fact emits
a libcall.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (3 preceding siblings ...)
2010-06-06 20:22 ` rguenth at gcc dot gnu dot org
@ 2010-06-22 0:46 ` ramana at gcc dot gnu dot org
2010-06-22 0:52 ` ramana at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-06-22 0:46 UTC (permalink / raw)
To: gcc-bugs
--
ramana at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2010-06-22 00:46:00
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (4 preceding siblings ...)
2010-06-22 0:46 ` ramana at gcc dot gnu dot org
@ 2010-06-22 0:52 ` ramana at gcc dot gnu dot org
2010-06-22 5:51 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-06-22 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from ramana at gcc dot gnu dot org 2010-06-22 00:51 -------
Khem,
Can you check if this fixes your problem ? Feel free to submit this to
gcc-patches@ if you get around to testing this before me.
Ramana
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 628bd62..9dcceea 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -11296,7 +11296,7 @@
(define_expand "bswapsi2"
[(set (match_operand:SI 0 "s_register_operand" "=r")
(bswap:SI (match_operand:SI 1 "s_register_operand" "r")))]
-"TARGET_EITHER"
+"TARGET_EITHER && (arm_arch6 || ( !arm_arch6 && !optimize_size))"
"
if (!arm_arch6)
{
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (5 preceding siblings ...)
2010-06-22 0:52 ` ramana at gcc dot gnu dot org
@ 2010-06-22 5:51 ` jakub at gcc dot gnu dot org
2010-06-22 15:42 ` raj dot khem at gmail dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-06-22 5:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2010-06-22 05:50 -------
Why not just:
TARGET_EITHER && (arm_arch6 || !optimize_size)
? That !arm_arch6 && is completely redundant there.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (6 preceding siblings ...)
2010-06-22 5:51 ` jakub at gcc dot gnu dot org
@ 2010-06-22 15:42 ` raj dot khem at gmail dot com
2010-06-24 21:38 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: raj dot khem at gmail dot com @ 2010-06-22 15:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from raj dot khem at gmail dot com 2010-06-22 15:42 -------
(In reply to comment #6)
> Why not just:
> TARGET_EITHER && (arm_arch6 || !optimize_size)
> ? That !arm_arch6 && is completely redundant there.
>
Hi Ramana
the patch along with Jakub's suggestions works for me.
Thx
-Khem
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (7 preceding siblings ...)
2010-06-22 15:42 ` raj dot khem at gmail dot com
@ 2010-06-24 21:38 ` rguenth at gcc dot gnu dot org
2010-07-31 9:35 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-24 21:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rguenth at gcc dot gnu dot org 2010-06-24 21:38 -------
If nobody tests and submits this patch the issue will be not fixed for 4.5.1.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (8 preceding siblings ...)
2010-06-24 21:38 ` rguenth at gcc dot gnu dot org
@ 2010-07-31 9:35 ` rguenth at gcc dot gnu dot org
2010-08-25 16:48 ` jakub at gcc dot gnu dot org
2010-09-08 21:36 ` ramana at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-31 9:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2010-07-31 09:29 -------
GCC 4.5.1 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.5.1 |4.5.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (9 preceding siblings ...)
2010-07-31 9:35 ` rguenth at gcc dot gnu dot org
@ 2010-08-25 16:48 ` jakub at gcc dot gnu dot org
2010-09-08 21:36 ` ramana at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-25 16:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2010-08-25 16:48 -------
The patch has been approved, why hasn't been applied?
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00381.html
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ramana at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/44392] [4.5/4.6 Regression] libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2
2010-06-02 18:57 [Bug regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2 raj dot khem at gmail dot com
` (10 preceding siblings ...)
2010-08-25 16:48 ` jakub at gcc dot gnu dot org
@ 2010-09-08 21:36 ` ramana at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-09-08 21:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from ramana at gcc dot gnu dot org 2010-09-08 21:36 -------
Subject: Bug 44392
Author: ramana
Date: Wed Sep 8 21:35:48 2010
New Revision: 164029
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164029
Log:
2010-09-08 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/44392
* config/arm/arm.md (bswapsi2): Handle condition correctly
for armv6 and optimize_size.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm.md
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
^ permalink raw reply [flat|nested] 13+ messages in thread