public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Over optimisation
@ 1999-09-23  7:26 Andrew Davies
  1999-09-23  7:43 ` Jeffrey A Law
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Andrew Davies @ 1999-09-23  7:26 UTC (permalink / raw)
  To: help-gcc

Hi,
	I have a problem with the optimiser. When I compile the following test
loop:

do  {
    test = regbase->utx & 0x8000;
    }while(test == 0x0000);


It produces the following code:


send_byte:
	link.w %a6,#0
	move.w 16775430,%d0
	and.w #32768,%d0
	.even
.L9:
	tst.w %d0
	jbeq .L9

I think the optimiser is assuming the line inside the do while loop is
static and therefore removes it from the loop. As a result it gets stuck.
Anyone know how to solve this without turning the optimiser off? 

Thanks

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

* Re: Over optimisation
  1999-09-23  7:26 Over optimisation Andrew Davies
@ 1999-09-23  7:43 ` Jeffrey A Law
  1999-09-30 23:56   ` Jeffrey A Law
  1999-10-01  0:00   ` Jeffrey A Law
  1999-09-23  8:13 ` Michel Decima
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Jeffrey A Law @ 1999-09-23  7:43 UTC (permalink / raw)
  To: Andrew Davies; +Cc: help-gcc

  In message < 01bf05ce$5ca544c0$4f7fa890@us1.lincoln.msl.mitel.com >you write:
  > Hi,
  > 	I have a problem with the optimiser. When I compile the following test
  > loop:
  > 
  > do  {
  >     test = regbase->utx & 0x8000;
  >     }while(test == 0x0000);
  > 
  > 
  > It produces the following code:
  > 
  > 
  > send_byte:
  > 	link.w %a6,#0
  > 	move.w 16775430,%d0
  > 	and.w #32768,%d0
  > 	.even
  > .L9:
  > 	tst.w %d0
  > 	jbeq .L9
  > 
  > I think the optimiser is assuming the line inside the do while loop is
  > static and therefore removes it from the loop. As a result it gets stuck.
  > Anyone know how to solve this without turning the optimiser off? 
There's no way to tell without a complete bug report.  Please read the FAQ to 
learn how to properly send bug reports.
jeff


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

* Re: Over optimisation
  1999-09-23  7:26 Over optimisation Andrew Davies
  1999-09-23  7:43 ` Jeffrey A Law
@ 1999-09-23  8:13 ` Michel Decima
  1999-09-30 23:56   ` Michel Decima
  1999-10-01  0:00   ` Michel Decima
  1999-09-30 23:56 ` Andrew Davies
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Michel Decima @ 1999-09-23  8:13 UTC (permalink / raw)
  To: help-gcc

Andrew Davies wrote:

> I think the optimiser is assuming the line inside the do while loop is
> static and therefore removes it from the loop. As a result it gets stuck.
> Anyone know how to solve this without turning the optimiser off?

volatile int test; 

HTH

--
mailto:michel.decima@cnet.francetelecom.fr

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

* Re: Over optimisation
  1999-09-23  8:13 ` Michel Decima
@ 1999-09-30 23:56   ` Michel Decima
  1999-10-01  0:00   ` Michel Decima
  1 sibling, 0 replies; 11+ messages in thread
From: Michel Decima @ 1999-09-30 23:56 UTC (permalink / raw)
  To: help-gcc

Andrew Davies wrote:

> I think the optimiser is assuming the line inside the do while loop is
> static and therefore removes it from the loop. As a result it gets stuck.
> Anyone know how to solve this without turning the optimiser off?

volatile int test; 

HTH

--
mailto:michel.decima@cnet.francetelecom.fr

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

* Over optimisation
  1999-09-23  7:26 Over optimisation Andrew Davies
  1999-09-23  7:43 ` Jeffrey A Law
  1999-09-23  8:13 ` Michel Decima
@ 1999-09-30 23:56 ` Andrew Davies
  1999-10-01  0:00 ` Andrew Davies
  1999-10-03  9:55 ` Veksler Michael
  4 siblings, 0 replies; 11+ messages in thread
