This is an automated email from the ASF dual-hosted git repository.

airborne pushed a commit to branch clucene
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/clucene by this push:
     new 30b63dc3406 [refact](reader) refact reader's compatible option (#300)
30b63dc3406 is described below

commit 30b63dc34068996c15d451a27d0593c519cb97fc
Author: airborne12 <jiang...@selectdb.com>
AuthorDate: Wed Apr 9 20:09:27 2025 +0800

    [refact](reader) refact reader's compatible option (#300)
    
    * [refact](reader) refact reader's compatible option
    
    * [fix](reader) remove IndexReader::setCompatibleRead acquireWriteLock
    
    * add cmake min version
    
    * add cmake min version
    
    * fix compatible read for new version
    
    * fix cmake
    
    * fix compile
    
    * update noavx2
    
    * fix v3
    
    * fix compile
---
 3rdparty/zstd/build/cmake/CMakeLists.txt   |  2 +-
 CMakeLists.txt                             |  9 ++++-----
 src/core/CLucene/index/FieldInfos.cpp      | 30 +++++++-----------------------
 src/core/CLucene/index/IndexReader.cpp     | 10 ++++++++++
 src/core/CLucene/index/IndexReader.h       |  5 +++++
 src/core/CLucene/index/SDocumentWriter.cpp |  2 +-
 src/core/CLucene/index/SegmentTermDocs.cpp |  2 +-
 src/core/CLucene/index/_FieldInfos.h       |  9 +++------
 src/core/CLucene/util/PFORUtil.cpp         | 15 ++++++++++-----
 src/ext/for/CMakeLists.txt                 |  6 +++---
 src/ext/for/bitpack.c                      |  7 ++++---
 src/ext/for/bitunpack.c                    |  6 +++---
 src/ext/for/transpose.c                    |  4 ++--
 src/ext/for/vp4c.c                         |  5 +++--
 src/ext/for/vp4d.c                         |  3 +--
 15 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/3rdparty/zstd/build/cmake/CMakeLists.txt 
b/3rdparty/zstd/build/cmake/CMakeLists.txt
index 0bffc87d933..7377d4550bf 100644
--- a/3rdparty/zstd/build/cmake/CMakeLists.txt
+++ b/3rdparty/zstd/build/cmake/CMakeLists.txt
@@ -7,7 +7,7 @@
 # in the COPYING file in the root directory of this source tree).
 # ################################################################
 
-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
 
 # As of 2018-12-26 ZSTD has been validated to build with cmake version 3.13.2 
new policies.
 # Set and use the newest cmake policies that are validated to work
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81e7a6075c5..e4cc0af8082 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,13 +143,12 @@ if (ARCH_AARCH64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
     set (ARCH_ARM 1)
 endif ()
 if (ARCH_AMD64)
-    if (USE_SSE4_2)
-        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
-    endif()
-    message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
+    add_compile_options(-msse4.2)
     if (USE_AVX2)
-        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -DUSE_AVX2")
+        add_compile_options(-mavx2)
+        add_definitions(-DUSE_AVX2)
     endif()
+    message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
 endif()
 
 if (ARCH_ARM)
diff --git a/src/core/CLucene/index/FieldInfos.cpp 
b/src/core/CLucene/index/FieldInfos.cpp
index d1653bdab02..205ebb17be7 100644
--- a/src/core/CLucene/index/FieldInfos.cpp
+++ b/src/core/CLucene/index/FieldInfos.cpp
@@ -26,7 +26,7 @@ FieldInfo::FieldInfo(const TCHAR* _fieldName, const bool 
_isIndexed, const int32
                      const bool _storeTermVector, const bool 
_storeOffsetWithTermVector,
                      const bool _storePositionWithTermVector, const bool 
_omitNorms,
                      const bool _hasProx, const bool _storePayloads, 
IndexVersion indexVersion,
-                                                                               
 uint32_t flags, const bool _compatibleRead)
+                                                                               
 uint32_t flags)
         : name(CLStringIntern::intern(_fieldName)),
           isIndexed(_isIndexed),
           number(_fieldNumber),
