[cfe-commits] r148919 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/avxintrin.h test/CodeGen/avx-builtins.c

Chris Lattner clattner at apple.com
Tue Jan 24 21:41:23 PST 2012


On Jan 24, 2012, at 8:26 PM, Craig Topper wrote:

> Author: ctopper
> Date: Tue Jan 24 22:26:17 2012
> New Revision: 148919
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=148919&view=rev
> Log:
> Represent 256-bit unaligned loads natively and remove the builtins. Similar change was made for 128-bit versions a while back.

Hi Craig,

I think that this is breaking CodeGen/builtins-x86.c:

/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:457:13: error: use of unknown builtin '__builtin_ia32_loadupd256'
  tmp_V4d = __builtin_ia32_loadupd256(tmp_dCp);
            ^
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:457:13: note: did you mean '__builtin_ia32_haddpd256'?
  tmp_V4d = __builtin_ia32_loadupd256(tmp_dCp);
            ^~~~~~~~~~~~~~~~~~~~~~~~~
            __builtin_ia32_haddpd256
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:457:11: error: assigning to 'V4d' from incompatible type 'int'
  tmp_V4d = __builtin_ia32_loadupd256(tmp_dCp);
          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:458:13: error: use of unknown builtin '__builtin_ia32_loadups256'
  tmp_V8f = __builtin_ia32_loadups256(tmp_fCp);
            ^
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:458:13: note: did you mean '__builtin_ia32_loadupd256'?
  tmp_V8f = __builtin_ia32_loadups256(tmp_fCp);
            ^~~~~~~~~~~~~~~~~~~~~~~~~
            __builtin_ia32_loadupd256
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:458:11: error: assigning to 'V8f' from incompatible type 'int'
  tmp_V8f = __builtin_ia32_loadups256(tmp_fCp);
          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:461:14: error: use of unknown builtin '__builtin_ia32_loaddqu256'
  tmp_V32c = __builtin_ia32_loaddqu256(tmp_cCp);
             ^
/Users/sabre/cvs/llvm/tools/clang/test/CodeGen/builtins-x86.c:461:12: error: assigning to 'V32c' from incompatible type 'int'
  tmp_V32c = __builtin_ia32_loaddqu256(tmp_cCp);
           ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've disabled it for now.

-Chris


> 
> Added:
>    cfe/trunk/test/CodeGen/avx-builtins.c
> Modified:
>    cfe/trunk/include/clang/Basic/BuiltinsX86.def
>    cfe/trunk/lib/Headers/avxintrin.h
> 
> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=148919&r1=148918&r2=148919&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jan 24 22:26:17 2012
> @@ -453,11 +453,8 @@
> BUILTIN(__builtin_ia32_vbroadcastss256, "V8ffC*", "")
> BUILTIN(__builtin_ia32_vbroadcastf128_pd256, "V4dV2dC*", "")
> BUILTIN(__builtin_ia32_vbroadcastf128_ps256, "V8fV4fC*", "")
> -BUILTIN(__builtin_ia32_loadupd256, "V4ddC*", "")
> -BUILTIN(__builtin_ia32_loadups256, "V8ffC*", "")
> BUILTIN(__builtin_ia32_storeupd256, "vd*V4d", "")
> BUILTIN(__builtin_ia32_storeups256, "vf*V8f", "")
> -BUILTIN(__builtin_ia32_loaddqu256, "V32ccC*", "")
> BUILTIN(__builtin_ia32_storedqu256, "vc*V32c", "")
> BUILTIN(__builtin_ia32_lddqu256, "V32ccC*", "")
> BUILTIN(__builtin_ia32_movntdq256, "vV4LLi*V4LLi", "")
> 
> Modified: cfe/trunk/lib/Headers/avxintrin.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=148919&r1=148918&r2=148919&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Headers/avxintrin.h (original)
> +++ cfe/trunk/lib/Headers/avxintrin.h Tue Jan 24 22:26:17 2012
> @@ -751,13 +751,19 @@
> static __inline __m256d __attribute__((__always_inline__, __nodebug__))
> _mm256_loadu_pd(double const *p)
> {
> -  return (__m256d)__builtin_ia32_loadupd256(p);
> +  struct __loadu_pd {
> +    __m256d v;
> +  } __attribute__((packed, may_alias));
> +  return ((struct __loadu_pd*)p)->v;
> }
> 
> static __inline __m256 __attribute__((__always_inline__, __nodebug__))
> _mm256_loadu_ps(float const *p)
> {
> -  return (__m256)__builtin_ia32_loadups256(p);
> +  struct __loadu_ps {
> +    __m256 v;
> +  } __attribute__((packed, may_alias));
> +  return ((struct __loadu_ps*)p)->v;
> }
> 
> static __inline __m256i __attribute__((__always_inline__, __nodebug__))
> @@ -769,7 +775,10 @@
> static __inline __m256i __attribute__((__always_inline__, __nodebug__))
> _mm256_loadu_si256(__m256i const *p)
> {
> -  return (__m256i)__builtin_ia32_loaddqu256((char const *)p);
> +  struct __loadu_si256 {
> +    __m256i v;
> +  } __attribute__((packed, may_alias));
> +  return ((struct __loadu_si256*)p)->v;
> }
> 
> static __inline __m256i __attribute__((__always_inline__, __nodebug__))
> 
> Added: cfe/trunk/test/CodeGen/avx-builtins.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-builtins.c?rev=148919&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGen/avx-builtins.c (added)
> +++ cfe/trunk/test/CodeGen/avx-builtins.c Tue Jan 24 22:26:17 2012
> @@ -0,0 +1,25 @@
> +// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - | FileCheck %s
> +
> +// Don't include mm_malloc.h, it's system specific.
> +#define __MM_MALLOC_H
> +
> +#include <immintrin.h>
> +
> +//
> +// Test LLVM IR codegen of shuffle instructions
> +//
> +
> +__m256 test__mm256_loadu_ps(void* p) {
> +  // CHECK: load <8 x float>* %{.*}, align 1
> +  return _mm256_loadu_ps(p);
> +}
> +
> +__m256d test__mm256_loadu_pd(void* p) {
> +  // CHECK: load <4 x double>* %{.*}, align 1
> +  return _mm256_loadu_pd(p);
> +}
> +
> +__m256i test__mm256_loadu_si256(void* p) {
> +  // CHECK: load <4 x i64>* %0, align 1
> +  return _mm256_loadu_si256(p);
> +}
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list