public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/24146] New: Optimizes away FPU control word store
@ 2005-09-30 13:42 rguenth at gcc dot gnu dot org
  2005-09-30 13:46 ` [Bug tree-optimization/24146] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-09-30 13:42 UTC (permalink / raw)
  To: gcc-bugs

For the following testcase, the call to mpfr_test_init is optimized away
at -O1 and up.  Which is of course bogous(?).

void mpfr_test_init (void);
void mpfr_test_init ()
{
  do { int __cw = (0x037f & (~0x300)) | 0x200; __asm__ ("fldcw %0" : : "m"
(__cw)); } while (0);
}

int
main (void)
{
  mpfr_test_init ();
  return 0;
}

-- 
           Summary: Optimizes away FPU control word store
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
@ 2005-09-30 13:46 ` pinskia at gcc dot gnu dot org
  2005-09-30 13:58 ` rearnsha at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-30 13:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 13:46 -------
volatile is needed here.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
  2005-09-30 13:46 ` [Bug tree-optimization/24146] " pinskia at gcc dot gnu dot org
@ 2005-09-30 13:58 ` rearnsha at gcc dot gnu dot org
  2005-09-30 14:07   ` Daniel Berlin
  2005-09-30 14:00 ` [Bug tree-optimization/24146] [4.0 Regression] " rguenth at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-09-30 13:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-09-30 13:58 -------
(In reply to comment #1)
> volatile is needed here.

No, the manual says:
An @code{asm} instruction without any output operands will be treated
identically to a volatile @code{asm} instruction.

So this insn should be kept even though it isn't explicitly volatile.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
  2005-09-30 13:46 ` [Bug tree-optimization/24146] " pinskia at gcc dot gnu dot org
  2005-09-30 13:58 ` rearnsha at gcc dot gnu dot org
@ 2005-09-30 14:00 ` rguenth at gcc dot gnu dot org
  2005-09-30 14:04 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-09-30 14:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Optimizes away FPU control  |[4.0 Regression] Optimizes
                   |word store                  |away FPU control word store


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-09-30 14:00 ` [Bug tree-optimization/24146] [4.0 Regression] " rguenth at gcc dot gnu dot org
@ 2005-09-30 14:04 ` pinskia at gcc dot gnu dot org
  2005-09-30 14:07 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-30 14:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 14:04 -------


*** This bug has been marked as a duplicate of 19341 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-09-30 14:07 ` pinskia at gcc dot gnu dot org
@ 2005-09-30 14:07 ` dberlin at dberlin dot org
  2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: dberlin at dberlin dot org @ 2005-09-30 14:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2005-09-30 14:07 -------
Subject: Re:  Optimizes away FPU control word
	store

