]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
use correct function names for AVX512, fix build failure v5.4.1+vectorscan
authorKonstantinos Margaritis <markos@freevec.org>
Mon, 15 Feb 2021 11:52:28 +0000 (13:52 +0200)
committerKonstantinos Margaritis <markos@users.noreply.github.com>
Mon, 15 Feb 2021 11:54:19 +0000 (13:54 +0200)
13 files changed:
src/fdr/teddy.c
src/fdr/teddy_avx2.c
src/hwlm/noodle_engine_avx512.c
src/nfa/limex_exceptional.h
src/nfa/mcsheng.c
src/nfa/sheng_impl.h
src/nfa/sheng_impl4.h
src/nfa/shufti.c
src/nfa/truffle.c
src/nfa/vermicelli_sse.h
src/rose/validate_shufti.h
src/util/state_compress.c
unit/internal/simd_utils.cpp

index 6898b6d40ea8f56cfd7f1ab18c7c7a81817efa22..3e46a0d67cd7e7bf4abecd7ba122520dc2faa27e 100644 (file)
@@ -468,7 +468,7 @@ do {                                                                        \
     *c_16 = *(ptr + 15);                                                    \
     *c_32 = *(ptr + 31);                                                    \
     *c_48 = *(ptr + 47);                                                    \
-    m512 r_msk = set512_64(0ULL, r_msk_base[*c_48], 0ULL, r_msk_base[*c_32],\
+    m512 r_msk = set8x64(0ULL, r_msk_base[*c_48], 0ULL, r_msk_base[*c_32],\
                            0ULL, r_msk_base[*c_16], 0ULL, r_msk_base[*c_0]);\
     *c_0 = *(ptr + 63)
 
index 9bde3036765e1113521987ddc3a5a2ea2d695bbd..e17e78726695fd9f6d35bfa80bb54cbe2e728c2d 100644 (file)
@@ -383,7 +383,7 @@ m512 prep_conf_fat_teddy_m4(const m512 *lo_mask, const m512 *dup_mask,
  */
 
 #define PREPARE_FAT_MASKS(n)                                                  \
-    m512 lo_mask = set64x8(0xf);                                              \
+    m512 lo_mask = set1_64x8(0xf);                                              \
     m512 sl_msk[n - 1];                                                       \
     FAT_TEDDY_VBMI_LOAD_SHIFT_MASK_M##n
 
index 8cac1b15c2209af1508e038103b4d445e452a404..1a925fbff5930272a4cbaf42c1b053400216f9e8 100644 (file)
 static really_inline
 m512 getMask(u8 c, bool noCase) {
     u8 k = caseClear8(c, noCase);
-    return set64x8(k);
+    return set1_64x8(k);
 }
 
 static really_inline
 m512 getCaseMask(void) {
-    return set64x8(CASE_CLEAR);
+    return set1_64x8(CASE_CLEAR);
 }
 
 // The short scan routine. It is used both to scan data up to an
index 6c7335f1b989f1affddbc6dae161f10902caac9f..c9de3aed4055a55bc9ea0f52815003b2503502c4 100644 (file)
@@ -47,7 +47,7 @@
 #define AND_STATE               JOIN(and_, STATE_T)
 #define EQ_STATE(a, b)          (!JOIN(noteq_, STATE_T)((a), (b)))
 #define OR_STATE                JOIN(or_, STATE_T)
-#define EXPAND_STATE            JOIN(expand_, STATE_T)
+#define EXPAND_STATE            JOIN(broadcast_, STATE_T)
 #define SHUFFLE_BYTE_STATE      JOIN(shuffle_byte_, STATE_T)
 #define TESTBIT_STATE           JOIN(testbit_, STATE_T)
 #define EXCEPTION_T             JOIN(struct NFAException, SIZE)
index a656d4c583497c8d4fa29e002c0cdd0947f9f795..c52bf31c22525785f106530ed1f0bf83b6d1c83b 100644 (file)
@@ -1490,7 +1490,7 @@ u32 doSheng64(const struct mcsheng64 *m, const u8 **c_inout, const u8 *soft_c_en
     assert(s_in); /* should not already be dead */
     assert(soft_c_end <= hard_c_end);
     DEBUG_PRINTF("s_in = %u (adjusted %u)\n", s_in, s_in - 1);
-    m512 s = set64x8(s_in - 1);
+    m512 s = set1_64x8(s_in - 1);
     const u8 *c = *c_inout;
     const u8 *c_end = hard_c_end - SHENG_CHUNK + 1;
     if (!do_accel) {
@@ -1509,8 +1509,8 @@ u32 doSheng64(const struct mcsheng64 *m, const u8 **c_inout, const u8 *soft_c_en
 
 #if defined(HAVE_BMI2) && defined(ARCH_64_BIT)
     u32 sheng_limit_x4 = sheng_limit * 0x01010101;
-    m512 simd_stop_limit = set16x32(sheng_stop_limit_x4);
-    m512 accel_delta = set64x8(sheng_limit - sheng_stop_limit);
+    m512 simd_stop_limit = set1_16x32(sheng_stop_limit_x4);
+    m512 accel_delta = set1_64x8(sheng_limit - sheng_stop_limit);
     DEBUG_PRINTF("end %hhu, accel %hu --> limit %hhu\n", sheng_limit,
                  m->sheng_accel_limit, sheng_stop_limit);
 #endif
index 17f929abdac91d13803ed4cee675175f4bb43723..1fa5c8317c591c4ba5a4a55af0bc6ca8c9ff09b8 100644 (file)
@@ -114,7 +114,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
     }
     DEBUG_PRINTF("Scanning %lli bytes\n", (s64a)(end - start));
 
-    m512 cur_state = set64x8(*state);
+    m512 cur_state = set1_64x8(*state);
     const m512 *masks = s->succ_masks;
 
     while (likely(cur_buf != end)) {
@@ -175,7 +175,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
     }
     DEBUG_PRINTF("Scanning %lli bytes\n", (s64a)(end - start));
 
-    m512 cur_state = set64x8(*state);
+    m512 cur_state = set1_64x8(*state);
     const m512 *masks = s->succ_masks;
 
     while (likely(cur_buf != end)) {
index a2c325fdd3cffa3667e3d0fe18a143b5aef1af3e..e5d3468f44984766f60514658802d874647815d1 100644 (file)
@@ -320,7 +320,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
         return MO_CONTINUE_MATCHING;
     }
 
-    m512 cur_state = set64x8(*state);
+    m512 cur_state = set1_64x8(*state);
     const m512 *masks = s->succ_masks;
 
     while (likely(end - cur_buf >= 4)) {
@@ -542,7 +542,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
         return MO_CONTINUE_MATCHING;
     }
 
-    m512 cur_state = set64x8(*state);
+    m512 cur_state = set1_64x8(*state);
     const m512 *masks = s->succ_masks;
 
     while (likely(end - cur_buf >= 4)) {
index f1f2befcec3dd6cba9c1541cccb65bab1c4a7045..4f7cae2e1e0fe5eb5e30c46683e8705db4b4b234 100644 (file)
@@ -829,10 +829,10 @@ const u8 *shuftiExec(m128 mask_lo, m128 mask_hi, const u8 *buf,
     DEBUG_PRINTF("shufti %p len %zu\n", buf, buf_end - buf);
     DEBUG_PRINTF("b %s\n", buf);
 
-    const m512 low4bits = set64x8(0xf);
+    const m512 low4bits = set1_64x8(0xf);
     const m512 zeroes = zeroes512();
-    const m512 wide_mask_lo = set4x128(mask_lo);
-    const m512 wide_mask_hi = set4x128(mask_hi);
+    const m512 wide_mask_lo = set1_4x128(mask_lo);
+    const m512 wide_mask_hi = set1_4x128(mask_hi);
     const u8 *rv;
 
     // small cases.
@@ -941,10 +941,10 @@ const u8 *rshuftiExec(m128 mask_lo, m128 mask_hi, const u8 *buf,
     assert(buf && buf_end);
     assert(buf < buf_end);
 
-    const m512 low4bits = set64x8(0xf);
+    const m512 low4bits = set1_64x8(0xf);
     const m512 zeroes = zeroes512();
-    const m512 wide_mask_lo = set4x128(mask_lo);
-    const m512 wide_mask_hi = set4x128(mask_hi);
+    const m512 wide_mask_lo = set1_4x128(mask_lo);
+    const m512 wide_mask_hi = set1_4x128(mask_hi);
     const u8 *rv;
 
     if (buf_end - buf < 64) {
@@ -1051,11 +1051,11 @@ const u8 *shuftiDoubleExec(m128 mask1_lo, m128 mask1_hi,
     DEBUG_PRINTF("buf %p len %zu\n", buf, buf_end - buf);
 
     const m512 ones = ones512();
-    const m512 low4bits = set64x8(0xf);
-    const m512 wide_mask1_lo = set4x128(mask1_lo);
-    const m512 wide_mask1_hi = set4x128(mask1_hi);
-    const m512 wide_mask2_lo = set4x128(mask2_lo);
-    const m512 wide_mask2_hi = set4x128(mask2_hi);
+    const m512 low4bits = set1_64x8(0xf);
+    const m512 wide_mask1_lo = set1_4x128(mask1_lo);
+    const m512 wide_mask1_hi = set1_4x128(mask1_hi);
+    const m512 wide_mask2_lo = set1_4x128(mask2_lo);
+    const m512 wide_mask2_hi = set1_4x128(mask2_hi);
     const u8 *rv;
 
     if (buf_end - buf <= 64) {
index 37af13ad80d4c5a75d0642a2fc231ee15d64f229..eff1d95e7aff134a0740204ac6f178007510fe37 100644 (file)
@@ -452,8 +452,8 @@ const u8 *firstMatch(const u8 *buf, u64a z) {
 
 static really_inline
 u64a block(m512 shuf_mask_lo_highclear, m512 shuf_mask_lo_highset, m512 v) {
-    m512 highconst = set64x8(0x80);
-    m512 shuf_mask_hi = set8x64(0x8040201008040201);
+    m512 highconst = set1_64x8(0x80);
+    m512 shuf_mask_hi = set1_8x64(0x8040201008040201);
 
     // and now do the real work
     m512 shuf1 = pshufb_m512(shuf_mask_lo_highclear, v);
@@ -501,8 +501,8 @@ const u8 *revBlock(m512 shuf_mask_lo_highclear, m512 shuf_mask_lo_highset,
 const u8 *truffleExec(m128 shuf_mask_lo_highclear, m128 shuf_mask_lo_highset,
                       const u8 *buf, const u8 *buf_end) {
     DEBUG_PRINTF("len %zu\n", buf_end - buf);
-    const m512 wide_clear = set4x128(shuf_mask_lo_highclear);
-    const m512 wide_set = set4x128(shuf_mask_lo_highset);
+    const m512 wide_clear = set1_4x128(shuf_mask_lo_highclear);
+    const m512 wide_set = set1_4x128(shuf_mask_lo_highset);
 
     assert(buf && buf_end);
     assert(buf < buf_end);
@@ -563,8 +563,8 @@ const u8 *truffleRevMini(m512 shuf_mask_lo_highclear, m512 shuf_mask_lo_highset,
 
 const u8 *rtruffleExec(m128 shuf_mask_lo_highclear, m128 shuf_mask_lo_highset,
                        const u8 *buf, const u8 *buf_end) {
-    const m512 wide_clear = set4x128(shuf_mask_lo_highclear);
-    const m512 wide_set = set4x128(shuf_mask_lo_highset);
+    const m512 wide_clear = set1_4x128(shuf_mask_lo_highclear);
+    const m512 wide_set = set1_4x128(shuf_mask_lo_highset);
     assert(buf && buf_end);
     assert(buf < buf_end);
     const u8 *rv;
index dc56a5f13717ef57e970e510854b24ab5f9c6a5b..12001f4f55261c0fd5a7eaddd0269dfbb6086884 100644 (file)
@@ -424,7 +424,7 @@ const u8 *vermMiniNocase(m512 chars, const u8 *buf, const u8 *buf_end,
     uintptr_t len = buf_end - buf;
     __mmask64 mask = (~0ULL) >> (64 - len);
     m512 data = loadu_maskz_m512(mask, buf);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 v = and512(casemask, data);
 
     u64a z = eq512mask(chars, v);
@@ -461,7 +461,7 @@ static really_inline
 const u8 *vermSearchAlignedNocase(m512 chars, const u8 *buf,
                                   const u8 *buf_end, char negate) {
     assert((size_t)buf % 64 == 0);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
 
     for (; buf + 63 < buf_end; buf += 64) {
         m512 data = load512(buf);
@@ -494,7 +494,7 @@ const u8 *vermUnalign(m512 chars, const u8 *buf, char negate) {
 // returns NULL if not found
 static really_inline
 const u8 *vermUnalignNocase(m512 chars, const u8 *buf, char negate) {
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 data = loadu512(buf); // unaligned
     u64a z = eq512mask(chars, and512(casemask, data));
     if (negate) {
@@ -529,7 +529,7 @@ const u8 *dvermMiniNocase(m512 chars1, m512 chars2, const u8 *buf,
     uintptr_t len = buf_end - buf;
     __mmask64 mask = (~0ULL) >> (64 - len);
     m512 data = loadu_maskz_m512(mask, buf);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 v = and512(casemask, data);
 
     u64a z = eq512mask(chars1, v) & (eq512mask(chars2, v) >> 1);
@@ -583,7 +583,7 @@ static really_inline
 const u8 *dvermSearchAlignedNocase(m512 chars1, m512 chars2, u8 c1, u8 c2,
                                    const u8 *buf, const u8 *buf_end) {
     assert((size_t)buf % 64 == 0);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
 
     for (; buf + 64 < buf_end; buf += 64) {
         m512 data = load512(buf);
@@ -643,7 +643,7 @@ const u8 *dvermPrecondition(m512 chars1, m512 chars2, const u8 *buf) {
 static really_inline
 const u8 *dvermPreconditionNocase(m512 chars1, m512 chars2, const u8 *buf) {
     /* due to laziness, nonalphas and nocase having interesting behaviour */
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 data = loadu512(buf); // unaligned
     m512 v = and512(casemask, data);
     u64a z = eq512mask(chars1, v) & (eq512mask(chars2, v) >> 1);
@@ -703,7 +703,7 @@ const u8 *rvermMiniNocase(m512 chars, const u8 *buf, const u8 *buf_end,
     uintptr_t len = buf_end - buf;
     __mmask64 mask = (~0ULL) >> (64 - len);
     m512 data = loadu_maskz_m512(mask, buf);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 v = and512(casemask, data);
 
     u64a z = eq512mask(chars, v);
@@ -739,7 +739,7 @@ static really_inline
 const u8 *rvermSearchAlignedNocase(m512 chars, const u8 *buf,
                                    const u8 *buf_end, char negate) {
     assert((size_t)buf_end % 64 == 0);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
 
     for (; buf + 63 < buf_end; buf_end -= 64) {
         m512 data = load512(buf_end - 64);
@@ -771,7 +771,7 @@ const u8 *rvermUnalign(m512 chars, const u8 *buf, char negate) {
 // returns NULL if not found
 static really_inline
 const u8 *rvermUnalignNocase(m512 chars, const u8 *buf, char negate) {
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 data = loadu512(buf); // unaligned
     u64a z = eq512mask(chars, and512(casemask, data));
     if (negate) {
@@ -805,7 +805,7 @@ const u8 *rdvermMiniNocase(m512 chars1, m512 chars2, const u8 *buf,
     uintptr_t len = buf_end - buf;
     __mmask64 mask = (~0ULL) >> (64 - len);
     m512 data = loadu_maskz_m512(mask, buf);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 v = and512(casemask, data);
 
     u64a z = eq512mask(chars2, v) & (eq512mask(chars1, v) << 1);
@@ -839,7 +839,7 @@ static really_inline
 const u8 *rdvermSearchAlignedNocase(m512 chars1, m512 chars2, u8 c1, u8 c2,
                                     const u8 *buf, const u8 *buf_end) {
     assert((size_t)buf_end % 64 == 0);
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
 
     for (; buf + 64 < buf_end; buf_end -= 64) {
         m512 data = load512(buf_end - 64);
@@ -874,7 +874,7 @@ const u8 *rdvermPrecondition(m512 chars1, m512 chars2, const u8 *buf) {
 static really_inline
 const u8 *rdvermPreconditionNocase(m512 chars1, m512 chars2, const u8 *buf) {
     // due to laziness, nonalphas and nocase having interesting behaviour
-    m512 casemask = set64x8(CASE_CLEAR);
+    m512 casemask = set1_64x8(CASE_CLEAR);
     m512 data = loadu512(buf);
     m512 v = and512(casemask, data);
     u64a z = eq512mask(chars2, v) & (eq512mask(chars1, v) << 1);
index 884270279745d3ce5d1cb58242726d99c9f17110..1ee7fa0ab0656ceab591a70f7cd30fd93da0dfe2 100644 (file)
@@ -180,7 +180,7 @@ static really_inline
 int validateShuftiMask64x8(const m512 data, const m512 hi_mask,
                            const m512 lo_mask, const m512 and_mask,
                            const u64a neg_mask, const u64a valid_data_mask) {
-    m512 low4bits = set64x8(0xf);
+    m512 low4bits = set1_64x8(0xf);
     m512 c_lo = pshufb_m512(lo_mask, and512(data, low4bits));
     m512 c_hi = pshufb_m512(hi_mask,
                             rshift64_m512(andnot512(low4bits, data), 4));
@@ -210,7 +210,7 @@ int validateShuftiMask64x16(const m512 data,
                             const m512 lo_mask_1, const m512 lo_mask_2,
                             const m512 and_mask_hi, const m512 and_mask_lo,
                             const u64a neg_mask, const u64a valid_data_mask) {
-    m512 low4bits = set64x8(0xf);
+    m512 low4bits = set1_64x8(0xf);
     m512 data_lo = and512(data, low4bits);
     m512 data_hi = and512(rshift64_m512(data, 4), low4bits);
     m512 c_lo_1 = pshufb_m512(lo_mask_1, data_lo);
index 66cd4daff52bbffa2cea624882cb433f9cbc3191..2040ffa17679b6fbf976bb3f3c00a0f4da8313d8 100644 (file)
@@ -592,7 +592,7 @@ m512 loadcompressed512_64bit(const void *ptr, m512 mvec) {
                   expand64(v[6], m[6]), expand64(v[7], m[7]) };
 
 #if defined(HAVE_AVX512)
-    m512 xvec = set64x8(x[7], x[6], x[5], x[4],
+    m512 xvec = set8x64(x[7], x[6], x[5], x[4],
                                  x[3], x[2], x[1], x[0]);
 #elif defined(HAVE_AVX2)
     m512 xvec = { .lo = set4x64(x[3], x[2], x[1], x[0]),
index bc1426b1946e796aa7a7b507673046a48a6e3ea6..da9bb62ac6a8547eb142d21aca2db0febc3e31a2 100644 (file)
@@ -697,7 +697,7 @@ TEST(SimdUtilsTest, set32x8) {
     char cmp[sizeof(m256)];
 
     for (unsigned i = 0; i < 256; i++) {
-        m256 simd = set32x8(i);
+        m256 simd = set1_32x8(i);
         memset(cmp, i, sizeof(simd));
         ASSERT_EQ(0, memcmp(cmp, &simd, sizeof(simd)));
     }
@@ -707,9 +707,9 @@ TEST(SimdUtilsTest, set2x128) {
     char cmp[sizeof(m256)];
 
     for (unsigned i = 0; i < 256; i++) {
-        m128 x = set16x8(i);
-        m256 y = set32x8(i);
-        m256 z = set2x128(x);
+        m128 x = set1_16x8(i);
+        m256 y = set1_32x8(i);
+        m256 z = set1_2x128(x);
         memset(cmp, i, sizeof(z));
         ASSERT_EQ(0, memcmp(cmp, &z, sizeof(z)));
         ASSERT_EQ(0, memcmp(&y, &z, sizeof(z)));