From: Andrew Davies @ 1999-09-30 23:56 UTC (permalink / raw)
  To: help-gcc

Hi,
	I have a problem with the optimiser. When I compile the following test
loop:

do  {
    test = regbase->utx & 0x8000;
    }while(test == 0x0000);


It produces the following code:


send_byte:
	link.w %a6,#0
	move.w 16775430,%d0
	and.w #32768,%d0
	.even
.L9:
	tst.w %d0
	jbeq .L9

I think the optimiser is assuming the line inside the do while loop is
static and therefore removes it from the loop. As a result it gets stuck.
Anyone know how to solve this without turning the optimiser off? 

Thanks

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

* Re: Over optimisation
  1999-09-23  7:43 ` Jeffrey A Law
@ 1999-09-30 23:56   ` Jeffrey A Law
  1999-10-01  0:00   ` Jeffrey A Law
  1 sibling, 0 replies; 11+ messages in thread
From: Jeffrey A Law @ 1999-09-30 23:56 UTC (permalink / raw)
  To: Andrew Davies; +Cc: help-gcc

  In message < 01bf05ce$5ca544c0$4f7fa890@us1.lincoln.msl.mitel.com >you write:
  > Hi,
  > 	I have a problem with the optimiser. When I compile the following test
  > loop:
  > 
  > do  {
  >     test = regbase->utx & 0x8000;
  >     }while(test == 0x0000);
  > 
  > 
  > It produces the following code:
  > 
  > 
  > send_byte:
  > 	link.w %a6,#0
  > 	move.w 16775430,%d0
  > 	and.w #32768,%d0
  > 	.even
  > .L9:
  > 	tst.w %d0
  > 	jbeq .L9
  > 
  > I think the optimiser is assuming the line inside the do while loop is
  > static and therefore removes it from the loop. As a result it gets stuck.
  > Anyone know how to solve this without turning the optimiser off? 
There's no way to tell without a complete bug report.  Please read the FAQ to 
learn how to properly send bug reports.
jeff


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

* Over optimisation
  1999-09-23  7:26 Over optimisation Andrew Davies
                   ` (2 preceding siblings ...)
  1999-09-30 23:56 ` Andrew Davies
@ 1999-10-01  0:00 ` Andrew Davies
  1999-10-03  9:55 ` Veksler Michael
  4 siblings, 0 replies; 11+ messages in thread
From: Andrew Davies @ 1999-10-01  0:00 UTC (permalink / raw)
  To: help-gcc

Hi,
	I have a problem with the optimiser. When I compile the following test
loop:

do  {
    test = regbase->utx & 0x8000;
    }while(test == 0x0000);


It produces the following code:


send_byte:
	link.w %a6,#0
	move.w 16775430,%d0
	and.w #32768,%d0
	.even
.L9:
	tst.w %d0
	jbeq .L9

I think the optimiser is assuming the line inside the do while loop is
static and therefore removes it from the loop. As a result it gets stuck.
Anyone know how to solve this without turning the optimiser off? 

Thanks

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

* Re: Over optimisation
  1999-09-23  7:43 ` Jeffrey A Law
  1999-09-30 23:56   ` Jeffrey A Law
@ 1999-10-01  0:00   ` Jeffrey A Law
  1 sibling, 0 replies; 11+ messages in thread
