| 1 |
// Check that types, widths, __CLANG_ATOMIC* macros, etc. match on the host and |
| 2 |
// device sides of CUDA compilations. Note that we filter out long double and |
| 3 |
// maxwidth of _BitInt(), as this is intentionally different on host and device. |
| 4 |
// |
| 5 |
// Also ignore __CLANG_ATOMIC_LLONG_LOCK_FREE on i386. The default host CPU for |
| 6 |
// an i386 triple is typically at least an i586, which has cmpxchg8b (Clang |
| 7 |
// feature, "cx8"). Therefore, __CLANG_ATOMIC_LLONG_LOCK_FREE is 2 on the host, |
| 8 |
// but the value should be 1 for the device. |
| 9 |
// |
| 10 |
// Unlike CUDA, the width of SPIR-V POINTER type could differ between host and |
| 11 |
// device, because SPIR-V explicitly sets POINTER type width. So it is the |
| 12 |
// user's responsibility to choose the offload with the right POINTER size, |
| 13 |
// otherwise the values for __CLANG_ATOMIC_POINTER_LOCK_FREE could be different. |
| 14 |
|
| 15 |
// RUN: mkdir -p %t |
| 16 |
|
| 17 |
// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv32 -target i386-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 18 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 19 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-host-defines-filtered |
| 20 |
// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv32 -target i386-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 21 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 22 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-device-defines-filtered |
| 23 |
// RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered |
| 24 |
|
| 25 |
// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv32 -target i386-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 26 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 27 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-host-defines-filtered |
| 28 |
// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv32 -target i386-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 29 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 30 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-device-defines-filtered |
| 31 |
// RUN: diff %t/i386-msvc-host-defines-filtered %t/i386-msvc-device-defines-filtered |
| 32 |
|
| 33 |
// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 34 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 35 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-host-defines-filtered |
| 36 |
// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 37 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 38 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-device-defines-filtered |
| 39 |
// RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered |
| 40 |
|
| 41 |
// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv64 -target powerpc64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 42 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 43 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/powerpc64-host-defines-filtered |
| 44 |
// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv64 -target powerpc64-unknown-linux-gnu -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 45 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 46 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/powerpc64-device-defines-filtered |
| 47 |
// RUN: diff %t/powerpc64-host-defines-filtered %t/powerpc64-device-defines-filtered |
| 48 |
|
| 49 |
// RUN: %clang --cuda-host-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 50 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 51 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-msvc-host-defines-filtered |
| 52 |
// RUN: %clang --cuda-device-only -nocudainc -nocudalib --offload=spirv64 -target x86_64-windows-msvc -x cuda -emit-llvm -E -dM -o - /dev/null \ |
| 53 |
// RUN: | grep -E '__CLANG_ATOMIC' \ |
| 54 |
// RUN: | grep -Ev '_ATOMIC_LLONG_LOCK_FREE' > %t/x86_64-msvc-device-defines-filtered |
| 55 |
// RUN: diff %t/x86_64-msvc-host-defines-filtered %t/x86_64-msvc-device-defines-filtered |
| 56 |
|