Commit 9f8d042296 for aom
commit 9f8d0422960b6d3c3a2145b9e4aa50a88718b7ae
Author: Frank Galligan <fgalligan@google.com>
Date: Fri Nov 13 10:44:04 2026 -0800
av1,simd: Add sign_s16 and optimize CDEF
Add v64/v128/v256_sign_s16 SIMD helpers (with unit tests including
INT16_MIN and mixed-lane edge cases) and use them in CDEF constrain16,
inline CDEF tap/direction constants and tap-pair loads, simplify tap
weight multiplies, and gate cdef_block.h hidden visibility behind
AOM_INTERNAL_HIDDEN_VISIBILITY on ELF targets.
Speedup: -0.62% (1T) / -0.58% (8T) encode time reduction (bit-exact).
TAG=agy
CONV=b929a630-a6cd-45a0-979c-1767c30178ee
Change-Id: I71c52cbb4b088d2fa7622a4081053f7525c9749b
diff --git a/aom_dsp/simd/v128_intrinsics.h b/aom_dsp/simd/v128_intrinsics.h
index 76c3f9b89a..aad432fbb2 100644
--- a/aom_dsp/simd/v128_intrinsics.h
+++ b/aom_dsp/simd/v128_intrinsics.h
@@ -113,6 +113,7 @@ SIMD_INLINE v128 v128_sub_32(v128 a, v128 b) { return c_v128_sub_32(a, b); }
SIMD_INLINE v128 v128_sub_64(v128 a, v128 b) { return c_v128_sub_64(a, b); }
SIMD_INLINE v128 v128_abs_s16(v128 a) { return c_v128_abs_s16(a); }
SIMD_INLINE v128 v128_abs_s8(v128 a) { return c_v128_abs_s8(a); }
+SIMD_INLINE v128 v128_sign_s16(v128 a, v128 b) { return c_v128_sign_s16(a, b); }
SIMD_INLINE v128 v128_mul_s16(v64 a, v64 b) { return c_v128_mul_s16(a, b); }
SIMD_INLINE v128 v128_mullo_s16(v128 a, v128 b) {
diff --git a/aom_dsp/simd/v128_intrinsics_c.h b/aom_dsp/simd/v128_intrinsics_c.h
index e28dbfa8d9..21806b4aec 100644
--- a/aom_dsp/simd/v128_intrinsics_c.h
+++ b/aom_dsp/simd/v128_intrinsics_c.h
@@ -318,6 +318,11 @@ SIMD_INLINE c_v128 c_v128_abs_s8(c_v128 a) {
return c_v128_from_v64(c_v64_abs_s8(a.v64[1]), c_v64_abs_s8(a.v64[0]));
}
+SIMD_INLINE c_v128 c_v128_sign_s16(c_v128 a, c_v128 b) {
+ return c_v128_from_v64(c_v64_sign_s16(a.v64[1], b.v64[1]),
+ c_v64_sign_s16(a.v64[0], b.v64[0]));
+}
+
SIMD_INLINE c_v128 c_v128_mul_s16(c_v64 a, c_v64 b) {
c_v64 lo_bits = c_v64_mullo_s16(a, b);
c_v64 hi_bits = c_v64_mulhi_s16(a, b);
diff --git a/aom_dsp/simd/v128_intrinsics_x86.h b/aom_dsp/simd/v128_intrinsics_x86.h
index e6ecebb6ec..fd5a9cc8fb 100644
--- a/aom_dsp/simd/v128_intrinsics_x86.h
+++ b/aom_dsp/simd/v128_intrinsics_x86.h
@@ -144,6 +144,16 @@ SIMD_INLINE v128 v128_abs_s8(v128 a) {
#endif
}
+SIMD_INLINE v128 v128_sign_s16(v128 a, v128 b) {
+#if defined(__SSSE3__)
+ return _mm_sign_epi16(a, b);
+#else
+ const v128 sign = _mm_srai_epi16(b, 15);
+ const v128 val = _mm_xor_si128(_mm_add_epi16(a, sign), sign);
+ return _mm_andnot_si128(_mm_cmpeq_epi16(b, _mm_setzero_si128()), val);
+#endif
+}
+
SIMD_INLINE v128 v128_ziplo_8(v128 a, v128 b) {
return _mm_unpacklo_epi8(b, a);
}
diff --git a/aom_dsp/simd/v256_intrinsics.h b/aom_dsp/simd/v256_intrinsics.h
index c07ec491e5..520e601253 100644
--- a/aom_dsp/simd/v256_intrinsics.h
+++ b/aom_dsp/simd/v256_intrinsics.h
@@ -128,6 +128,7 @@ SIMD_INLINE v256 v256_ssub_u16(v256 a, v256 b) { return c_v256_ssub_u16(a, b); }
SIMD_INLINE v256 v256_sub_32(v256 a, v256 b) { return c_v256_sub_32(a, b); }
SIMD_INLINE v256 v256_abs_s16(v256 a) { return c_v256_abs_s16(a); }
SIMD_INLINE v256 v256_abs_s8(v256 a) { return c_v256_abs_s8(a); }
+SIMD_INLINE v256 v256_sign_s16(v256 a, v256 b) { return c_v256_sign_s16(a, b); }
SIMD_INLINE v256 v256_mul_s16(v128 a, v128 b) { return c_v256_mul_s16(a, b); }
SIMD_INLINE v256 v256_mullo_s16(v256 a, v256 b) {
diff --git a/aom_dsp/simd/v256_intrinsics_c.h b/aom_dsp/simd/v256_intrinsics_c.h
index cbcc1b095f..9351246870 100644
--- a/aom_dsp/simd/v256_intrinsics_c.h
+++ b/aom_dsp/simd/v256_intrinsics_c.h
@@ -313,6 +313,11 @@ SIMD_INLINE c_v256 c_v256_abs_s8(c_v256 a) {
return c_v256_from_v128(c_v128_abs_s8(a.v128[1]), c_v128_abs_s8(a.v128[0]));
}
+SIMD_INLINE c_v256 c_v256_sign_s16(c_v256 a, c_v256 b) {
+ return c_v256_from_v128(c_v128_sign_s16(a.v128[1], b.v128[1]),
+ c_v128_sign_s16(a.v128[0], b.v128[0]));
+}
+
SIMD_INLINE c_v256 c_v256_mul_s16(c_v128 a, c_v128 b) {
c_v128 lo_bits = c_v128_mullo_s16(a, b);
c_v128 hi_bits = c_v128_mulhi_s16(a, b);
diff --git a/aom_dsp/simd/v256_intrinsics_v128.h b/aom_dsp/simd/v256_intrinsics_v128.h
index 03764b02b1..7a9b3415f6 100644
--- a/aom_dsp/simd/v256_intrinsics_v128.h
+++ b/aom_dsp/simd/v256_intrinsics_v128.h
@@ -273,6 +273,11 @@ SIMD_INLINE v256 v256_abs_s8(v256 a) {
return v256_from_v128(v128_abs_s8(a.val[1]), v128_abs_s8(a.val[0]));
}
+SIMD_INLINE v256 v256_sign_s16(v256 a, v256 b) {
+ return v256_from_v128(v128_sign_s16(a.val[1], b.val[1]),
+ v128_sign_s16(a.val[0], b.val[0]));
+}
+
SIMD_INLINE v256 v256_mul_s16(v128 a, v128 b) {
v128 lo_bits = v128_mullo_s16(a, b);
v128 hi_bits = v128_mulhi_s16(a, b);
diff --git a/aom_dsp/simd/v256_intrinsics_x86.h b/aom_dsp/simd/v256_intrinsics_x86.h
index ed0531d2b6..840699367b 100644
--- a/aom_dsp/simd/v256_intrinsics_x86.h
+++ b/aom_dsp/simd/v256_intrinsics_x86.h
@@ -136,6 +136,10 @@ SIMD_INLINE v256 v256_abs_s16(v256 a) { return _mm256_abs_epi16(a); }
SIMD_INLINE v256 v256_abs_s8(v256 a) { return _mm256_abs_epi8(a); }
+SIMD_INLINE v256 v256_sign_s16(v256 a, v256 b) {
+ return _mm256_sign_epi16(a, b);
+}
+
// AVX doesn't have the direct intrinsics to zip/unzip 8, 16, 32 bit
// lanes of lower or upper halves of a 256bit vector because the
// unpack/pack intrinsics operate on the 256 bit input vector as 2
diff --git a/aom_dsp/simd/v64_intrinsics.h b/aom_dsp/simd/v64_intrinsics.h
index 6b36ad4d3c..1417e57832 100644
--- a/aom_dsp/simd/v64_intrinsics.h
+++ b/aom_dsp/simd/v64_intrinsics.h
@@ -85,6 +85,7 @@ SIMD_INLINE v64 v64_ssub_u16(v64 a, v64 b) { return c_v64_ssub_u16(a, b); }
SIMD_INLINE v64 v64_sub_32(v64 a, v64 b) { return c_v64_sub_32(a, b); }
SIMD_INLINE v64 v64_abs_s16(v64 a) { return c_v64_abs_s16(a); }
SIMD_INLINE v64 v64_abs_s8(v64 a) { return c_v64_abs_s8(a); }
+SIMD_INLINE v64 v64_sign_s16(v64 a, v64 b) { return c_v64_sign_s16(a, b); }
SIMD_INLINE v64 v64_ziplo_8(v64 a, v64 b) { return c_v64_ziplo_8(a, b); }
SIMD_INLINE v64 v64_ziphi_8(v64 a, v64 b) { return c_v64_ziphi_8(a, b); }
diff --git a/aom_dsp/simd/v64_intrinsics_c.h b/aom_dsp/simd/v64_intrinsics_c.h
index adb0411283..b24f09a68b 100644
--- a/aom_dsp/simd/v64_intrinsics_c.h
+++ b/aom_dsp/simd/v64_intrinsics_c.h
@@ -284,6 +284,16 @@ SIMD_INLINE c_v64 c_v64_abs_s8(c_v64 a) {
return t;
}
+SIMD_INLINE c_v64 c_v64_sign_s16(c_v64 a, c_v64 b) {
+ c_v64 t;
+ int c;
+ for (c = 0; c < 4; c++) {
+ t.u16[c] = b.s16[c] < 0 ? (a.u16[c] ? (uint16_t)(65536u - a.u16[c]) : 0)
+ : (b.s16[c] > 0 ? a.u16[c] : 0);
+ }
+ return t;
+}
+
SIMD_INLINE c_v64 _c_v64_zip_8(c_v64 a, c_v64 b, int mode) {
c_v64 t;
if (mode) {
diff --git a/aom_dsp/simd/v64_intrinsics_x86.h b/aom_dsp/simd/v64_intrinsics_x86.h
index 78851a23eb..76d2df605d 100644
--- a/aom_dsp/simd/v64_intrinsics_x86.h
+++ b/aom_dsp/simd/v64_intrinsics_x86.h
@@ -150,6 +150,16 @@ SIMD_INLINE v64 v64_abs_s8(v64 a) {
#endif
}
+SIMD_INLINE v64 v64_sign_s16(v64 a, v64 b) {
+#if defined(__SSSE3__)
+ return _mm_sign_epi16(a, b);
+#else
+ const v64 sign = _mm_srai_epi16(b, 15);
+ const v64 val = _mm_xor_si128(_mm_add_epi16(a, sign), sign);
+ return _mm_andnot_si128(_mm_cmpeq_epi16(b, _mm_setzero_si128()), val);
+#endif
+}
+
SIMD_INLINE v64 v64_ziplo_8(v64 a, v64 b) { return _mm_unpacklo_epi8(b, a); }
SIMD_INLINE v64 v64_ziphi_8(v64 a, v64 b) {
diff --git a/av1/common/cdef_block.h b/av1/common/cdef_block.h
index 6016a67f2b..a5588eec05 100644
--- a/av1/common/cdef_block.h
+++ b/av1/common/cdef_block.h
@@ -31,10 +31,6 @@
#define CDEF_INBUF_SIZE \
(CDEF_BSTRIDE * ((1 << MAX_SB_SIZE_LOG2) + 2 * CDEF_VBORDER))
-extern const int cdef_pri_taps[2][2];
-extern const int cdef_sec_taps[2];
-extern const int (*const cdef_directions)[2];
-
typedef struct {
uint8_t by;
uint8_t bx;
@@ -47,6 +43,15 @@ typedef void (*cdef_filter_block_func)(void *dest, int dstride,
int coeff_shift, int block_width,
int block_height);
+#if defined(AOM_INTERNAL_HIDDEN_VISIBILITY) && defined(__ELF__) && \
+ (defined(__GNUC__) || defined(__clang__))
+#pragma GCC visibility push(hidden)
+#endif
+
+extern const int cdef_pri_taps[2][2];
+extern const int cdef_sec_taps[2];
+extern const int (*const cdef_directions)[2];
+
void av1_cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride,
const uint16_t *in, int xdec, int ydec,
int dir[CDEF_NBLOCKS][CDEF_NBLOCKS], int *dirinit,
@@ -54,6 +59,11 @@ void av1_cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride,
cdef_list *dlist, int cdef_count, int level,
int sec_strength, int damping, int coeff_shift);
+#if defined(AOM_INTERNAL_HIDDEN_VISIBILITY) && defined(__ELF__) && \
+ (defined(__GNUC__) || defined(__clang__))
+#pragma GCC visibility pop
+#endif
+
static inline void fill_rect(uint16_t *dst, int dstride, int v, int h,
uint16_t x) {
for (int i = 0; i < v; i++) {
diff --git a/av1/common/cdef_block_simd.h b/av1/common/cdef_block_simd.h
index 35a729d5b1..1d272fdfc2 100644
--- a/av1/common/cdef_block_simd.h
+++ b/av1/common/cdef_block_simd.h
@@ -12,11 +12,32 @@
#ifndef AOM_AV1_COMMON_CDEF_BLOCK_SIMD_H_
#define AOM_AV1_COMMON_CDEF_BLOCK_SIMD_H_
+#include <assert.h>
+#include <stdint.h>
+
#include "config/aom_config.h"
#include "config/av1_rtcd.h"
+#include "aom_dsp/aom_dsp_common.h"
#include "av1/common/cdef_block.h"
+static const int cdef_pri_taps_inline[2][2] = { { 4, 2 }, { 3, 3 } };
+
+DECLARE_ALIGNED(16, static const int, cdef_directions_padded_inline[12][2]) = {
+ { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0 },
+ { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1 },
+ { -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2 },
+ { 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2 },
+ { 0 * CDEF_BSTRIDE + 1, 0 * CDEF_BSTRIDE + 2 },
+ { 0 * CDEF_BSTRIDE + 1, 1 * CDEF_BSTRIDE + 2 },
+ { 1 * CDEF_BSTRIDE + 1, 2 * CDEF_BSTRIDE + 2 },
+ { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 1 },
+ { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0 },
+ { 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1 },
+ { -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2 },
+ { 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2 },
+};
+
/* partial A is a 16-bit vector of the form:
[x8 x7 x6 x5 x4 x3 x2 x1] and partial B has the form:
[0 y1 y2 y3 y4 y5 y6 y7].
@@ -209,12 +230,11 @@ int SIMD_FUNC(cdef_find_dir)(const uint16_t *img, int stride, int32_t *var,
// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp)))
CDEF_INLINE v256 constrain16(v256 a, v256 b, unsigned int threshold,
unsigned int adjdamp) {
- v256 diff = v256_sub_16(a, b);
- const v256 sign = v256_shr_n_s16(diff, 15);
- diff = v256_abs_s16(diff);
+ v256 raw_diff = v256_sub_16(a, b);
+ v256 diff = v256_abs_s16(raw_diff);
const v256 s =
v256_ssub_u16(v256_dup_16(threshold), v256_shr_u16(diff, adjdamp));
- return v256_xor(v256_add_16(sign, v256_min_s16(diff, s)), sign);
+ return v256_sign_s16(v256_min_s16(diff, s), raw_diff);
}
SIMD_INLINE v256 get_max_primary(const int is_lowbd, v256 *tap, v256 max,
@@ -240,37 +260,6 @@ SIMD_INLINE v256 get_max_primary(const int is_lowbd, v256 *tap, v256 max,
return max;
}
-SIMD_INLINE v256 get_max_secondary(const int is_lowbd, v256 *tap, v256 max,
- v256 cdef_large_value_mask) {
- if (is_lowbd) {
- v256 max_u8;
- max_u8 = tap[0];
- max_u8 = v256_max_u8(max_u8, tap[1]);
- max_u8 = v256_max_u8(max_u8, tap[2]);
- max_u8 = v256_max_u8(max_u8, tap[3]);
- max_u8 = v256_max_u8(max_u8, tap[4]);
- max_u8 = v256_max_u8(max_u8, tap[5]);
- max_u8 = v256_max_u8(max_u8, tap[6]);
- max_u8 = v256_max_u8(max_u8, tap[7]);
- /* The source is 16 bits, however, we only really care about the lower
- 8 bits. The upper 8 bits contain the "large" flag. After the final
- primary max has been calculated, zero out the upper 8 bits. Use this
- to find the "16 bit" max. */
- max = v256_max_s16(max, v256_and(max_u8, cdef_large_value_mask));
- } else {
- /* Convert CDEF_VERY_LARGE to 0 before calculating max. */
- max = v256_max_s16(max, v256_and(tap[0], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[1], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[2], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[3], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[4], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[5], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[6], cdef_large_value_mask));
- max = v256_max_s16(max, v256_and(tap[7], cdef_large_value_mask));
- }
- return max;
-}
-
// MSVC takes far too much time optimizing these.
// https://bugs.chromium.org/p/aomedia/issues/detail?id=3395
#if defined(_MSC_VER) && !defined(__clang__)
@@ -288,15 +277,15 @@ CDEF_INLINE void filter_block_4x4(const int is_lowbd, void *dest, int dstride,
v256 p0, p1, p2, p3;
v256 sum, row, res;
v256 max, min;
+ assert(dir >= 0 && dir < 8);
const v256 cdef_large_value_mask = v256_dup_16((uint16_t)~CDEF_VERY_LARGE);
- const int po1 = cdef_directions[dir][0];
- const int po2 = cdef_directions[dir][1];
- const int s1o1 = cdef_directions[dir + 2][0];
- const int s1o2 = cdef_directions[dir + 2][1];
- const int s2o1 = cdef_directions[dir - 2][0];
- const int s2o2 = cdef_directions[dir - 2][1];
- const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
- const int *sec_taps = cdef_sec_taps;
+ const int po1 = cdef_directions_padded_inline[dir + 2][0];
+ const int po2 = cdef_directions_padded_inline[dir + 2][1];
+ const int s1o1 = cdef_directions_padded_inline[dir + 4][0];
+ const int s1o2 = cdef_directions_padded_inline[dir + 4][1];
+ const int s2o1 = cdef_directions_padded_inline[dir][0];
+ const int s2o2 = cdef_directions_padded_inline[dir][1];
+ const int *pri_taps = cdef_pri_taps_inline[(pri_strength >> coeff_shift) & 1];
int i;
if (enable_primary && pri_strength)
@@ -305,6 +294,7 @@ CDEF_INLINE void filter_block_4x4(const int is_lowbd, void *dest, int dstride,
sec_damping = AOMMAX(0, sec_damping - get_msb(sec_strength));
for (i = 0; i < height; i += 4) {
+ v256 tap[4];
sum = v256_zero();
row = v256_from_v64(v64_load_aligned(&in[(i + 0) * CDEF_BSTRIDE]),
v64_load_aligned(&in[(i + 1) * CDEF_BSTRIDE]),
@@ -313,7 +303,6 @@ CDEF_INLINE void filter_block_4x4(const int is_lowbd, void *dest, int dstride,
max = min = row;
if (enable_primary) {
- v256 tap[4];
// Primary near taps
tap[0] =
v256_from_v64(v64_load_unaligned(&in[(i + 0) * CDEF_BSTRIDE + po1]),
@@ -352,15 +341,12 @@ CDEF_INLINE void filter_block_4x4(const int is_lowbd, void *dest, int dstride,
if (clipping_required) {
max = get_max_primary(is_lowbd, tap, max, cdef_large_value_mask);
- min = v256_min_s16(min, tap[0]);
- min = v256_min_s16(min, tap[1]);
- min = v256_min_s16(min, tap[2]);
- min = v256_min_s16(min, tap[3]);
+ min = v256_min_s16(min, v256_min_s16(v256_min_s16(tap[0], tap[1]),
+ v256_min_s16(tap[2], tap[3])));
}
}
if (enable_secondary) {
- v256 tap[8];
// Secondary near taps
tap[0] =
v256_from_v64(v64_load_unaligned(&in[(i + 0) * CDEF_BSTRIDE + s1o1]),
@@ -387,53 +373,51 @@ CDEF_INLINE void filter_block_4x4(const int is_lowbd, void *dest, int dstride,
v64_load_unaligned(&in[(i + 3) * CDEF_BSTRIDE - s2o1]));
p3 = constrain16(tap[3], row, sec_strength, sec_damping);
- // sum += sec_taps[0] * (p0 + p1 + p2 + p3)
- sum = v256_add_16(sum, v256_mullo_s16(v256_dup_16(sec_taps[0]),
- v256_add_16(v256_add_16(p0, p1),
- v256_add_16(p2, p3))));
+ // sum += 2 * (p0 + p1 + p2 + p3)
+ const v256 sec_near =
+ v256_add_16(v256_add_16(p0, p1), v256_add_16(p2, p3));
+ sum = v256_add_16(sum, v256_add_16(sec_near, sec_near));
+
+ if (clipping_required) {
+ max = get_max_primary(is_lowbd, tap, max, cdef_large_value_mask);
+ min = v256_min_s16(min, v256_min_s16(v256_min_s16(tap[0], tap[1]),
+ v256_min_s16(tap[2], tap[3])));
+ }
// Secondary far taps
- tap[4] =
+ tap[0] =
v256_from_v64(v64_load_unaligned(&in[(i + 0) * CDEF_BSTRIDE + s1o2]),
v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o2]),
v64_load_unaligned(&in[(i + 2) * CDEF_BSTRIDE + s1o2]),
v64_load_unaligned(&in[(i + 3) * CDEF_BSTRIDE + s1o2]));
- p0 = constrain16(tap[4], row, sec_strength, sec_damping);
- tap[5] =
+ p0 = constrain16(tap[0], row, sec_strength, sec_damping);
+ tap[1] =
v256_from_v64(v64_load_unaligned(&in[(i + 0) * CDEF_BSTRIDE - s1o2]),
v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o2]),
v64_load_unaligned(&in[(i + 2) * CDEF_BSTRIDE - s1o2]),
v64_load_unaligned(&in[(i + 3) * CDEF_BSTRIDE - s1o2]));
- p1 = constrain16(tap[5], row, sec_strength, sec_damping);
- tap[6] =
+ p1 = constrain16(tap[1], row, sec_strength, sec_damping);
+ tap[2] =
v256_from_v64(v64_load_unaligned(&in[(i + 0) * CDEF_BSTRIDE + s2o2]),
v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o2]),
v64_load_unaligned(&in[(i + 2) * CDEF_BSTRIDE + s2o2]),
v64_load_unaligned(&in[(i + 3) * CDEF_BSTRIDE + s2o2]));
- p2 = constrain16(tap[6], row, sec_strength, sec_damping);
- tap[7] =
+ p2 = constrain16(tap[2], row, sec_strength, sec_damping);
+ tap[3] =
v256_from_v64(v64_load_unaligned(&in[(i + 0) * CDEF_BSTRIDE - s2o2]),
v64_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o2]),
v64_load_unaligned(&in[(i + 2) * CDEF_BSTRIDE - s2o2]),
v64_load_unaligned(&in[(i + 3) * CDEF_BSTRIDE - s2o2]));
- p3 = constrain16(tap[7], row, sec_strength, sec_damping);
+ p3 = constrain16(tap[3], row, sec_strength, sec_damping);
- // sum += sec_taps[1] * (p0 + p1 + p2 + p3)
- sum = v256_add_16(sum, v256_mullo_s16(v256_dup_16(sec_taps[1]),
- v256_add_16(v256_add_16(p0, p1),
- v256_add_16(p2, p3))));
+ // sum += 1 * (p0 + p1 + p2 + p3)
+ sum = v256_add_16(sum,
+ v256_add_16(v256_add_16(p0, p1), v256_add_16(p2, p3)));
if (clipping_required) {
- max = get_max_secondary(is_lowbd, tap, max, cdef_large_value_mask);
-
- min = v256_min_s16(min, tap[0]);
- min = v256_min_s16(min, tap[1]);
- min = v256_min_s16(min, tap[2]);
- min = v256_min_s16(min, tap[3]);
- min = v256_min_s16(min, tap[4]);
- min = v256_min_s16(min, tap[5]);
- min = v256_min_s16(min, tap[6]);
- min = v256_min_s16(min, tap[7]);
+ max = get_max_primary(is_lowbd, tap, max, cdef_large_value_mask);
+ min = v256_min_s16(min, v256_min_s16(v256_min_s16(tap[0], tap[1]),
+ v256_min_s16(tap[2], tap[3])));
}
}
@@ -469,6 +453,16 @@ CDEF_INLINE void filter_block_4x4(const int is_lowbd, void *dest, int dstride,
}
}
+CDEF_INLINE void load_tap_pair_8x2(const uint16_t *in_row, intptr_t offset,
+ v256 *tap_pos, v256 *tap_neg) {
+ const uint16_t *p_pos = in_row + offset;
+ const uint16_t *p_neg = in_row - offset;
+ *tap_pos = v256_from_v128(v128_load_unaligned(p_pos),
+ v128_load_unaligned(p_pos + CDEF_BSTRIDE));
+ *tap_neg = v256_from_v128(v128_load_unaligned(p_neg),
+ v128_load_unaligned(p_neg + CDEF_BSTRIDE));
+}
+
CDEF_INLINE void filter_block_8x8(const int is_lowbd, void *dest, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir, int pri_damping,
@@ -480,36 +474,32 @@ CDEF_INLINE void filter_block_8x8(const int is_lowbd, void *dest, int dstride,
int i;
v256 sum, p0, p1, p2, p3, row, res;
const v256 cdef_large_value_mask = v256_dup_16((uint16_t)~CDEF_VERY_LARGE);
+ assert(dir >= 0 && dir < 8);
v256 max, min;
- const int po1 = cdef_directions[dir][0];
- const int po2 = cdef_directions[dir][1];
- const int s1o1 = cdef_directions[dir + 2][0];
- const int s1o2 = cdef_directions[dir + 2][1];
- const int s2o1 = cdef_directions[dir - 2][0];
- const int s2o2 = cdef_directions[dir - 2][1];
- const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
- const int *sec_taps = cdef_sec_taps;
+ const intptr_t po1 = cdef_directions_padded_inline[dir + 2][0];
+ const intptr_t po2 = cdef_directions_padded_inline[dir + 2][1];
+ const intptr_t s1o1 = cdef_directions_padded_inline[dir + 4][0];
+ const intptr_t s1o2 = cdef_directions_padded_inline[dir + 4][1];
+ const intptr_t s2o1 = cdef_directions_padded_inline[dir][0];
+ const intptr_t s2o2 = cdef_directions_padded_inline[dir][1];
+ const int *pri_taps = cdef_pri_taps_inline[(pri_strength >> coeff_shift) & 1];
if (enable_primary && pri_strength)
pri_damping = AOMMAX(0, pri_damping - get_msb(pri_strength));
if (enable_secondary && sec_strength)
sec_damping = AOMMAX(0, sec_damping - get_msb(sec_strength));
- for (i = 0; i < height; i += 2) {
- v256 tap[8];
+ const uint16_t *in_row = in;
+ for (i = 0; i < height; i += 2, in_row += 2 * CDEF_BSTRIDE) {
+ v256 tap[4];
sum = v256_zero();
- row = v256_from_v128(v128_load_aligned(&in[i * CDEF_BSTRIDE]),
- v128_load_aligned(&in[(i + 1) * CDEF_BSTRIDE]));
+ row = v256_from_v128(v128_load_aligned(in_row),
+ v128_load_aligned(in_row + CDEF_BSTRIDE));
min = max = row;
if (enable_primary) {
// Primary near taps
- tap[0] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE + po1]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po1]));
- tap[1] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE - po1]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po1]));
+ load_tap_pair_8x2(in_row, po1, &tap[0], &tap[1]);
p0 = constrain16(tap[0], row, pri_strength, pri_damping);
p1 = constrain16(tap[1], row, pri_strength, pri_damping);
@@ -518,12 +508,7 @@ CDEF_INLINE void filter_block_8x8(const int is_lowbd, void *dest, int dstride,
sum, v256_mullo_s16(v256_dup_16(pri_taps[0]), v256_add_16(p0, p1)));
// Primary far taps
- tap[2] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE + po2]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + po2]));
- tap[3] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE - po2]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - po2]));
+ load_tap_pair_8x2(in_row, po2, &tap[2], &tap[3]);
p0 = constrain16(tap[2], row, pri_strength, pri_damping);
p1 = constrain16(tap[3], row, pri_strength, pri_damping);
@@ -534,72 +519,48 @@ CDEF_INLINE void filter_block_8x8(const int is_lowbd, void *dest, int dstride,
if (clipping_required) {
max = get_max_primary(is_lowbd, tap, max, cdef_large_value_mask);
- min = v256_min_s16(min, tap[0]);
- min = v256_min_s16(min, tap[1]);
- min = v256_min_s16(min, tap[2]);
- min = v256_min_s16(min, tap[3]);
+ min = v256_min_s16(min, v256_min_s16(v256_min_s16(tap[0], tap[1]),
+ v256_min_s16(tap[2], tap[3])));
}
// End primary
}
if (enable_secondary) {
// Secondary near taps
- tap[0] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE + s1o1]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o1]));
- tap[1] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE - s1o1]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o1]));
- tap[2] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE + s2o1]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o1]));
- tap[3] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE - s2o1]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o1]));
+ load_tap_pair_8x2(in_row, s1o1, &tap[0], &tap[1]);
+ load_tap_pair_8x2(in_row, s2o1, &tap[2], &tap[3]);
p0 = constrain16(tap[0], row, sec_strength, sec_damping);
p1 = constrain16(tap[1], row, sec_strength, sec_damping);
p2 = constrain16(tap[2], row, sec_strength, sec_damping);
p3 = constrain16(tap[3], row, sec_strength, sec_damping);
- // sum += sec_taps[0] * (p0 + p1 + p2 + p3)
- sum = v256_add_16(sum, v256_mullo_s16(v256_dup_16(sec_taps[0]),
- v256_add_16(v256_add_16(p0, p1),
- v256_add_16(p2, p3))));
+ // sum += 2 * (p0 + p1 + p2 + p3)
+ const v256 sec_near =
+ v256_add_16(v256_add_16(p0, p1), v256_add_16(p2, p3));
+ sum = v256_add_16(sum, v256_add_16(sec_near, sec_near));
+
+ if (clipping_required) {
+ max = get_max_primary(is_lowbd, tap, max, cdef_large_value_mask);
+ min = v256_min_s16(min, v256_min_s16(v256_min_s16(tap[0], tap[1]),
+ v256_min_s16(tap[2], tap[3])));
+ }
// Secondary far taps
- tap[4] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE + s1o2]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s1o2]));
- tap[5] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE - s1o2]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s1o2]));
- tap[6] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE + s2o2]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE + s2o2]));
- tap[7] = v256_from_v128(
- v128_load_unaligned(&in[i * CDEF_BSTRIDE - s2o2]),
- v128_load_unaligned(&in[(i + 1) * CDEF_BSTRIDE - s2o2]));
- p0 = constrain16(tap[4], row, sec_strength, sec_damping);
- p1 = constrain16(tap[5], row, sec_strength, sec_damping);
- p2 = constrain16(tap[6], row, sec_strength, sec_damping);
- p3 = constrain16(tap[7], row, sec_strength, sec_damping);
-
- // sum += sec_taps[1] * (p0 + p1 + p2 + p3)
- sum = v256_add_16(sum, v256_mullo_s16(v256_dup_16(sec_taps[1]),
- v256_add_16(v256_add_16(p0, p1),
- v256_add_16(p2, p3))));
+ load_tap_pair_8x2(in_row, s1o2, &tap[0], &tap[1]);
+ load_tap_pair_8x2(in_row, s2o2, &tap[2], &tap[3]);
+ p0 = constrain16(tap[0], row, sec_strength, sec_damping);
+ p1 = constrain16(tap[1], row, sec_strength, sec_damping);
+ p2 = constrain16(tap[2], row, sec_strength, sec_damping);
+ p3 = constrain16(tap[3], row, sec_strength, sec_damping);
+
+ // sum += 1 * (p0 + p1 + p2 + p3)
+ sum = v256_add_16(sum,
+ v256_add_16(v256_add_16(p0, p1), v256_add_16(p2, p3)));
if (clipping_required) {
- max = get_max_secondary(is_lowbd, tap, max, cdef_large_value_mask);
-
- min = v256_min_s16(min, tap[0]);
- min = v256_min_s16(min, tap[1]);
- min = v256_min_s16(min, tap[2]);
- min = v256_min_s16(min, tap[3]);
- min = v256_min_s16(min, tap[4]);
- min = v256_min_s16(min, tap[5]);
- min = v256_min_s16(min, tap[6]);
- min = v256_min_s16(min, tap[7]);
+ max = get_max_primary(is_lowbd, tap, max, cdef_large_value_mask);
+ min = v256_min_s16(min, v256_min_s16(v256_min_s16(tap[0], tap[1]),
+ v256_min_s16(tap[2], tap[3])));
}
// End secondary
}
diff --git a/test/simd_cmp_impl.inc b/test/simd_cmp_impl.inc
index a2373d7786..792b6182cc 100644
--- a/test/simd_cmp_impl.inc
+++ b/test/simd_cmp_impl.inc
@@ -10,6 +10,7 @@
*/
#include <assert.h>
+#include <stdint.h>
#include <string>
#include "config/aom_dsp_rtcd.h"
@@ -528,6 +529,7 @@ const mapping m[] = { MAP(v64_sad_u8),
MAP(v64_cmpgt_s16),
MAP(v64_cmplt_s16),
MAP(v64_cmpeq_16),
+ MAP(v64_sign_s16),
MAP(v64_shuffle_8),
MAP(imm_v64_align<1>),
MAP(imm_v64_align<2>),
@@ -738,6 +740,7 @@ const mapping m[] = { MAP(v64_sad_u8),
MAP(imm_v128_align<15>),
MAP(v128_abs_s8),
MAP(v128_abs_s16),
+ MAP(v128_sign_s16),
MAP(v128_padd_u8),
MAP(v128_padd_s16),
MAP(v128_unpacklo_u16_s32),
@@ -1069,6 +1072,7 @@ const mapping m[] = { MAP(v64_sad_u8),
MAP(v256_shr_s64),
MAP(v256_abs_s8),
MAP(v256_abs_s16),
+ MAP(v256_sign_s16),
MAP(v256_padd_u8),
MAP(v256_padd_s16),
MAP(v256_unpacklo_u16_s32),
@@ -2172,4 +2176,81 @@ template void TestSimd3Args<c_v256, c_v256, c_v256, c_v256>(uint32_t, uint32_t,
uint32_t,
const char *);
+void TestSignS16EdgeCases();
+
+void TestSignS16EdgeCases() {
+ const int16_t a_vals[] = { 0, 1, -1, 42, -42, INT16_MIN, INT16_MAX };
+ const int16_t b_vals[] = { 0, 1, -1, 100, -100, INT16_MIN, INT16_MAX };
+ const auto expected_sign_s16 = [](int16_t a, int16_t b) -> int16_t {
+ if (b == 0) return 0;
+ if (b > 0) return a;
+ return (a == INT16_MIN) ? INT16_MIN : static_cast<int16_t>(-a);
+ };
+ DECLARE_ALIGNED(32, int16_t, a_buf[16]);
+ DECLARE_ALIGNED(32, int16_t, b_buf[16]);
+ DECLARE_ALIGNED(32, int16_t, out_simd[16]);
+ DECLARE_ALIGNED(32, int16_t, out_ref[16]);
+
+ const auto verify_all_widths = [&]() {
+ v64_store_aligned(out_simd, v64_sign_s16(v64_load_aligned(a_buf),
+ v64_load_aligned(b_buf)));
+ c_v64_store_aligned(out_ref, c_v64_sign_s16(c_v64_load_aligned(a_buf),
+ c_v64_load_aligned(b_buf)));
+ for (int lane = 0; lane < 4; ++lane) {
+ const int16_t exp = expected_sign_s16(a_buf[lane], b_buf[lane]);
+ ASSERT_EQ(out_ref[lane], exp)
+ << "lane=" << lane << " a=" << a_buf[lane] << " b=" << b_buf[lane];
+ ASSERT_EQ(out_simd[lane], exp)
+ << "lane=" << lane << " a=" << a_buf[lane] << " b=" << b_buf[lane];
+ }
+
+ v128_store_aligned(out_simd, v128_sign_s16(v128_load_aligned(a_buf),
+ v128_load_aligned(b_buf)));
+ c_v128_store_aligned(out_ref, c_v128_sign_s16(c_v128_load_aligned(a_buf),
+ c_v128_load_aligned(b_buf)));
+ for (int lane = 0; lane < 8; ++lane) {
+ const int16_t exp = expected_sign_s16(a_buf[lane], b_buf[lane]);
+ ASSERT_EQ(out_ref[lane], exp)
+ << "lane=" << lane << " a=" << a_buf[lane] << " b=" << b_buf[lane];
+ ASSERT_EQ(out_simd[lane], exp)
+ << "lane=" << lane << " a=" << a_buf[lane] << " b=" << b_buf[lane];
+ }
+
+ v256_store_aligned(out_simd, v256_sign_s16(v256_load_aligned(a_buf),
+ v256_load_aligned(b_buf)));
+ c_v256_store_aligned(out_ref, c_v256_sign_s16(c_v256_load_aligned(a_buf),
+ c_v256_load_aligned(b_buf)));
+ for (int lane = 0; lane < 16; ++lane) {
+ const int16_t exp = expected_sign_s16(a_buf[lane], b_buf[lane]);
+ ASSERT_EQ(out_ref[lane], exp)
+ << "lane=" << lane << " a=" << a_buf[lane] << " b=" << b_buf[lane];
+ ASSERT_EQ(out_simd[lane], exp)
+ << "lane=" << lane << " a=" << a_buf[lane] << " b=" << b_buf[lane];
+ }
+ };
+
+ for (int16_t av : a_vals) {
+ for (int16_t bv : b_vals) {
+ for (int lane = 0; lane < 16; ++lane) {
+ a_buf[lane] = av;
+ b_buf[lane] = bv;
+ }
+ verify_all_widths();
+ }
+ }
+
+ // Mixed-lane pass to catch cross-lane swizzles or lane-bleed bugs.
+ constexpr int kNumA = static_cast<int>(sizeof(a_vals) / sizeof(a_vals[0]));
+ constexpr int kNumB = static_cast<int>(sizeof(b_vals) / sizeof(b_vals[0]));
+ constexpr int kTotalPairs = kNumA * kNumB;
+ for (int offset = 0; offset < kTotalPairs; ++offset) {
+ for (int lane = 0; lane < 16; ++lane) {
+ const int pair_idx = (offset + lane * 3) % kTotalPairs;
+ a_buf[lane] = a_vals[pair_idx / kNumB];
+ b_buf[lane] = b_vals[pair_idx % kNumB];
+ }
+ verify_all_widths();
+ }
+}
+
} // namespace SIMD_NAMESPACE
diff --git a/test/simd_impl.h b/test/simd_impl.h
index cb5b2d6859..5f6563290a 100644
--- a/test/simd_impl.h
+++ b/test/simd_impl.h
@@ -112,6 +112,8 @@ template <typename c_ret, typename c_arg1, typename c_arg2, typename c_arg3>
void TestSimd3Args(uint32_t iterations, uint32_t mask, uint32_t maskwidth,
const char *name);
+void TestSignS16EdgeCases();
+
const int kIterations = 65536;
// Add a macro layer since TEST_P will quote the name so we need to
@@ -394,7 +396,7 @@ INSTANTIATE(
SIMD_TUPLE(imm_v64_align<1>, 0U, 0U), SIMD_TUPLE(imm_v64_align<2>, 0U, 0U),
SIMD_TUPLE(imm_v64_align<3>, 0U, 0U), SIMD_TUPLE(imm_v64_align<4>, 0U, 0U),
SIMD_TUPLE(imm_v64_align<5>, 0U, 0U), SIMD_TUPLE(imm_v64_align<6>, 0U, 0U),
- SIMD_TUPLE(imm_v64_align<7>, 0U, 0U));
+ SIMD_TUPLE(imm_v64_align<7>, 0U, 0U), SIMD_TUPLE(v64_sign_s16, 0U, 0U));
INSTANTIATE(ARCH, ARCH_POSTFIX(V64_V64), SIMD_TUPLE(v64_abs_s8, 0U, 0U),
SIMD_TUPLE(v64_abs_s16, 0U, 0U),
@@ -553,32 +555,30 @@ INSTANTIATE(
SIMD_TUPLE(v128_cmplt_s8, 0U, 0U), SIMD_TUPLE(v128_cmpeq_8, 0U, 0U),
SIMD_TUPLE(v128_cmpgt_s16, 0U, 0U));
-INSTANTIATE(ARCH, ARCH_POSTFIX(V128_V128V128_Part2),
- SIMD_TUPLE(v128_pack_s32_u16, 0U, 0U),
- SIMD_TUPLE(v128_rdavg_u16, 0U, 0U), SIMD_TUPLE(v128_add_64, 0U, 0U),
- SIMD_TUPLE(v128_sub_64, 0U, 0U), SIMD_TUPLE(v128_sadd_s8, 0U, 0U),
- SIMD_TUPLE(v128_sadd_u8, 0U, 0U), SIMD_TUPLE(v128_cmpeq_16, 0U, 0U),
- SIMD_TUPLE(v128_cmplt_s16, 0U, 0U),
- SIMD_TUPLE(v128_cmplt_s32, 0U, 0U),
- SIMD_TUPLE(v128_cmpeq_32, 0U, 0U),
- SIMD_TUPLE(v128_cmpgt_s32, 0U, 0U),
- SIMD_TUPLE(v128_shuffle_8, 15U, 8U),
- SIMD_TUPLE(v128_min_s32, 0U, 0U), SIMD_TUPLE(v128_max_s32, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<1>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<2>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<3>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<4>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<5>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<6>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<7>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<8>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<9>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<10>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<11>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<12>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<13>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<14>, 0U, 0U),
- SIMD_TUPLE(imm_v128_align<15>, 0U, 0U));
+INSTANTIATE(
+ ARCH, ARCH_POSTFIX(V128_V128V128_Part2),
+ SIMD_TUPLE(v128_pack_s32_u16, 0U, 0U), SIMD_TUPLE(v128_rdavg_u16, 0U, 0U),
+ SIMD_TUPLE(v128_add_64, 0U, 0U), SIMD_TUPLE(v128_sub_64, 0U, 0U),
+ SIMD_TUPLE(v128_sadd_s8, 0U, 0U), SIMD_TUPLE(v128_sadd_u8, 0U, 0U),
+ SIMD_TUPLE(v128_cmpeq_16, 0U, 0U), SIMD_TUPLE(v128_cmplt_s16, 0U, 0U),
+ SIMD_TUPLE(v128_cmplt_s32, 0U, 0U), SIMD_TUPLE(v128_cmpeq_32, 0U, 0U),
+ SIMD_TUPLE(v128_cmpgt_s32, 0U, 0U), SIMD_TUPLE(v128_shuffle_8, 15U, 8U),
+ SIMD_TUPLE(v128_min_s32, 0U, 0U), SIMD_TUPLE(v128_max_s32, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<9>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<10>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<11>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<13>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v128_align<15>, 0U, 0U), SIMD_TUPLE(v128_sign_s16, 0U, 0U));
INSTANTIATE(ARCH, ARCH_POSTFIX(V128_V128V128V128),
SIMD_TUPLE(v128_blend_8, 0U, 0U));
@@ -869,7 +869,7 @@ INSTANTIATE(
SIMD_TUPLE(imm_v256_align<28>, 0U, 0U),
SIMD_TUPLE(imm_v256_align<29>, 0U, 0U),
SIMD_TUPLE(imm_v256_align<30>, 0U, 0U),
- SIMD_TUPLE(imm_v256_align<31>, 0U, 0U));
+ SIMD_TUPLE(imm_v256_align<31>, 0U, 0U), SIMD_TUPLE(v256_sign_s16, 0U, 0U));
INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V128V128),
SIMD_TUPLE(v256_from_v128, 0U, 0U), SIMD_TUPLE(v256_zip_8, 0U, 0U),
@@ -1137,4 +1137,6 @@ INSTANTIATE(ARCH, ARCH_POSTFIX(U32_V256), SIMD_TUPLE(v256_low_u32, 0U, 0U),
INSTANTIATE(ARCH, ARCH_POSTFIX(V64_V256), SIMD_TUPLE(v256_low_v64, 0U, 0U));
+TEST(ARCH, ARCH_POSTFIX(SignS16EdgeCases)) { TestSignS16EdgeCases(); }
+
} // namespace SIMD_NAMESPACE