Re: Integral conversions in C/C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Fine wrote:

But, if the machine has a 32bit by 32bit multiply that produces the identical 64bit result, the optimizer is free to use it.

Here's the catch:

Optimizers aren't part of the standard.  If the standard(s) were to
allow for much more explicit expressions, many optimizers would do a
much better job.  Writing optimizers around standards is what since
the 90ies characterizes ``good'' compilers.  Here's where the kewl
stuff happens.

A strictly standard conforming C/C++ frontend would not (actually
see the need to) propagate that information to the middle/back ends.
Given a multiplication expression of two 32 bit integers that has
(one of) its arguments cast to a 64 bit type, all that the middle
end receives from the front end is the information that a 64<-64x64
integer multipication is to be performed.  Without _extra_ information
attached to the tree, there is no way other than guessing that the
middle/back ends can infer from that tree that it was actually meant
as 64<-32x32 or indeed 64<-64x64 as modulo 2^64 multiplication.


Cheers,
Christian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux