summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-03-10 00:50:58 +0000
committerEric Christopher <echristo@apple.com>2010-03-10 00:50:58 +0000
commit1dca62055a9f951e47fc6475d8c20fd46c46aa64 (patch)
tree2dce6d09d391f6f6ca350a2cfe5cfd291977422a /clang/lib
parent05c37d2800e39c2798704c865d90b5420cfca4a5 (diff)
downloadbcm5719-llvm-1dca62055a9f951e47fc6475d8c20fd46c46aa64.tar.gz
bcm5719-llvm-1dca62055a9f951e47fc6475d8c20fd46c46aa64.zip
Add insert/extract_ps and related random macros.
llvm-svn: 98114
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Headers/smmintrin.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h
index 6b3d58feaf3..b3bdac68855 100644
--- a/clang/lib/Headers/smmintrin.h
+++ b/clang/lib/Headers/smmintrin.h
@@ -179,6 +179,27 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2)
return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2);
}
+/* SSE4 Insertion and Extraction from XMM Register Instructions. */
+#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))
+#define _mm_extract_ps(X, N) (__extension__ \
+ ({ union { int i; float f; } __t; \
+ __v4sf __a = (__v4sf)X; \
+ __t.f = __a[N]; \
+ __t.i;}))
+
+/* Miscellaneous insert and extract macros. */
+/* Extract a single-precision float from X at index N into D. */
+#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)X; \
+ (D) = __a[N]; }))
+
+/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create
+ an index suitable for _mm_insert_ps. */
+#define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z))
+
+/* Extract a float from X at index N into the first index of the return. */
+#define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X), \
+ _MM_MK_INSERTPS_NDX((N), 0, 0x0e))
+
#endif /* __SSE4_1__ */
#endif /* _SMMINTRIN_H */
OpenPOWER on IntegriCloud