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: Relax AltiVec integral parameter/literal type checking


On Wed, May 12, 2004 at 11:48:13AM -0400, Aldy Hernandez wrote:
> >>>>> "Ziemowit" == Ziemowit Laski <zlaski@apple.com> writes:
> 
>  > I haven't modified the casting logic in the compiler, so if the
>  > compiler allows
>  > a cast to int or const int, then it's probably OK. :-)
> 
> Please test that this is actually the case.
> 
> Also, are you testing the altivec testsuite before and after?  I want
> to see altivec testsuite results before I approve anything.

Arguments to the AltiVec builtins are handled in the same way as normal
functions.  With Zem's patch, this testcase compiled as C gets no
warnings.  When compiled as C++ there are the same warnings for dummy as
there are for vec_dst.

    #include <altivec.h>
    
    /* Test whether the C front-end is not excessively picky about
       the integral types and literals that AltiVec instrinsics will
       accept.  Call a normal function with similar argument types
       for comparison.  */
    
    extern void dummy (vector int *, int, const int);
    
    vector int vi = { 1, 2, 3, 4 };
    
    int
    main (void)
    {
        unsigned int ui = 2;
        signed int si = 2;
        float fl = 2.0;
        double db = 3.0;
    
        dummy (&vi, ui, 1.0);
        dummy (&vi, si, 1.5);
        dummy (&vi, si, 1UL);
        dummy (&vi, fl, 0);
        dummy (&vi, db, 0);
    
        vec_dst (&vi, ui, 1.0);
        vec_dst (&vi, si, 1.5);
        vec_dst (&vi, si, 1UL);
        vec_dst (&vi, fl, 0);
        vec_dst (&vi, db, 0);
    
        return 0;
    }

I've bootstrapped mainline with a cleaned-up version of Zem's patch
(whitespace changes to get it to apply) with no regressions.  The new
test case passes, as do tests 7-01a.c and ira2a.c from gcc.dg/vmx, both
of which failed to compile without this patch.  There are no other
changes to the results of tests in gcc.dg/vmx, gcc.dg/altivec* and
g++.dg/ext/altivec*.

This patch is needed for the VMX-enabled versions of applications BLAST
and HMMER to compile.

Janis


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