Remove aom_simd.c and replace simd_check with macro
Change-Id: If2bb7ab2b16ba44e2d6e43eeb8713aa6c05d9d7c
diff --git a/aom_dsp/aom_dsp.mk b/aom_dsp/aom_dsp.mk
index eaa706a..ea2eb89 100644
--- a/aom_dsp/aom_dsp.mk
+++ b/aom_dsp/aom_dsp.mk
@@ -422,7 +422,6 @@
DSP_SRCS-yes += aom_dsp_rtcd.c
DSP_SRCS-yes += aom_dsp_rtcd_defs.pl
-DSP_SRCS-yes += aom_simd.c
DSP_SRCS-yes += aom_simd.h
DSP_SRCS-yes += aom_simd_inline.h
DSP_SRCS-yes += simd/v64_intrinsics.h
diff --git a/aom_dsp/aom_simd.c b/aom_dsp/aom_simd.c
deleted file mode 100644
index 03f4ba9..0000000
--- a/aom_dsp/aom_simd.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-// Set to 1 to add some sanity checks in the fallback C code
-const int simd_check = 1;
diff --git a/aom_dsp/aom_simd.h b/aom_dsp/aom_simd.h
index ae4ff23..d830ce5 100644
--- a/aom_dsp/aom_simd.h
+++ b/aom_dsp/aom_simd.h
@@ -21,6 +21,8 @@
#include "./aom_config.h"
#include "./aom_simd_inline.h"
+#define SIMD_CHECK 1 // Sanity checks in C equivalents
+
#if HAVE_NEON
#include "simd/v256_intrinsics_arm.h"
#elif HAVE_SSE2
diff --git a/aom_dsp/simd/v128_intrinsics_c.h b/aom_dsp/simd/v128_intrinsics_c.h
index 34e312e..97e3852 100644
--- a/aom_dsp/simd/v128_intrinsics_c.h
+++ b/aom_dsp/simd/v128_intrinsics_c.h
@@ -69,7 +69,7 @@
}
SIMD_INLINE c_v128 c_v128_load_aligned(const void *p) {
- if (simd_check && (uintptr_t)p & 15) {
+ if (SIMD_CHECK && (uintptr_t)p & 15) {
fprintf(stderr, "Error: unaligned v128 load at %p\n", p);
abort();
}
@@ -84,7 +84,7 @@
}
SIMD_INLINE void c_v128_store_aligned(void *p, c_v128 a) {
- if (simd_check && (uintptr_t)p & 15) {
+ if (SIMD_CHECK && (uintptr_t)p & 15) {
fprintf(stderr, "Error: unaligned v128 store at %p\n", p);
abort();
}
@@ -597,7 +597,7 @@
}
SIMD_INLINE c_v128 c_v128_align(c_v128 a, c_v128 b, const unsigned int c) {
- if (simd_check && c > 15) {
+ if (SIMD_CHECK && c > 15) {
fprintf(stderr, "Error: undefined alignment %d\n", c);
abort();
}
diff --git a/aom_dsp/simd/v256_intrinsics_c.h b/aom_dsp/simd/v256_intrinsics_c.h
index 8a67f9e..f1f9f22 100644
--- a/aom_dsp/simd/v256_intrinsics_c.h
+++ b/aom_dsp/simd/v256_intrinsics_c.h
@@ -74,7 +74,7 @@
}
SIMD_INLINE c_v256 c_v256_load_aligned(const void *p) {
- if (simd_check && (uintptr_t)p & 31) {
+ if (SIMD_CHECK && (uintptr_t)p & 31) {
fprintf(stderr, "Error: unaligned v256 load at %p\n", p);
abort();
}
@@ -89,7 +89,7 @@
}
SIMD_INLINE void c_v256_store_aligned(void *p, c_v256 a) {
- if (simd_check && (uintptr_t)p & 31) {
+ if (SIMD_CHECK && (uintptr_t)p & 31) {
fprintf(stderr, "Error: unaligned v256 store at %p\n", p);
abort();
}
@@ -609,7 +609,7 @@
}
SIMD_INLINE c_v256 c_v256_align(c_v256 a, c_v256 b, const unsigned int c) {
- if (simd_check && c > 31) {
+ if (SIMD_CHECK && c > 31) {
fprintf(stderr, "Error: undefined alignment %d\n", c);
abort();
}
diff --git a/aom_dsp/simd/v64_intrinsics_c.h b/aom_dsp/simd/v64_intrinsics_c.h
index 3f2f352..97d4869 100644
--- a/aom_dsp/simd/v64_intrinsics_c.h
+++ b/aom_dsp/simd/v64_intrinsics_c.h
@@ -19,8 +19,6 @@
#include <stdlib.h>
#include "./aom_config.h"
-extern const int simd_check;
-
typedef union {
uint8_t u8[8];
uint16_t u16[4];
@@ -93,7 +91,7 @@
}
SIMD_INLINE uint32_t c_u32_load_aligned(const void *p) {
- if (simd_check && (uintptr_t)p & 3) {
+ if (SIMD_CHECK && (uintptr_t)p & 3) {
fprintf(stderr, "Error: Unaligned u32 load at %p\n", p);
abort();
}
@@ -101,7 +99,7 @@
}
SIMD_INLINE void c_u32_store_aligned(void *p, uint32_t a) {
- if (simd_check && (uintptr_t)p & 3) {
+ if (SIMD_CHECK && (uintptr_t)p & 3) {
fprintf(stderr, "Error: Unaligned u32 store at %p\n", p);
abort();
}
@@ -118,7 +116,7 @@
}
SIMD_INLINE c_v64 c_v64_load_aligned(const void *p) {
- if (simd_check && (uintptr_t)p & 7) {
+ if (SIMD_CHECK && (uintptr_t)p & 7) {
fprintf(stderr, "Error: Unaligned c_v64 load at %p\n", p);
abort();
}
@@ -133,7 +131,7 @@
}
SIMD_INLINE void c_v64_store_aligned(void *p, c_v64 a) {
- if (simd_check && (uintptr_t)p & 7) {
+ if (SIMD_CHECK && (uintptr_t)p & 7) {
fprintf(stderr, "Error: Unaligned c_v64 store at %p\n", p);
abort();
}
@@ -495,7 +493,7 @@
c_v64 t;
int c;
for (c = 0; c < 8; c++) {
- if (simd_check && (pattern.u8[c] & ~7)) {
+ if (SIMD_CHECK && (pattern.u8[c] & ~7)) {
fprintf(stderr, "Error: Undefined v64_shuffle_8 index %d/%d\n",
pattern.u8[c], c);
abort();
@@ -732,7 +730,7 @@
SIMD_INLINE c_v64 c_v64_shl_8(c_v64 a, unsigned int n) {
c_v64 t;
int c;
- if (simd_check && n > 7) {
+ if (SIMD_CHECK && n > 7) {
fprintf(stderr, "Error: Undefined u8 shift left %d\n", n);
abort();
}
@@ -743,7 +741,7 @@
SIMD_INLINE c_v64 c_v64_shr_u8(c_v64 a, unsigned int n) {
c_v64 t;
int c;
- if (simd_check && n > 7) {
+ if (SIMD_CHECK && n > 7) {
fprintf(stderr, "Error: Undefined u8 shift right %d\n", n);
abort();
}
@@ -754,7 +752,7 @@
SIMD_INLINE c_v64 c_v64_shr_s8(c_v64 a, unsigned int n) {
c_v64 t;
int c;
- if (simd_check && n > 7) {
+ if (SIMD_CHECK && n > 7) {
fprintf(stderr, "Error: Undefined s8 shift right %d\n", n);
abort();
}
@@ -765,7 +763,7 @@
SIMD_INLINE c_v64 c_v64_shl_16(c_v64 a, unsigned int n) {
c_v64 t;
int c;
- if (simd_check && n > 15) {
+ if (SIMD_CHECK && n > 15) {
fprintf(stderr, "Error: Undefined u16 shift left %d\n", n);
abort();
}
@@ -776,7 +774,7 @@
SIMD_INLINE c_v64 c_v64_shr_u16(c_v64 a, unsigned int n) {
c_v64 t;
int c;
- if (simd_check && n > 15) {
+ if (SIMD_CHECK && n > 15) {
fprintf(stderr, "Error: Undefined u16 shift right %d\n", n);
abort();
}
@@ -787,7 +785,7 @@
SIMD_INLINE c_v64 c_v64_shr_s16(c_v64 a, unsigned int n) {
c_v64 t;
int c;
- if (simd_check && n > 15) {
+ if (SIMD_CHECK && n > 15) {
fprintf(stderr, "Error: undefined s16 shift right %d\n", n);
abort();
}
@@ -797,7 +795,7 @@
SIMD_INLINE c_v64 c_v64_shl_32(c_v64 a, unsigned int n) {
c_v64 t;
- if (simd_check && n > 31) {
+ if (SIMD_CHECK && n > 31) {
fprintf(stderr, "Error: undefined u32 shift left %d\n", n);
abort();
}
@@ -808,7 +806,7 @@
SIMD_INLINE c_v64 c_v64_shr_u32(c_v64 a, unsigned int n) {
c_v64 t;
- if (simd_check && n > 31) {
+ if (SIMD_CHECK && n > 31) {
fprintf(stderr, "Error: undefined u32 shift right %d\n", n);
abort();
}
@@ -819,7 +817,7 @@
SIMD_INLINE c_v64 c_v64_shr_s32(c_v64 a, unsigned int n) {
c_v64 t;
- if (simd_check && n > 31) {
+ if (SIMD_CHECK && n > 31) {
fprintf(stderr, "Error: undefined s32 shift right %d\n", n);
abort();
}
@@ -841,7 +839,7 @@
}
SIMD_INLINE c_v64 c_v64_align(c_v64 a, c_v64 b, const unsigned int c) {
- if (simd_check && c > 7) {
+ if (SIMD_CHECK && c > 7) {
fprintf(stderr, "Error: undefined alignment %d\n", c);
abort();
}