[cfe-commits] r148919 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/avxintrin.h test/CodeGen/avx-builtins.c
Craig Topper
craig.topper at gmail.com
Tue Jan 24 20:26:17 PST 2012
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.
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);
+}
More information about the cfe-commits
mailing list