File: check_dispatch_llvm20plus.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (35 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download
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
// Compile the test for different x86 targets available with LLVM_20+ with auto-dispatch enabled and run the test under SDE to verify that correct platform was picked in runtime.

// RUN: %{ispc} %s --target=sse2-i32x4,avx10.2-x16 -o %t_ispc0.o --nostdlib
// RUN: %{cc} -O2 %S/check_dispatch.c %t_ispc0*.o -o %t.exe
// RUN: sde -mrm -- %t.exe | FileCheck %s -check-prefix=CHECK_SSE2
// RUN: sde -dmr -- %t.exe | FileCheck %s -check-prefix=CHECK_DMR

// REQUIRES: X86_ENABLED && SDE_INSTALLED && LLVM_20_0+

// CHECK_SSE2: SSE2
// CHECK_DMR: AVX10_2

export uniform int detect_isa() {
#if defined(ISPC_TARGET_AVX10_2)
    return 10;
#elif defined(ISPC_TARGET_AVX512SPR)
    return 9;
#elif defined(ISPC_TARGET_AVX512ICL)
    return 8;
#elif defined(ISPC_TARGET_AVX512SKX)
    return 7;
#elif defined(ISPC_TARGET_AVX2VNNI)
    return 5;
#elif defined(ISPC_TARGET_AVX2)
    return 4;
#elif defined(ISPC_TARGET_AVX)
    return 3;
#elif defined(ISPC_TARGET_SSE4)
    return 2;
#elif defined(ISPC_TARGET_SSE2)
    return 1;
#else
    return 0;
#endif
}