RKSimon created this revision.
RKSimon added reviewers: craig.topper, echristo, mkuper.
RKSimon added a subscriber: cfe-commits.
RKSimon set the repository for this revision to rL LLVM.

Adds missing SSE/AVX 'undefined' intrinsics (PR24040):

_mm_undefined_pd + _mm256_undefined_pd
_mm_undefined_ps + _mm256_undefined_ps
_mm_undefined_si128 + _mm256_undefined_si256



Repository:
  rL LLVM

http://reviews.llvm.org/D12052

Files:
  lib/Headers/avxintrin.h
  lib/Headers/emmintrin.h
  lib/Headers/xmmintrin.h
  test/CodeGen/sse-undefined.c

Index: test/CodeGen/sse-undefined.c
===================================================================
--- test/CodeGen/sse-undefined.c
+++ test/CodeGen/sse-undefined.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "xmm"
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "ymm"
+
+// Don't include mm_malloc.h, it's system specific.
+#define __MM_MALLOC_H
+
+#include <x86intrin.h>
+
+__m128 test_mm_undefined_ps() {
+  return _mm_undefined_ps();
+}
+
+__m128d test_mm_undefined_pd() {
+  return _mm_undefined_pd();
+}
+
+__m128i test_mm_undefined_si128() {
+  return _mm_undefined_si128();
+}
+
+__m256 test_mm256_undefined_ps() {
+  return _mm256_undefined_ps();
+}
+
+__m256d test_mm256_undefined_pd() {
+  return _mm256_undefined_pd();
+}
+
+__m256i test_mm256_undefined_si256() {
+  return _mm256_undefined_si256();
+}
Index: lib/Headers/xmmintrin.h
===================================================================
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -577,6 +577,13 @@
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_undefined_ps()
+{
+  __m128 __u;
+  return __builtin_shufflevector(__u, __u, -1, -1, -1, -1);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_set_ss(float __w)
 {
   return (__m128){ __w, 0, 0, 0 };
Index: lib/Headers/emmintrin.h
===================================================================
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -523,6 +523,13 @@
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_undefined_pd()
+{
+  __m128d __u;
+  return __builtin_shufflevector(__u, __u, -1, -1);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_set_sd(double __w)
 {
   return (__m128d){ __w, 0 };
@@ -1116,6 +1123,13 @@
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_undefined_si128()
+{
+  __m128i __u;
+  return __builtin_shufflevector(__u, __u, -1, -1);
+}
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_set_epi64x(long long q1, long long q0)
 {
   return (__m128i){ q0, q1 };
Index: lib/Headers/avxintrin.h
===================================================================
--- lib/Headers/avxintrin.h
+++ lib/Headers/avxintrin.h
@@ -900,6 +900,27 @@
 }
 
 /* Create vectors */
+static __inline__ __m256d __DEFAULT_FN_ATTRS
+_mm256_undefined_pd()
+{
+  __m256d __u;
+  return __builtin_shufflevector(__u, __u, -1, -1, -1, -1);
+}
+
+static __inline__ __m256 __DEFAULT_FN_ATTRS
+_mm256_undefined_ps()
+{
+  __m256 __u;
+  return __builtin_shufflevector(__u, __u, -1, -1, -1, -1, -1, -1, -1, -1);
+}
+
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+_mm256_undefined_si256()
+{
+  __m256i __u;
+  return __builtin_shufflevector(__u, __u, -1, -1, -1, -1);
+}
+
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_set_pd(double __a, double __b, double __c, double __d)
 {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to