This is the mail archive of the gcc-patches@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: PATCH - PPC-darwin Correct initialization of 'long long' with constant


Roger Sayle <roger@eyesopen.com> writes:

> > /* { dg-do compile { target powerpc*-*-darwin* } } */
> > /* { dg-options "-O2 -force_cpusubtype_ALL -mpowerpc64" } */
> >
> > int  msw(long long in)
> > {
> >   union {
> >    long long ll;
> >    int  i[2];
> >   } ud;
> >   ud.ll = in;
> >   return ud.i[0];
> > }
> >
> > int main()
> > {
> >   return msw(1) != 0;
> > }
> 
> You're not really testing for this bug by only *compiling* this code
> at -O2.  It should really be an execute test.  And is the option
> -force_cpusubtype_ALL required for the failure?  Finally, I personally
> prefer to make the failure much more explicit, but its your call...

I'd suggest -mcpu=G5 instead of -mpowerpc64 -force_cpusubtype_ALL.
That way you can make the testcase build on any powerpc platform.
Also, the convention is that testcases exit() on success, and abort()
on failure.

O'course, you will then have the problem that the execution of the
testcase will crash unless the processor supports 64-bit instructions.
I suppose you could use the same technique that is used for Altivec
testcases, installing a signal handler.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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