This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Change macro SHIFT_COUNT_TRUNCATED to target hook TARGET_SHIFT_COUNT_TRUNCATED?
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Mingjie Xing <mingjie dot xing at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 25 Aug 2010 11:54:57 +0200
- Subject: Re: Change macro SHIFT_COUNT_TRUNCATED to target hook TARGET_SHIFT_COUNT_TRUNCATED?
- References: <AANLkTi=NrMBL9RK8-mJoCSMgTtOh3yXOU1JfVPvVHgnM@mail.gmail.com>
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
>