mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
Check compiler architecture flags in one place
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "multivermicelli.h"
|
||||
#include "ue2common.h"
|
||||
#include "vermicelli.h"
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/simd_utils.h"
|
||||
|
||||
@@ -118,7 +119,7 @@ size_t doAccel256(const m256 *state, const struct LimExNFA256 *limex,
|
||||
DEBUG_PRINTF("using PSHUFB for 256-bit shuffle\n");
|
||||
m256 accelPerm = limex->accelPermute;
|
||||
m256 accelComp = limex->accelCompare;
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
u32 idx1 = packedExtract128(s.lo, accelPerm.lo, accelComp.lo);
|
||||
u32 idx2 = packedExtract128(s.hi, accelPerm.hi, accelComp.hi);
|
||||
assert((idx1 & idx2) == 0); // should be no shared bits
|
||||
@@ -153,7 +154,7 @@ size_t doAccel512(const m512 *state, const struct LimExNFA512 *limex,
|
||||
DEBUG_PRINTF("using PSHUFB for 512-bit shuffle\n");
|
||||
m512 accelPerm = limex->accelPermute;
|
||||
m512 accelComp = limex->accelCompare;
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
u32 idx1 = packedExtract128(s.lo.lo, accelPerm.lo.lo, accelComp.lo.lo);
|
||||
u32 idx2 = packedExtract128(s.lo.hi, accelPerm.lo.hi, accelComp.lo.hi);
|
||||
u32 idx3 = packedExtract128(s.hi.lo, accelPerm.hi.lo, accelComp.hi.lo);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -38,6 +38,7 @@
|
||||
#define LIMEX_SHUFFLE_H
|
||||
|
||||
#include "ue2common.h"
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/simd_utils.h"
|
||||
|
||||
@@ -49,7 +50,7 @@ u32 packedExtract128(m128 s, const m128 permute, const m128 compare) {
|
||||
return (u32)rv;
|
||||
}
|
||||
|
||||
#if defined(__AVX2__)
|
||||
#if defined(HAVE_AVX2)
|
||||
static really_inline
|
||||
u32 packedExtract256(m256 s, const m256 permute, const m256 compare) {
|
||||
// vpshufb doesn't cross lanes, so this is a bit of a cheat
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Intel Corporation
|
||||
* Copyright (c) 2016-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "nfa_api.h"
|
||||
#include "nfa_api_queue.h"
|
||||
#include "nfa_internal.h"
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/compare.h"
|
||||
#include "util/simd_utils.h"
|
||||
@@ -168,7 +169,7 @@ u32 doSheng(const struct mcsheng *m, const u8 **c_inout, const u8 *soft_c_end,
|
||||
* extract a single copy of the state from the u32 for checking. */
|
||||
u32 sheng_stop_limit_x4 = sheng_stop_limit * 0x01010101;
|
||||
|
||||
#if defined(HAVE_PEXT) && defined(ARCH_64_BIT)
|
||||
#if defined(HAVE_BMI2) && defined(ARCH_64_BIT)
|
||||
u32 sheng_limit_x4 = sheng_limit * 0x01010101;
|
||||
m128 simd_stop_limit = set4x32(sheng_stop_limit_x4);
|
||||
m128 accel_delta = set16x8(sheng_limit - sheng_stop_limit);
|
||||
@@ -189,7 +190,7 @@ u32 doSheng(const struct mcsheng *m, const u8 **c_inout, const u8 *soft_c_end,
|
||||
|
||||
u8 s_gpr;
|
||||
while (c < c_end) {
|
||||
#if defined(HAVE_PEXT) && defined(ARCH_64_BIT)
|
||||
#if defined(HAVE_BMI2) && defined(ARCH_64_BIT)
|
||||
/* This version uses pext for efficently bitbashing out scaled
|
||||
* versions of the bytes to process from a u64a */
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -34,12 +34,13 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "ue2common.h"
|
||||
#include "util/arch.h"
|
||||
|
||||
#include "multishufti.h"
|
||||
|
||||
#include "multiaccel_common.h"
|
||||
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
|
||||
#define MATCH_ALGO long_
|
||||
#include "multiaccel_long.h"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "ue2common.h"
|
||||
#include "util/arch.h"
|
||||
|
||||
#include "multitruffle.h"
|
||||
#include "util/bitutils.h"
|
||||
@@ -35,7 +36,7 @@
|
||||
|
||||
#include "multiaccel_common.h"
|
||||
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
|
||||
#define MATCH_ALGO long_
|
||||
#include "multiaccel_long.h"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -28,12 +28,13 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "ue2common.h"
|
||||
#include "util/arch.h"
|
||||
|
||||
#include "multivermicelli.h"
|
||||
|
||||
#include "multiaccel_common.h"
|
||||
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
|
||||
#define MATCH_ALGO long_
|
||||
#include "multiaccel_long.h"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "shufti.h"
|
||||
#include "ue2common.h"
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/simd_utils.h"
|
||||
#include "util/unaligned.h"
|
||||
@@ -55,7 +56,7 @@ const u8 *shuftiRevSlow(const u8 *lo, const u8 *hi, const u8 *buf,
|
||||
return buf_end;
|
||||
}
|
||||
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
/* Normal SSSE3 shufti */
|
||||
|
||||
static really_inline
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "ue2common.h"
|
||||
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/simd_utils.h"
|
||||
#include "util/unaligned.h"
|
||||
@@ -86,7 +87,7 @@ void dumpMsk##_t##AsChars(m##_t msk) { \
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
|
||||
#ifdef DEBUG
|
||||
DUMP_MSK(128)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -33,12 +33,13 @@
|
||||
|
||||
#include "ue2common.h"
|
||||
#include "truffle.h"
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/simd_utils.h"
|
||||
|
||||
#include "truffle_common.h"
|
||||
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
|
||||
static really_inline
|
||||
const u8 *lastMatch(const u8 *buf, u32 z) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -29,13 +29,14 @@
|
||||
#ifndef TRUFFLE_COMMON_H_
|
||||
#define TRUFFLE_COMMON_H_
|
||||
|
||||
#include "util/arch.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/simd_utils.h"
|
||||
|
||||
/*
|
||||
* Common stuff for all versions of truffle (single, multi and multidouble)
|
||||
*/
|
||||
#if !defined(__AVX2__)
|
||||
#if !defined(HAVE_AVX2)
|
||||
|
||||
static really_inline
|
||||
const u8 *firstMatch(const u8 *buf, u32 z) {
|
||||
|
Reference in New Issue
Block a user