@@ -37,8 +37,7 @@ FieldInfo::FieldInfo(const TCHAR* _fieldName, const bool 
_isIndexed, const int32
           hasProx(_hasProx),
           storePayloads(_storePayloads),
                  indexVersion_(indexVersion), 
-                 flags_(flags),
-          compatibleRead(_compatibleRead) {}
+                 flags_(flags) {}
 
 FieldInfo::~FieldInfo(){
        CL_NS(util)::CLStringIntern::unintern(name);
@@ -46,7 +45,7 @@ FieldInfo::~FieldInfo(){
 
 FieldInfo* FieldInfo::clone() {
        return _CLNEW FieldInfo(name, isIndexed, number, storeTermVector, 
storePositionWithTermVector,
-               storeOffsetWithTermVector, omitNorms, hasProx, storePayloads, 
indexVersion_, flags_, compatibleRead);
+               storeOffsetWithTermVector, omitNorms, hasProx, storePayloads, 
indexVersion_, flags_);
 }
 
 FieldInfos::FieldInfos():
@@ -103,17 +102,6 @@ bool FieldInfos::hasProx() {
        return false;
 }
 
-bool FieldInfos::compatibleRead() {
-       int numFields = byNumber.size();
-       for (int i = 0; i < numFields; i++) {
-               FieldInfo* fi = fieldInfo(i);
-               if (fi->compatibleRead) {
-                       return true;
-               }
-       }
-       return false;
-}
-
 IndexVersion FieldInfos::getIndexVersion() {
        int numFields = byNumber.size();
        for (int i = 0; i < numFields; i++) {
@@ -160,12 +148,12 @@ FieldInfo* FieldInfos::add(const TCHAR* name, const bool 
isIndexed, const bool s
                            const bool storePositionWithTermVector,
                            const bool storeOffsetWithTermVector, const bool 
omitNorms,
                            const bool hasProx, const bool storePayloads,
-                                                                               
                 IndexVersion indexVersion, uint32_t flags, const bool 
compatibleRead) {
+                                                                               
                 IndexVersion indexVersion, uint32_t flags) {
   FieldInfo* fi = fieldInfo(name);
        if (fi == NULL) {
                return addInternal(name, isIndexed, storeTermVector, 
storePositionWithTermVector,
                                                                                
                storeOffsetWithTermVector, omitNorms, hasProx, storePayloads,
-                                                                               
                indexVersion, flags, compatibleRead);
+                                                                               
                indexVersion, flags);
   } else {
                if (fi->isIndexed != isIndexed) {
                        fi->isIndexed = true;                      // once 
indexed, always index
@@ -194,9 +182,6 @@ FieldInfo* FieldInfos::add(const TCHAR* name, const bool 
isIndexed, const bool s
                if (fi->flags_ != flags) {
                        fi->flags_ = flags;
                }
-               if (fi->compatibleRead != compatibleRead) {
-                       fi->compatibleRead = compatibleRead;
-               }
        }
        return fi;
 }
@@ -206,12 +191,11 @@ FieldInfo* FieldInfos::addInternal(const TCHAR* name, 
const bool isIndexed,
                                    const bool storePositionWithTermVector,
                                    const bool storeOffsetWithTermVector, const 
bool omitNorms,
                                    const bool hasProx, const bool 
storePayloads,
-                                   IndexVersion indexVersion, uint32_t flags,
-                                   const bool compatibleRead) {
+                                   IndexVersion indexVersion, uint32_t flags) {
         FieldInfo* fi =
                 _CLNEW FieldInfo(name, isIndexed, byNumber.size(), 
storeTermVector,
                                  storePositionWithTermVector, 
storeOffsetWithTermVector, omitNorms,
-                                 hasProx, storePayloads, indexVersion, flags, 
compatibleRead);
+                                 hasProx, storePayloads, indexVersion, flags);
         byNumber.push_back(fi);
        byName.put( fi->name, fi);
        return fi;
diff --git a/src/core/CLucene/index/IndexReader.cpp 
b/src/core/CLucene/index/IndexReader.cpp
index 584957ee3b1..69c66b4f735 100644
--- a/src/core/CLucene/index/IndexReader.cpp
+++ b/src/core/CLucene/index/IndexReader.cpp
@@ -222,6 +222,16 @@ CL_NS_DEF(index)
     this->doSetNorm(doc, field, value);
   }
 
+  void IndexReader::setCompatibleRead(bool compatibleRead) {
+    SCOPED_LOCK_MUTEX(THIS_LOCK)
+    this->ensureOpen();
+    this->compatibleRead = compatibleRead;
+  }
+
+  bool IndexReader::getCompatibleRead() const {
+    return this->compatibleRead;
+  }
+
 
   void IndexReader::setNorm(int32_t doc, const TCHAR* field, float_t value){
      ensureOpen();
diff --git a/src/core/CLucene/index/IndexReader.h 
b/src/core/CLucene/index/IndexReader.h
index ab453384238..29449840c17 100644
--- a/src/core/CLucene/index/IndexReader.h
+++ b/src/core/CLucene/index/IndexReader.h
@@ -112,6 +112,8 @@ public:
   /** Internal use. */
        Internal* _internal;
 
+  bool compatibleRead = false;
+
 
   /**
    * Constants describing field properties, for example used for
@@ -689,6 +691,9 @@ public:
 
   virtual IndexVersion getIndexVersion();
 
+  void setCompatibleRead(bool compatibleRead);
+  bool getCompatibleRead() const;
+
   friend class SegmentReader;
   friend class MultiReader;
   friend class IndexWriter;
diff --git a/src/core/CLucene/index/SDocumentWriter.cpp 
b/src/core/CLucene/index/SDocumentWriter.cpp
index 89687e867bb..637754bdb9f 100644
--- a/src/core/CLucene/index/SDocumentWriter.cpp
+++ b/src/core/CLucene/index/SDocumentWriter.cpp
@@ -1301,7 +1301,7 @@ void 
SDocumentsWriter<T>::appendPostings(ArrayBase<typename ThreadState::FieldDa
             }
             docDeltaBuffer.resize(0);
             freqBuffer.resize(0);
-            if (indexVersion_ >= IndexVersion::kV2) {
+            if (hasProx_ && indexVersion_ >= IndexVersion::kV2) {
                 PforUtil::encodePos(proxOut, posBuffer);
             }
         }
diff --git a/src/core/CLucene/index/SegmentTermDocs.cpp 
b/src/core/CLucene/index/SegmentTermDocs.cpp
index 92db60a6369..5f5df366f91 100644
--- a/src/core/CLucene/index/SegmentTermDocs.cpp
+++ b/src/core/CLucene/index/SegmentTermDocs.cpp
@@ -22,7 +22,7 @@ SegmentTermDocs::SegmentTermDocs(const SegmentReader 
*_parent) : parent(_parent)
                                                                  count(0), 
df(0), deletedDocs(_parent->deletedDocs), _doc(-1), _freq(0), 
skipInterval(_parent->tis->getSkipInterval()),
                                                                  
maxSkipLevels(_parent->tis->getMaxSkipLevels()), skipListReader(NULL), 
freqBasePointer(0), proxBasePointer(0),
                                                                  
skipPointer(0), haveSkipped(false), pointer(0), pointerMax(0), 
indexVersion_(_parent->_fieldInfos->getIndexVersion()),
-                                                                 
hasProx(_parent->_fieldInfos->hasProx()), buffer_(freqStream, hasProx, 
indexVersion_, _parent->_fieldInfos->compatibleRead()) {
+                                                                 
hasProx(_parent->_fieldInfos->hasProx()), buffer_(freqStream, hasProx, 
indexVersion_, _parent->getCompatibleRead()) {
     CND_CONDITION(_parent != NULL, "Parent is NULL");
     memset(docs,0,PFOR_BLOCK_SIZE*sizeof(int32_t));
     memset(freqs,0,PFOR_BLOCK_SIZE*sizeof(int32_t));
diff --git a/src/core/CLucene/index/_FieldInfos.h 
b/src/core/CLucene/index/_FieldInfos.h
index ba0b0d60d06..cea935ab8c5 100644
--- a/src/core/CLucene/index/_FieldInfos.h
+++ b/src/core/CLucene/index/_FieldInfos.h
@@ -39,7 +39,6 @@ class FieldInfo :LUCENE_BASE{
        uint32_t flags_ = 0;
 
        bool storePayloads; // whether this field stores payloads together with 
term positions
-       bool compatibleRead; // whether index docid list is read cross 
platform(eg x86 and arm64)
 
        //Func - Constructor
        //       Initialises FieldInfo.
@@ -63,8 +62,7 @@ class FieldInfo :LUCENE_BASE{
                const bool hasProx,
                const bool storePayloads,
                IndexVersion indexVersion,
-               uint32_t flags,
-               const bool compatibleRead);
+               uint32_t flags);
 
     //Func - Destructor
        //Pre  - true
@@ -141,7 +139,6 @@ public:
        void addIndexed(const TCHAR** names, const bool storeTermVectors, const 
bool storePositionWithTermVector, const bool storeOffsetWithTermVector);
 
        bool hasProx();
-       bool compatibleRead();
        IndexVersion getIndexVersion();
        uint32_t getFlags();
 
@@ -179,14 +176,14 @@ public:
                                                                        const 
bool storePositionWithTermVector = false,
                                                                        const 
bool storeOffsetWithTermVector = false, const bool omitNorms = false,
                                                                        const 
bool hasProx = false, const bool storePayloads = false,
-                                                                       
IndexVersion indexVersion = IndexVersion::kV1, uint32_t flags_ = 0, const bool 
compatibleRead = false);
+                                                                       
IndexVersion indexVersion = IndexVersion::kV1, uint32_t flags_ = 0);
 
   // was void
        FieldInfo* addInternal(const TCHAR* name, const bool isIndexed, const 
bool storeTermVector,
                                                                                
                        const bool storePositionWithTermVector,
                                                                                
                        const bool storeOffsetWithTermVector, const bool 
omitNorms,
                                                                                
                        const bool hasProx, const bool storePayloads,
-                                                                               
                        IndexVersion indexVersion = IndexVersion::kV1, uint32_t 
flags_ = 0, const bool compatibleRead = false);
+                                                                               
                        IndexVersion indexVersion = IndexVersion::kV1, uint32_t 
flags_ = 0);
 
        int32_t fieldNumber(const TCHAR* fieldName)const;
        
diff --git a/src/core/CLucene/util/PFORUtil.cpp 
b/src/core/CLucene/util/PFORUtil.cpp
index fa8105f0a40..7cc836514ac 100644
--- a/src/core/CLucene/util/PFORUtil.cpp
+++ b/src/core/CLucene/util/PFORUtil.cpp
@@ -146,7 +146,7 @@ void PforUtil::encodePos(IndexOutput* out, 
std::vector<uint32_t>& buffer) {
     size_t compressSize = p4nzenc256v32(buffer.data(), buffer.size(), 
compress.data());
     out->writeVInt(compressSize);
     out->writeBytes(reinterpret_cast<const uint8_t*>(compress.data()), 
compressSize);
-#elif (defined(__SSSE3__) || defined(__ARM_NEON))
+#elif defined(__ARM_NEON)
     out->writeByte((char)CodeMode::kPfor128);
     out->writeVInt(buffer.size());
     std::vector<uint8_t> compress(4 * buffer.size() + PFOR_BLOCK_SIZE);
@@ -184,7 +184,7 @@ uint32_t PforUtil::decodePos(IndexInput* in, 
std::vector<uint32_t>& buffer) {
         in->readBytes(buf.data(), serializedSize);
 #if defined(USE_AVX2) && defined(__AVX2__)
         p4nzdec32(buf.data(), size, buffer.data());
-#elif (defined(__SSSE3__) || defined(__ARM_NEON))
+#elif defined(__ARM_NEON)
         p4nzdec32(buf.data(), size, buffer.data());
 #else
         _CLTHROWA(CL_ERR_CorruptIndex, "PFOR128 is not supported on this 
platform");
@@ -212,7 +212,7 @@ void PforUtil::pfor_encode(IndexOutput* out, 
std::vector<uint32_t>& docDeltaBuff
         out->writeVInt(size);
         out->writeBytes(reinterpret_cast<const uint8_t*>(compress.data()), 
size);
     }
-#elif (defined(__SSSE3__) || defined(__ARM_NEON))
+#elif defined(__ARM_NEON)
     out->writeByte((char)CodeMode::kPfor128);
     out->writeVInt(docDeltaBuffer.size());
     std::vector<uint8_t> compress(4 * docDeltaBuffer.size() + PFOR_BLOCK_SIZE);
@@ -333,13 +333,15 @@ uint32_t PforUtil::pfor_decode(IndexInput* in, 
std::vector<uint32_t>& docs,
             }
         }
     } else if (mode == (char)CodeMode::kPfor256) {
-        // new version, read based on compatibleRead
         {
             uint32_t SerializedSize = in->readVInt();
             std::vector<uint8_t> buf(SerializedSize + PFOR_BLOCK_SIZE);
             in->readBytes(buf.data(), SerializedSize);
 #if defined(USE_AVX2) && defined(__AVX2__)
+            // new version, read cross platform, x86_64 read arm64 index
             p4nd1dec256v32(buf.data(), arraySize, docs.data());
+#elif (defined(__SSSE3__) || defined(__ARM_NEON))
+            p4nd1dec256scalarv32(buf.data(), arraySize, docs.data());
 #else
             _CLTHROWA(CL_ERR_CorruptIndex, "PFOR256 is not supported on this 
platform");
 #endif
@@ -350,17 +352,20 @@ uint32_t PforUtil::pfor_decode(IndexInput* in, 
std::vector<uint32_t>& docs,
             in->readBytes(buf.data(), SerializedSize);
 #if defined(USE_AVX2) && defined(__AVX2__)
             p4nzdec256v32(buf.data(), arraySize, freqs.data());
+#elif (defined(__SSSE3__) || defined(__ARM_NEON))
+            // new version, read cross platform, arm64 read x86_64 index
+            p4nzdec256scalarv32(buf.data(), arraySize, freqs.data());
 #else
             _CLTHROWA(CL_ERR_CorruptIndex, "PFOR256 is not supported on this 
platform");
 #endif
         }
     } else if (mode == (char)CodeMode::kPfor128) {
-        // new version, read based on compatibleRead
         {
             uint32_t SerializedSize = in->readVInt();
             std::vector<uint8_t> buf(SerializedSize + PFOR_BLOCK_SIZE);
             in->readBytes(buf.data(), SerializedSize);
 #if defined(USE_AVX2) && defined(__AVX2__)
+            // new version, read cross platform, x86_64 read arm64 index
             p4nd1dec32(buf.data(), arraySize, docs.data());
 #elif (defined(__SSSE3__) || defined(__ARM_NEON))
             p4nd1dec32(buf.data(), arraySize, docs.data());
diff --git a/src/ext/for/CMakeLists.txt b/src/ext/for/CMakeLists.txt
index 9c139a6f2a6..24384297462 100644
--- a/src/ext/for/CMakeLists.txt
+++ b/src/ext/for/CMakeLists.txt
@@ -12,8 +12,8 @@ set(DEBUG "-DNDEBUG -g -O3")
 set(OPT "-w -Wall -fstrict-aliasing -falign-loops -Wno-int-conversion")
 
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
-    set(SSE "-march=corei7-avx -mtune=corei7-avx")
-    set(AVX2 "-march=haswell")
+    set(SSE "-msse4.2")
+    set(AVX2 "-mavx2")
     set(CMAKE_C_FLAGS ${SSE})
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
     set(SSE "-march=armv8-a")
@@ -67,7 +67,7 @@ foreach(SRC_FILE ${SRC_FILES})
 
     add_custom_command(
         OUTPUT ${SSE_OUTPUT}
-        COMMAND ${CMAKE_C_COMPILER} -DSSE2_ON ${c_flags_list} -c -o 
${SSE_OUTPUT} ${SRC_FILE}
+        COMMAND ${CMAKE_C_COMPILER} ${c_flags_list} -c -o ${SSE_OUTPUT} 
${SRC_FILE}
         DEPENDS ${SRC_FILE}
     )
 
diff --git a/src/ext/for/bitpack.c b/src/ext/for/bitpack.c
index 666b1030e51..f7115dbc340 100644
--- a/src/ext/for/bitpack.c
+++ b/src/ext/for/bitpack.c
@@ -44,7 +44,7 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunsequenced"
 
-#if !defined(SSE2_ON) && !defined(AVX2_ON) 
//----------------------------------- Plain 
-----------------------------------------------------------------------
+#ifndef __AVX2__ //----------------------------------- Plain 
-----------------------------------------------------------------------
 typedef unsigned char *(*BITPACK_F8)( uint8_t  *__restrict out, unsigned n, 
const unsigned char *__restrict in);
 typedef unsigned char *(*BITPACK_D8)( uint8_t  *__restrict out, unsigned n, 
const unsigned char *__restrict in, uint8_t start);
 typedef unsigned char *(*BITPACK_F16)(uint16_t *__restrict out, unsigned n, 
const unsigned char *__restrict in);
@@ -227,7 +227,9 @@ size_t bitnfpack16( uint16_t *__restrict in, size_t n, 
unsigned char *__restrict
 size_t bitnfpack32( uint32_t *__restrict in, size_t n, unsigned char 
*__restrict out) { uint32_t *ip,start; BITNDPACK(in, n, out, 128, 32, bitf, 
bitfpacka); }
 size_t bitnfpack64( uint64_t *__restrict in, size_t n, unsigned char 
*__restrict out) { uint64_t *ip,start; BITNDPACK(in, n, out, 128, 64, bitf, 
bitfpacka); }
 
-#else //--------------------------------------- SIMD 
----------------------------------------------------------------------------------------------
+#endif // ifndef AVX2
+
+//--------------------------------------- SIMD 
----------------------------------------------------------------------------------------------
 
 #define _BITNPACKV(in, n, out, _csize_, _usize_, _bitpackv_) {\
   unsigned char *op = out; TEMPLATE3(uint, _usize_, _t) _o,_x;\
@@ -422,6 +424,5 @@ size_t bitnzpack128v32( uint32_t *__restrict in, size_t n, 
unsigned char *__rest
 size_t bitnfpack128v16( uint16_t *__restrict in, size_t n, unsigned char 
*__restrict out) { uint16_t *ip,start; _BITNDPACKV(in, n, out, 128, 16, bitf,  
bitfpack128v, bitf, bitfpack); }
 size_t bitnfpack128v32( uint32_t *__restrict in, size_t n, unsigned char 
*__restrict out) { uint32_t *ip,start; _BITNDPACKV(in, n, out, 128, 32, bitf,  
bitfpack128v, bitf, bitfpack); }
   #endif // SSE
-#endif // Plain
 
 #pragma clang diagnostic pop
diff --git a/src/ext/for/bitunpack.c b/src/ext/for/bitunpack.c
index 26817ac55bc..802df40caad 100644
--- a/src/ext/for/bitunpack.c
+++ b/src/ext/for/bitunpack.c
@@ -43,7 +43,7 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunsequenced"
 
-#if !defined(SSE2_ON) && !defined(AVX2_ON) 
//----------------------------------- Plain 
-------------------------------------------------------------------------------------------
+#ifndef __AVX2__ //----------------------------------- Plain 
-------------------------------------------------------------------------------------------
 typedef unsigned char *(*BITUNPACK_F8)( const unsigned char *__restrict in, 
unsigned n, uint8_t  *__restrict out);
 typedef unsigned char *(*BITUNPACK_D8)( const unsigned char *__restrict in, 
unsigned n, uint8_t  *__restrict out, uint8_t start);
 typedef unsigned char *(*BITUNPACK_F16)(const unsigned char *__restrict in, 
unsigned n, uint16_t *__restrict out);
@@ -133,7 +133,8 @@ size_t bitnfunpack16( unsigned char *__restrict in, size_t 
n, uint16_t *__restri
 size_t bitnfunpack32( unsigned char *__restrict in, size_t n, uint32_t 
*__restrict out) { uint32_t *op,start; BITNDUNPACK(in, n, out, 128, 32, 
bitfunpacka); }
 size_t bitnfunpack64( unsigned char *__restrict in, size_t n, uint64_t 
*__restrict out) { uint64_t *op,start; BITNDUNPACK(in, n, out, 128, 64, 
bitfunpacka); }
 
-#else //-------------------------------------------- SSE/AVX2 
---------------------------------------------------------------------------------------
+#endif
+//-------------------------------------------- SSE/AVX2 
---------------------------------------------------------------------------------------
 
 #define _BITNUNPACKV(in, n, out, _csize_, _usize_, _bitunpackv_) {\
   unsigned char *ip = in;\
@@ -2426,7 +2427,6 @@ size_t bitnzunpack128v32( unsigned char *__restrict in, 
size_t n, uint32_t *__re
 size_t bitnfunpack128v16( unsigned char *__restrict in, size_t n, uint16_t 
*__restrict out) { uint16_t *op,start; _BITNDUNPACKV(in, n, out, 128, 16, 
bitfunpack128v, bitfunpack); }
 size_t bitnfunpack128v32( unsigned char *__restrict in, size_t n, uint32_t 
*__restrict out) { uint32_t *op,start; _BITNDUNPACKV(in, n, out, 128, 32, 
bitfunpack128v, bitfunpack); }
 
-#endif
 #endif
 
 #pragma clang diagnostic pop
diff --git a/src/ext/for/transpose.c b/src/ext/for/transpose.c
index 5e50c80e48a..4402ea2b00e 100644
--- a/src/ext/for/transpose.c
+++ b/src/ext/for/transpose.c
@@ -130,7 +130,7 @@
 #define TPDEC256V   tp4dec256v
 #include "transpose.c"
 
-#if !defined(SSE2_ON) && !defined(AVX2_ON)
+#if !defined(__AVX2__) && !defined(__SSE3__) 
 //--------------------- CPU detection 
-------------------------------------------
   #if _MSC_VER >=1300
 #include <intrin.h>
@@ -431,7 +431,7 @@ void tp4dec(unsigned char *in, unsigned n, unsigned char 
*out, unsigned esize) {
 #define SID(p,i)  (p+=stride)
 //#define SID(_p_,_i_)  (_p_+ _i_*stride)
 
-#if !defined(SSE2_ON) && !defined(AVX2_ON) 
//--------------------------------------- plain 
-------------------------------------------------------------------
+#if !defined(__AVX2__) && !defined(__SSE3__) 
//--------------------------------------- plain 
-------------------------------------------------------------------
 
   #if STRIDE == ESIZE
 void TEMPLATE2(TPENC, ESIZE)(unsigned char *in, unsigned n, unsigned char 
*out) {
diff --git a/src/ext/for/vp4c.c b/src/ext/for/vp4c.c
index f9237f252de..fc230150431 100644
--- a/src/ext/for/vp4c.c
+++ b/src/ext/for/vp4c.c
@@ -41,7 +41,7 @@
 
 #define HYBRID 1 // Hybrid TurboPFor : 0=fixed bit packing, 1=fixed 
BP+Variable byte
 
-  #if !defined(SSE2_ON) && !defined(AVX2_ON)
+  #ifndef __AVX2__
 #define _P4BITS _p4bits
 #define  P4BITS _p4bits
 #define _P4ENC   _p4enc
@@ -155,7 +155,8 @@ size_t p4nsdec16(unsigned char *in, size_t n, uint16_t 
*out) { uint16_t  *op,sta
 size_t p4nsdec32(unsigned char *in, size_t n, uint32_t *out) { uint32_t  
*op,start; P4NDDEC(in, n, out, 128, 32, p4sdec); }
 size_t p4nsdec64(unsigned char *in, size_t n, uint64_t *out) { uint64_t  
*op,start; P4NDDEC(in, n, out, 128, 64, p4sdec); }
 #undef _P4BITS
-  #elif defined(__AVX2__)
+#endif
+#if defined(__AVX2__)
 #define  BITDELTA bitdienc
 #define HYBRID 1
 #define P4BITS _p4bits
diff --git a/src/ext/for/vp4d.c b/src/ext/for/vp4d.c
index e1bbacde3b6..5566073fd66 100644
--- a/src/ext/for/vp4d.c
+++ b/src/ext/for/vp4d.c
@@ -95,7 +95,7 @@ extern char _shuffle_16[256][16];
 #include "vp4d.c"
 
 #undef  BITUNDD
-  #elif !defined(SSE2_ON) && !defined(AVX2_ON)
+  #elif defined(__SSSE3__) || defined(__ARM_NEON)
 
 #define _P4DEC      _p4dec
 #define  P4DEC       p4dec
@@ -177,7 +177,6 @@ extern char _shuffle_16[256][16];
 #undef USIZE
 #undef DELTA
 
-  #elif defined(__SSSE3__) || defined(__ARM_NEON)
 #define VSIZE 128
 #define P4DELTA(a)
 #define P4DELTA_(a)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to