File: abi.cmake

package info (click to toggle)
vc 1.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,552 kB
  • sloc: cpp: 19,220; ansic: 15,669; sh: 453; xml: 186; makefile: 30
file content (44 lines) | stat: -rw-r--r-- 1,482 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#######################################################################
# test Vector<T> ABI
#######################################################################

macro(extract_asm marker)
   execute_process(
      COMMAND grep -A100 ${marker}_start ${ASM}
      COMMAND grep -B100 ${marker}_end
      COMMAND sed -e "s/ *#.*$//"
      COMMAND grep -v -e ${marker}_ -e "^\\." -e "^ *$"
      OUTPUT_VARIABLE asm)
   string(STRIP "${asm}" asm)
   string(REPLACE "(%rip)" "" asm "${asm}")
   string(REPLACE "\t" " " asm "${asm}")
   string(REGEX REPLACE "  +" " " asm "${asm}")
endmacro()

extract_asm(vector_abi)

if("${IMPL}" STREQUAL SSE)
   set(reference "v?mov[au]ps .*a_v, %xmm0.*call.* v?mov[au]ps %xmm0, .*b_v")
elseif("${IMPL}" STREQUAL AVX OR "${IMPL}" STREQUAL AVX2)
   set(reference "vmov[au]ps .*a_v, %ymm0.*call.* vmov[au]ps %ymm0, .*b_v")
else()
   message(FATAL_ERROR "Unknown IMPL '${IMPL}'")
endif()

if("${asm}" MATCHES "${reference}")
   message("PASS: Vector<T> ABI")
else()
   message(FATAL_ERROR "Failed.\n'${asm}'\n  does not match\n'${reference}'")
endif()

#######################################################################
# test Mask<T> ABI
#######################################################################
string(REPLACE "_v" "_m" reference "${reference}")

extract_asm(mask_abi)
if("${asm}" MATCHES "${reference}")
   message("PASS: Mask<T> ABI")
else()
   message(FATAL_ERROR "Failed.\n'${asm}'\n  does not match\n'${reference}'")
endif()