This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Multiple jumps in one instruction
- To: jonathan at buzzard dot org dot uk (Jonathan Buzzard)
- Subject: Re: Multiple jumps in one instruction
- From: Toshi Morita <tm2 at best dot com>
- Date: Fri, 25 May 2001 10:39:58 -0700 (PDT)
- Cc: gcc at gcc dot gnu dot org
>
> This may seem odd, but I am looking to port gcc to a new processor
> architecture. I have spend the last week or so reading the documentation
> but there is still one question left that I can not answer for definate.
>
> For example if I had a line like
>
> a = func1(n)+func2(n);
>
> I would want to compile this into a single jump instruction that goes
> to two places. Think of it as hardware multi-threading and you should
> get the idea.
>
> The problem is if gcc makes sufficient assumptions about the way that
> processors work that this is going to be mighty hard to implement then
> I might have to look at a new compiler from scratch. Obviously I want
> to avoid this at all possible costs.
>
> JAB.
>
> --
> Jonathan A. Buzzard Email: jonathan@buzzard.org.uk
> Northumberland, United Kingdom. Tel: +44(0)1661-832195
This scheme has huge problems.
Consider this:
static int a = 5;
void func1(void)
{
return a *= 5;
}
void func2(void)
{
return a *= 3;
}
void main(void)
{
printf("%d\n", func1() + func2());
}
This program semi-randomly print either 90 or 100 depending
on the timing between threads.
Toshi