1 Reply Latest reply on Aug 23, 2013 4:38 AM by janb

    AVX intrinsics implementation issue

    janb

      Dear all,

       

      according to http://developer.amd.com/wordpress/media/2012/10/x86ReleaseNotes.txt the version 4.5.2 supports AVX, FMA and XOP.

      But without modifications, the given example does not work.

       

      #include<x86intrin.h>
      union vector {
        __m256d v1;
        double f[4];
      };
      int main()
      {
        union vector u;
        u.v1 = _mm256_set_pd(1.0, 2.0, 3.0, 4.0);
      }
      

       

      Compiling this gives me

      pc # opencc -mavx test.c
      In file included from /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/x86intrin.h:47,
                       from test.c:2:
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_addsub_ps':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:54: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_hadd_ps':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:60: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_hsub_ps':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:66: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_movehdup_ps':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:72: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_moveldup_ps':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:78: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_addsub_pd':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:84: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_hadd_pd':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:90: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_hsub_pd':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:96: error: can't convert between vector values of different size
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function '_mm_lddqu_si128':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:114: error: can't convert between vector values of different size
      

       

      Similar problem, but slightly different output using openCC:

      pc # openCC -mavx test.c
      In file included from /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/x86intrin.h:47,
                       from test.c:2:
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'float __vector__ _mm_addsub_ps(float __vector__, float __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:54: error: '__builtin_ia32_addsubps' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'float __vector__ _mm_hadd_ps(float __vector__, float __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:60: error: '__builtin_ia32_haddps' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'float __vector__ _mm_hsub_ps(float __vector__, float __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:66: error: '__builtin_ia32_hsubps' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'float __vector__ _mm_movehdup_ps(float __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:72: error: '__builtin_ia32_movshdup' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'float __vector__ _mm_moveldup_ps(float __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:78: error: '__builtin_ia32_movsldup' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'double __vector__ _mm_addsub_pd(double __vector__, double __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:84: error: '__builtin_ia32_addsubpd' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'double __vector__ _mm_hadd_pd(double __vector__, double __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:90: error: '__builtin_ia32_haddpd' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'double __vector__ _mm_hsub_pd(double __vector__, double __vector__)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:96: error: '__builtin_ia32_hsubpd' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'long long int __vector__ _mm_lddqu_si128(const long long int __vector__*)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:114: error: '__builtin_ia32_lddqu' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'void _mm_monitor(const void*, unsigned int, unsigned int)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:120: error: '__builtin_ia32_monitor' was not declared in this scope
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h: In function 'void _mm_mwait(unsigned int, unsigned int)':
      /usr/open64-gcc-4.2.0/bin/../lib/gcc/x86_64-redhat-linux/4.2.0/include/pmmintrin.h:126: error: '__builtin_ia32_mwait' was not declared in this scope
      

       

      So pmmintrin.h seems to be the problem. This can be hot-fixed adding

      #define _PMMINTRIN_H_INCLUDED
      

       

      Just for reference, I'm using Open64 Compiler Suite Version 4.5.2.1

       

      So can I still consider AVX support to be broken?

       

      Best

      Jan