http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53100
Bug #: 53100
Summary: Optimize __int128 with range information
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: [email protected]
ReportedBy: [email protected]
(not sure about the "component" field)
In the following program, on x86_64, the first version generates two imulq,
while the second generates 4 imulq and 2 mulq. It would be convenient if I
could just write the whole code with __int128 and let the compiler do the
optimization by tracking the range of numbers.
int f(int a,int b,int c,int d,int e,int f){
#if 0
long x=a;
long y=b;
long z=c;
long t=d;
long u=e;
long v=f;
return (z-x)*(__int128)(v-y) < (u-x)*(__int128)(t-y);
#else
__int128 x=a;
__int128 y=b;
__int128 z=c;
__int128 t=d;
__int128 u=e;
__int128 v=f;
return (z-x)*(v-y) < (u-x)*(t-y);
#endif
}