Multiple jumps in one instruction
Toshi Morita
tm2@best.com
Fri May 25 10:40:00 GMT 2001
>
> 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
More information about the Gcc
mailing list