Sujet : Re: Computer architects leaving Intel...
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.archDate : 08. Sep 2024, 16:32:02
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Sep8.173202@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : xrn 10.11
mitchalsup@aol.com (MitchAlsup1) writes:
And just for fun::
>
On Fri, 6 Sep 2024 13:26:42 +0000, Anton Ertl wrote:
Here we have the three variants:
>
#include <limits.h>
>
extern long foo1(long);
extern long foo2(long);
>
long bar(long a, long b)
{
long c;
if (__builtin_sub_overflow(b,1,&c))
return foo1(a);
else
return foo2(a);
}
>
long bar2(long a, long b)
{
if (b < b-1)
return foo1(a);
else
return foo2(a);
}
>
long bar3(long a, long b)
{
if (b == LONG_MIN)
return foo1(a);
else
return foo2(a);
}
>
My 66000:
add r3,R1,#-1 add r3,r1,#-1 bepm r1,.L4
bge R3,.L4 bge r3,.L4
8-bytes 8-bytes 4-bytes
>
I have a direct test for POSMAX in ISA that does not use a constant.
How does bge work in the first and second column? My impression was
that you are using an 88k-style flags-in-GPR architecture.
Concerning the last column, the gcc developer who added the
transformation of bar2() into bar3() apparently had My66000 in mind.
- anton
-- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>