Liste des Groupes | Revenir à c arch |
On Sun, 8 Sep 2024 15:32:02 +0000, Anton Ertl wrote:
>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.
I just copied the RISC-V code
...Concerning the last column, the gcc developer who added the
transformation of bar2() into bar3() apparently had My66000 in mind.
BTW I had the comparisons to int-MAX/MIN in since about 2016.
Les messages affichés proviennent d'usenet.