This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Change macro SHIFT_COUNT_TRUNCATED to target hook TARGET_SHIFT_COUNT_TRUNCATED?


On Wed, Aug 25, 2010 at 7:29 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
> Hello,
>
> I have a problem about the definition of SHIFT_COUNT_TRUNCATED. MIPS
> is a SHIFT_COUNT_TRUNCATED target, and has it defined as 1. While
> loongson-specific vector insns are not SHIFT_COUNT_TRUNCATED. That
> means that the macro depends on the machine mode. One simple
> resolution may be,
>
> ?#define SHIFT_COUNT_TRUNCATED (TARGET_LOONGSON_2EF ? 0 : 1)
>
> but this will disable the common optimization for loongson target.
> Another way is to use a target hook to handle this problem, but this
> requires many changes.
>
> I'd like to ask suggestions for this.

SHIFT_COUNT_TRUNCATED isn't really about optimization but about
matching constant folding behavior with machine behavior in the cases
the C standard says invoke undefined behavior (IIRC).  On x86_64
and i?86 for example the macro doesn't match machine behavior
because machine behavior depends on the instructions being used.

So I wouldn't worry about this.

Richard.

> Thanks,
> Mingjie
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]