From: Jeffrey A Law @ 1999-10-01  0:00 UTC (permalink / raw)
  To: Andrew Davies; +Cc: help-gcc

  In message < 01bf05ce$5ca544c0$4f7fa890@us1.lincoln.msl.mitel.com >you write:
  > Hi,
  > 	I have a problem with the optimiser. When I compile the following test
  > loop:
  > 
  > do  {
  >     test = regbase->utx & 0x8000;
  >     }while(test == 0x0000);
  > 
  > 
  > It produces the following code:
  > 
  > 
  > send_byte:
  > 	link.w %a6,#0
  > 	move.w 16775430,%d0
  > 	and.w #32768,%d0
  > 	.even
  > .L9:
  > 	tst.w %d0
  > 	jbeq .L9
  > 
  > I think the optimiser is assuming the line inside the do while loop is
  > static and therefore removes it from the loop. As a result it gets stuck.
  > Anyone know how to solve this without turning the optimiser off? 
There's no way to tell without a complete bug report.  Please read the FAQ to 
learn how to properly send bug reports.
jeff


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

* Re: Over optimisation
  1999-09-23  8:13 ` Michel Decima
  1999-09-30 23:56   ` Michel Decima
@ 1999-10-01  0:00   ` Michel Decima
  1 sibling, 0 replies; 11+ messages in thread
From: Michel Decima @ 1999-10-01  0:00 UTC (permalink / raw)
  To: help-gcc

Andrew Davies wrote:

> I think the optimiser is assuming the line inside the do while loop is
> static and therefore removes it from the loop. As a result it gets stuck.
> Anyone know how to solve this without turning the optimiser off?

volatile int test; 

HTH

--
mailto:michel.decima@cnet.francetelecom.fr

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

* Re: Over optimisation
  1999-09-23  7:26 Over optimisation Andrew Davies
                   ` (3 preceding siblings ...)
  1999-10-01  0:00 ` Andrew Davies
@ 1999-10-03  9:55 ` Veksler Michael
  1999-10-31 13:57   ` Veksler Michael
  4 siblings, 1 reply; 11+ messages in thread
From: Veksler Michael @ 1999-10-03  9:55 UTC (permalink / raw)
  To: help-gcc

Andrew Davies <Andrew_Davies@Xmitel.com> wrote:
>  Hi,
>  	I have a problem with the optimiser. When I compile the following test
>  loop:
>
>  do  {
>      test = regbase->utx & 0x8000;
>      }while(test == 0x0000);

[snip]

>  I think the optimiser is assuming the line inside the do while loop is
>  static and therefore removes it from the loop. As a result it gets stuck.
>  Anyone know how to solve this without turning the optimiser off? 

The optimizer is right, unless you declare regbase volatile. Otherwise,
the compiler has a right to assume that no one is modifying 'regbase'.

  Michael

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

* Re: Over optimisation
  1999-10-03  9:55 ` Veksler Michael
@ 1999-10-31 13:57   ` Veksler Michael
  0 siblings, 0 replies; 11+ messages in thread
From: Veksler Michael @ 1999-10-31 13:57 UTC (permalink / raw)
  To: help-gcc

Andrew Davies <Andrew_Davies@Xmitel.com> wrote:
>  Hi,
>  	I have a problem with the optimiser. When I compile the following test
>  loop:
>
>  do  {
>      test = regbase->utx & 0x8000;
>      }while(test == 0x0000);

[snip]

>  I think the optimiser is assuming the line inside the do while loop is
>  static and therefore removes it from the loop. As a result it gets stuck.
>  Anyone know how to solve this without turning the optimiser off? 

The optimizer is right, unless you declare regbase volatile. Otherwise,
the compiler has a right to assume that no one is modifying 'regbase'.

  Michael

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

end of thread, other threads:[~1999-10-31 13:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-23  7:26 Over optimisation Andrew Davies
1999-09-23  7:43 ` Jeffrey A Law
1999-09-30 23:56   ` Jeffrey A Law
1999-10-01  0:00   ` Jeffrey A Law
1999-09-23  8:13 ` Michel Decima
1999-09-30 23:56   ` Michel Decima
1999-10-01  0:00   ` Michel Decima
1999-09-30 23:56 ` Andrew Davies
1999-10-01  0:00 ` Andrew Davies
1999-10-03  9:55 ` Veksler Michael
1999-10-31 13:57   ` Veksler Michael

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