* Loop unrolling and asm
@ 1998-03-10 1:38 Christian Iseli
1998-03-10 10:13 ` Richard Henderson
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Christian Iseli @ 1998-03-10 1:38 UTC (permalink / raw)
To: egcs
Hi folks,
While trying out egcs-1.0.2-prerelease, I compiled the
new XFree86-3.3.2 on a Linux 2.1.88 (RH 5.0) PPro box.
binutils-2.8.(...).21 is installed.
I used -O2 -march=i686 -funroll-loops to compile XFree.
I encountered a small problem where a loop containing asm
was unrolled. The asm included labels (.label00, .label01, ...)
and the assembler died because of multiple definitions of
the labels.
The problem, of course, went away when I recompiled the incriminated
file without loop unrolling.
XFree seems to run fine.
Now the question: how do you go about including an asm with labels
in a loop that will be unrolled?
Christian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Loop unrolling and asm
1998-03-10 1:38 Loop unrolling and asm Christian Iseli
@ 1998-03-10 10:13 ` Richard Henderson
1998-03-10 10:21 ` Jeffrey A Law
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 1998-03-10 10:13 UTC (permalink / raw)
To: Christian Iseli; +Cc: egcs
On Tue, Mar 10, 1998 at 10:38:32AM +0100, Christian Iseli wrote:
> Now the question: how do you go about including an asm with labels
> in a loop that will be unrolled?
Use local labels if your assembler supports them (jcc 1f; blah; 1:).
Otherwise you are out o luck.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Loop unrolling and asm
1998-03-10 1:38 Loop unrolling and asm Christian Iseli
1998-03-10 10:13 ` Richard Henderson
@ 1998-03-10 10:21 ` Jeffrey A Law
1998-03-10 10:28 ` H.J. Lu
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jeffrey A Law @ 1998-03-10 10:21 UTC (permalink / raw)
To: Christian Iseli; +Cc: egcs
In message < 199803100938.KAA18441@lslsun17.epfl.ch >you write:
> Now the question: how do you go about including an asm with labels
> in a loop that will be unrolled?
Use the "forward/backward" label feature of gas. Of course it
probably won't work with other assemblers.
The code will look soemthing like this
jmp 0f
[ ... blah blah blah ... ]
0:
[ ... blah blah blah ... ]
jmp 0b
jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Loop unrolling and asm
1998-03-10 1:38 Loop unrolling and asm Christian Iseli
` (2 preceding siblings ...)
1998-03-10 10:28 ` H.J. Lu
@ 1998-03-10 10:28 ` Joern Rennecke
1998-03-10 17:06 ` Jim Wilson
4 siblings, 0 replies; 7+ messages in thread
From: Joern Rennecke @ 1998-03-10 10:28 UTC (permalink / raw)
To: Christian Iseli; +Cc: egcs
> Hi folks,
>
> While trying out egcs-1.0.2-prerelease, I compiled the
> new XFree86-3.3.2 on a Linux 2.1.88 (RH 5.0) PPro box.
> binutils-2.8.(...).21 is installed.
>
> I used -O2 -march=i686 -funroll-loops to compile XFree.
> I encountered a small problem where a loop containing asm
> was unrolled. The asm included labels (.label00, .label01, ...)
> and the assembler died because of multiple definitions of
> the labels.
>
> The problem, of course, went away when I recompiled the incriminated
> file without loop unrolling.
>
> XFree seems to run fine.
>
> Now the question: how do you go about including an asm with labels
> in a loop that will be unrolled?
There are two ways to do this:
- local labels
Not all assemblers support these, but at least gnu as does. You define
a local label as <digit>: , and reference it as <digit>b for a backwards
reference, or <digit>f for a forwards reference. E.g.:
0:
add -1,r0
bne 0b
- using "%=" in the assembler template. This will expand to a number
which is unique to the template as seen by final_scan_insn. That is,
for each copy that final_scan_insn created, you will get a different
number.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Loop unrolling and asm
1998-03-10 1:38 Loop unrolling and asm Christian Iseli
1998-03-10 10:13 ` Richard Henderson
1998-03-10 10:21 ` Jeffrey A Law
@ 1998-03-10 10:28 ` H.J. Lu
1998-03-11 12:08 ` Richard Henderson
1998-03-10 10:28 ` Joern Rennecke
1998-03-10 17:06 ` Jim Wilson
4 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 1998-03-10 10:28 UTC (permalink / raw)
To: Christian Iseli; +Cc: egcs, gas2
>
> Hi folks,
>
> While trying out egcs-1.0.2-prerelease, I compiled the
> new XFree86-3.3.2 on a Linux 2.1.88 (RH 5.0) PPro box.
> binutils-2.8.(...).21 is installed.
>
> I used -O2 -march=i686 -funroll-loops to compile XFree.
> I encountered a small problem where a loop containing asm
> was unrolled. The asm included labels (.label00, .label01, ...)
> and the assembler died because of multiple definitions of
> the labels.
>
> The problem, of course, went away when I recompiled the incriminated
> file without loop unrolling.
>
> XFree seems to run fine.
>
> Now the question: how do you go about including an asm with labels
> in a loop that will be unrolled?
>
Use 0f, 1f, .... 9f, 0b, .... 9b instead of .label00 in asm. But
At one time, I needed more than 10 lables backward/forward. I had
to disable inline. I think it is limited by binutils. Can we change
binutils to accept more than 10 local lables?
--
H.J. Lu (hjl@gnu.org)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Loop unrolling and asm
1998-03-10 1:38 Loop unrolling and asm Christian Iseli
` (3 preceding siblings ...)
1998-03-10 10:28 ` Joern Rennecke
@ 1998-03-10 17:06 ` Jim Wilson
4 siblings, 0 replies; 7+ messages in thread
From: Jim Wilson @ 1998-03-10 17:06 UTC (permalink / raw)
To: Christian Iseli; +Cc: egcs
Now the question: how do you go about including an asm with labels
in a loop that will be unrolled?
Try using %= to get a unique number.
Or try using labels that don't have to be unique. GNU as supports local
symbol names which do not have to be unique. You define them using a number
from 0 to 9 and then you refer to them using 0b or 0f to indicate whether you
want the first 0 label searching backwards, or the first 0 label searching
forwards.
Jim
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Loop unrolling and asm
1998-03-10 10:28 ` H.J. Lu
@ 1998-03-11 12:08 ` Richard Henderson
0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 1998-03-11 12:08 UTC (permalink / raw)
To: H.J. Lu; +Cc: egcs, gas2
On Tue, Mar 10, 1998 at 07:15:06AM -0800, H.J. Lu wrote:
> Use 0f, 1f, .... 9f, 0b, .... 9b instead of .label00 in asm. But
> At one time, I needed more than 10 lables backward/forward. I had
> to disable inline. I think it is limited by binutils. Can we change
> binutils to accept more than 10 local lables?
You must not have tried it -- it has done so for a long long time.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1998-03-11 12:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-10 1:38 Loop unrolling and asm Christian Iseli
1998-03-10 10:13 ` Richard Henderson
1998-03-10 10:21 ` Jeffrey A Law
1998-03-10 10:28 ` H.J. Lu
1998-03-11 12:08 ` Richard Henderson
1998-03-10 10:28 ` Joern Rennecke
1998-03-10 17:06 ` Jim Wilson
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).