On Fri, 2005-09-30 at 13:58 +0000, rearnsha at gcc dot gnu dot org
wrote:
> ------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-09-30 13:58 -------
> (In reply to comment #1)
> > volatile is needed here.
> 
> No, the manual says:
> An @code{asm} instruction without any output operands will be treated
> identically to a volatile @code{asm} instruction.
> 
> So this insn should be kept even though it isn't explicitly volatile.
> 

Then i guess we should teach the FE to just mark them volatile, so we
don't have to worry about this in the middle end.




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-09-30 14:04 ` pinskia at gcc dot gnu dot org
@ 2005-09-30 14:07 ` pinskia at gcc dot gnu dot org
  2005-09-30 14:18   ` Daniel Berlin
  2005-09-30 14:07 ` dberlin at dberlin dot org
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-30 14:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 14:07 -------
I still say this is invalid.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Bug tree-optimization/24146] Optimizes away FPU control word store
  2005-09-30 13:58 ` rearnsha at gcc dot gnu dot org
@ 2005-09-30 14:07   ` Daniel Berlin
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Berlin @ 2005-09-30 14:07 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Fri, 2005-09-30 at 13:58 +0000, rearnsha at gcc dot gnu dot org
wrote:
> ------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-09-30 13:58 -------
> (In reply to comment #1)
> > volatile is needed here.
> 
> No, the manual says:
> An @code{asm} instruction without any output operands will be treated
> identically to a volatile @code{asm} instruction.
> 
> So this insn should be kept even though it isn't explicitly volatile.
> 

Then i guess we should teach the FE to just mark them volatile, so we
don't have to worry about this in the middle end.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-09-30 14:07 ` dberlin at dberlin dot org
@ 2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
  2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-09-30 14:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |bonzini at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-09-30 14:11:11
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
@ 2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
  2005-09-30 14:17 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-09-30 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-09-30 14:10 -------
Richard Earnshaw is right; this is not a dup of PR19341.

volatile-ness is about optimizing away the asm statement itself; PR19341 is
about optimizing away code needed by the asm.

Reopening.

rth, should this be fixed in the front-end or in the gimplifier?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
@ 2005-09-30 14:17 ` pinskia at gcc dot gnu dot org
  2005-09-30 14:19 ` dberlin at dberlin dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-30 14:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 14:17 -------
Hmm, the comment in c-typeck.c:
/* Build an asm-expr, whose components are a STRING, some OUTPUTS,
   some INPUTS, and some CLOBBERS.  The latter three may be NULL.
   SIMPLE indicates whether there was anything at all after the
   string in the asm expression -- asm("blah") and asm("blah" : )
   are subtly different.  We use a ASM_EXPR node to represent this.  */

so maybe this is invalid after all.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 14:07 ` pinskia at gcc dot gnu dot org
@ 2005-09-30 14:18   ` Daniel Berlin
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Berlin @ 2005-09-30 14:18 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Fri, 2005-09-30 at 14:07 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 14:07 -------
> I still say this is invalid.
> 

well, that just makes you wrong.

the docs clearly say it's supposed to be treated as volatile.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/24146] [4.0 Regression] Optimizes away FPU control word store
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-09-30 14:17 ` pinskia at gcc dot gnu dot org
@ 2005-09-30 14:19 ` dberlin at dberlin dot org
  2005-09-30 14:36 ` [Bug middle-end/24146] [4.0/4.1 Regression] ASMs with no output are not marked as volatile pinskia at gcc dot gnu dot org
  2005-09-30 19:52 ` rth at gcc dot gnu dot org
  11 siblings, 0 replies; 15+ messages in thread
From: dberlin at dberlin dot org @ 2005-09-30 14:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2005-09-30 14:18 -------
Subject: Re:  [4.0 Regression] Optimizes away
	FPU control word store

On Fri, 2005-09-30 at 14:07 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 14:07 -------
> I still say this is invalid.
> 

well, that just makes you wrong.

the docs clearly say it's supposed to be treated as volatile.




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/24146] [4.0/4.1 Regression] ASMs with no output are not marked as volatile
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-09-30 14:19 ` dberlin at dberlin dot org
@ 2005-09-30 14:36 ` pinskia at gcc dot gnu dot org
  2005-09-30 19:52 ` rth at gcc dot gnu dot org
  11 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-30 14:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 14:35 -------
4.0 has also the latent bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |middle-end
            Summary|[4.0 Regression] Optimizes  |[4.0/4.1 Regression] ASMs
                   |away FPU control word store |with no output are not
                   |                            |marked as volatile
   Target Milestone|---                         |4.0.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/24146] [4.0/4.1 Regression] ASMs with no output are not marked as volatile
  2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2005-09-30 14:36 ` [Bug middle-end/24146] [4.0/4.1 Regression] ASMs with no output are not marked as volatile pinskia at gcc dot gnu dot org
@ 2005-09-30 19:52 ` rth at gcc dot gnu dot org
  11 siblings, 0 replies; 15+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-09-30 19:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-09-30 19:52 -------
Subject: Re:  [4.0 Regression] Optimizes away FPU control word store

On Fri, Sep 30, 2005 at 02:10:48PM -0000, bonzini at gcc dot gnu dot org wrote:
> rth, should this be fixed in the front-end or in the gimplifier?

Front end.  It's a one liner in build_asm_expr.


r~


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24146


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2005-09-30 19:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-30 13:42 [Bug tree-optimization/24146] New: Optimizes away FPU control word store rguenth at gcc dot gnu dot org
2005-09-30 13:46 ` [Bug tree-optimization/24146] " pinskia at gcc dot gnu dot org
2005-09-30 13:58 ` rearnsha at gcc dot gnu dot org
2005-09-30 14:07   ` Daniel Berlin
2005-09-30 14:00 ` [Bug tree-optimization/24146] [4.0 Regression] " rguenth at gcc dot gnu dot org
2005-09-30 14:04 ` pinskia at gcc dot gnu dot org
2005-09-30 14:07 ` pinskia at gcc dot gnu dot org
2005-09-30 14:18   ` Daniel Berlin
2005-09-30 14:07 ` dberlin at dberlin dot org
2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
2005-09-30 14:11 ` bonzini at gcc dot gnu dot org
2005-09-30 14:17 ` pinskia at gcc dot gnu dot org
2005-09-30 14:19 ` dberlin at dberlin dot org
2005-09-30 14:36 ` [Bug middle-end/24146] [4.0/4.1 Regression] ASMs with no output are not marked as volatile pinskia at gcc dot gnu dot org
2005-09-30 19:52 ` rth at gcc dot gnu dot org

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).