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 other/61417] New: can't use intrinsic function as argument to function template


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61417

            Bug ID: 61417
           Summary: can't use intrinsic function as argument to function
                    template
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yzhang1985 at gmail dot com

This program isn't compiling. It works in GCC 4.3, 4.8, and in the Intel
compiler. The problem is that GCC fails to inline the _mm_cmpgt_epi8 function
(which is not compiled into its own symbol), thinking it's defined externally.

#include <stdint.h>
#include <emmintrin.h>
#define FORCE_INLINE __attribute__ ((always_inline))

__m128i g_results;

typedef __m128i TwoOperandVectorFunction(__m128i, __m128i);
FORCE_INLINE void IntrinsicBench(TwoOperandVectorFunction f)
{
  __m128i r0, r1, r2;
  for (int i = 0; i < 2000000000; i += 16)
  {
    r0 = f(r1, r2);
  }
  g_results = r0;
}
int main(int argc, char **argv)
{
  IntrinsicBench(_mm_cmpgt_epi8);
  return 0;
}

I'm using GCC 4.9 (x86_64) configured with ./configure --prefix=/opt/gcc4.9
--with-gmp-include=/home/yale/gmp-5.1.2
--with-gmp-lib=/home/yale/gmp-5.1.2/.libs
--with-mpfr-include=/home/yale/mpfr-3.1.2/src
--with-mpfr-lib=/home/yale/mpfr-3.1.2/src/.libs
--with-mpc-include=/home/yale/mpc-1.0.1/src
--with-mpc-lib=/home/yale/mpc-1.0.1/src/.libs --enable-languages=c,c++,java
--with-multilib-list=m32,m64 --enable-libgcj --enable-libgcj-multifile
--enable-static-libjava --disable-java-awt --disable-libgcj-debug
--disable-jvmpi --disable-bootstrap --disable-nls --disable-multilib


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