1#  SPDX-License-Identifier: Apache-2.0
2#  ----------------------------------------------------------------------------
3#  Copyright 2020-2022 Arm Limited
4#
5#  Licensed under the Apache License, Version 2.0 (the "License"); you may not
6#  use this file except in compliance with the License. You may obtain a copy
7#  of the License at:
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11#  Unless required by applicable law or agreed to in writing, software
12#  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14#  License for the specific language governing permissions and limitations
15#  under the License.
16#  ----------------------------------------------------------------------------
17
18if(${UNIVERSAL_BUILD})
19    if(${ISA_AVX2})
20        set(ISA_SIMD "avx2")
21    elseif(${ISA_SSE41})
22        set(ISA_SIMD "sse4.1")
23    elseif(${ISA_SSE2})
24        set(ISA_SIMD "sse2")
25    endif()
26    include(cmake_core.cmake)
27else()
28    set(ARTIFACTS native none neon avx2 sse4.1 sse2)
29    set(CONFIGS ${ISA_NATIVE} ${ISA_NONE} ${ISA_NEON} ${ISA_AVX2} ${ISA_SSE41} ${ISA_SSE2})
30    list(LENGTH ARTIFACTS ARTIFACTS_LEN)
31    math(EXPR ARTIFACTS_LEN "${ARTIFACTS_LEN} - 1")
32
33    foreach(INDEX RANGE ${ARTIFACTS_LEN})
34        list(GET ARTIFACTS ${INDEX} ARTIFACT)
35        list(GET CONFIGS ${INDEX} CONFIG)
36        if(${CONFIG})
37            set(ISA_SIMD ${ARTIFACT})
38            include(cmake_core.cmake)
39        endif()
40    endforeach()
41endif()
42