[Bug middle-end/53100] Optimize __int128 with range information
marc.glisse at normalesup dot org
gcc-bugzilla@gcc.gnu.org
Sun Apr 29 08:43:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53100
--- Comment #2 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-29 08:42:36 UTC ---
(In reply to comment #1)
> On the other hand, tree-vrp does have the information that the
> differences are in [-4294967295, 4294967295], which comfortably fits in a type
> half the size of __int128. It seems a possible strategy would be to have
> tree-vrp mark variables that fit in a type half their size (only for TImode?),
> try and preserve that information along the way, and finally use it in
> expand_doubleword_mult.
An other possibility would be, when the range analysis detects this situation,
to have it introduce a double-cast: (__int128)(long)var. In the example here,
it would give:
((__int128)(long)((__int128)c-(__int128)a))*((__int128)(long)((__int128)f-(__int128)b))
and existing optimizations already handle:
(long)((__int128)c-(__int128)a) as (long)c-(long)a
and
(__int128)mylong1*(__int128)mylong2 as a widening multiplication.
But then we'd have to be careful not to introduce too many such casts, not to
introduce them too late, and not to introduce them just before an optimization
that removes them. And find the appropriate half-sized type to cast to. And
possibly do this only for modes not handled natively.
More information about the Gcc-bugs
mailing list