commit b21c6abd41671c31da3cae3cd576027d15444be0
parent 7f03a23fdc342ebf76b3cd7c126eb6de7f5044f6
Author: Robert Russell <robertrussell.72001@gmail.com>
Date: Fri, 2 Jun 2023 16:08:19 -0700
SIMD stuff
Diffstat:
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/inc/all.h b/inc/all.h
@@ -1,4 +1,5 @@
/* Everything except bench.h */
+
#include "alloc.h"
#include "bits.h"
#include "buffer.h"
@@ -17,3 +18,7 @@
#include "utf8.h"
#include "vector.h"
#include "vmem.h"
+
+#ifdef __GNUC__
+#include "simd.h"
+#endif
diff --git a/inc/simd.h b/inc/simd.h
@@ -1,7 +1,16 @@
#pragma once
/* Note: This is a work in progress. Bindings for instructions should be
- * added as needed. */
+ * added as needed. We use GCC builtin's instead of the portable Intel
+ * intrinsics so that we get type-safety and because including x86intrin.h
+ * adds like 1s to compile times. Also, when working with intrinsics, one
+ * will probably accidently depend on compiler details anyway. */
+
+#ifndef __GNUC__
+#error "rcx/simd.h requires GCC extensions"
+#endif
+
+/* TODO: MMX, AVX-512 */
#ifdef __MMX__
#define R_HAVE_MMX 1
@@ -39,17 +48,6 @@
#define R_HAVE_AVX2 1
#endif
-/* TODO: AVX-512 */
-
-/* TODO: MMX
-typedef i8 v8i8 __attribute__((vector_size(8)));
-typedef u8 v8u8 __attribute__((vector_size(8)));
-typedef i16 v4i16 __attribute__((vector_size(8)));
-typedef u16 v4u16 __attribute__((vector_size(8)));
-typedef i32 v2i32 __attribute__((vector_size(8)));
-typedef u32 v2u32 __attribute__((vector_size(8)));
-*/
-
/* 128 bit */
typedef i8 v16i8 __attribute__((vector_size(16)));
typedef u8 v16u8 __attribute__((vector_size(16)));