This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/34604] New: __restrict__ keyword of inline function arguments is ignored


the following code shows two functions, which should be vectorized by the
compiler, one is defined inline, the other one isn't:

template <typename F>
void copyvec(F * __restrict__ dest, const F * __restrict__ src, unsigned int n)
{
    do
        *dest++ = *src++;
    while (--n);
}

template <typename F>
inline void copyvec_inline(F * __restrict__ dest, const F * __restrict__ src,
unsigned int n)
{
    do
        *dest++ = *src++;
    while (--n);
}


void cv(float * f, float * g, unsigned int n)
{
    copyvec(f, g, n);
}

void cvi(float * f, float * g, unsigned int n)
{
    copyvec_inline(f, g, n);
}


gcc vectorizes the call to copyvec, but is unable to vectorize the inlined call
to copyvec_inline ("can't determine dependence between *src_2 and *f_1"). it
seems that the __restrict__ keyword of inline function arguments is ignored or
lost ...

gcc version:
tim@laptop:~$ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)


-- 
           Summary: __restrict__ keyword of inline function arguments is
                    ignored
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34604


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