Skip to content

[SYCL][Test] Add IR checks into atomic tests #2834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions sycl/test/atomic_ref/add.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -165,10 +167,22 @@ void add_test(queue q, size_t N) {
// Floating-point types do not support pre- or post-increment
template <> void add_test<float>(queue q, size_t N) {
add_fetch_test<float>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32)
add_plus_equal_test<float>(q, N);
}
template <> void add_test<double>(queue q, size_t N) {
add_fetch_test<double>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64)
add_plus_equal_test<double>(q, N);
}

Expand All @@ -181,12 +195,31 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
add_test<int>(q, N);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what if the function isn't inlined? Is its inlining forced somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that inlining can't take place as such. These __spirv_Atomic* functions are generated due to being included from here, however no definition is provided. These external calls get lowered at later stages (e.g. mapped onto corresponding SPIR-V operands during translation from LLVM IR - see #2765 as a fresh example).

// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
add_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
add_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
add_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
add_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
add_test<unsigned long long>(q, N);
// The remaining functions have been instantiated earlier
add_test<float>(q, N);
add_test<double>(q, N);
add_test<char *, ptrdiff_t>(q, N);
Expand Down
23 changes: 23 additions & 0 deletions sycl/test/atomic_ref/compare_exchange.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -60,12 +62,33 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32)
compare_exchange_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32)
compare_exchange_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i32,
// CHECK-LLVM-SAME: i[[long]], i[[long]])
compare_exchange_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i32,
// CHECK-LLVM-SAME: i[[long]], i[[long]])
compare_exchange_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64)
compare_exchange_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64)
compare_exchange_test<unsigned long long>(q, N);
// The remaining functions use the already-declared ones on the IR level
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do they? It was integers and now we have floats and doubles...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this is that float/pointer-typed functions are emulated instead of being mapped onto particular SPIR-V operands. I do not know the details of why integer compare_exchange external calls are made inside this emulation, but #2765 exemplifies what happens if the emulation is changed by an external call to a unique float-typed function.

compare_exchange_test<float>(q, N);
compare_exchange_test<double>(q, N);
compare_exchange_test<char *>(q, N);
Expand Down
21 changes: 21 additions & 0 deletions sycl/test/atomic_ref/exchange.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -52,12 +54,31 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
exchange_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
exchange_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicExchange
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
exchange_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicExchange
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
exchange_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
exchange_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
exchange_test<unsigned long long>(q, N);
// The remaining functions use the already-declared ones on the IR level
exchange_test<float>(q, N);
exchange_test<double>(q, N);
exchange_test<char *>(q, N);
Expand Down
21 changes: 21 additions & 0 deletions sycl/test/atomic_ref/load.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -49,12 +51,31 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32)
load_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32)
load_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32)
load_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32)
load_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32)
load_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32)
load_test<unsigned long long>(q, N);
// The remaining functions use the already-declared ones on the IR level
load_test<float>(q, N);
load_test<double>(q, N);
load_test<char *>(q, N);
Expand Down
32 changes: 32 additions & 0 deletions sycl/test/atomic_ref/max.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -57,13 +59,43 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicSMax
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
max_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicUMax
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
max_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicSMax
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
max_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicUMax
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
max_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicSMax
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
max_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicUMax
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
max_test<unsigned long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32)
max_test<float>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64)
max_test<double>(q, N);

std::cout << "Test passed." << std::endl;
Expand Down
32 changes: 32 additions & 0 deletions sycl/test/atomic_ref/min.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -55,13 +57,43 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicSMin
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
min_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicUMin
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
min_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicSMin
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
min_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicUMin
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
min_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicSMin
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
min_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicUMin
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
min_test<unsigned long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32)
min_test<float>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64)
min_test<double>(q, N);

std::cout << "Test passed." << std::endl;
Expand Down
21 changes: 21 additions & 0 deletions sycl/test/atomic_ref/store.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %RUN_ON_HOST %t.out

Expand Down Expand Up @@ -45,12 +47,31 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func void
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicStore
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
store_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func void
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicStore
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
store_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func void
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicStore{{.*}}(i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: addrspace(1)*, i32, i32, i[[long]])
store_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func void
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicStore
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
store_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func void
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicStore
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
store_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func void
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicStore
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
store_test<unsigned long long>(q, N);
// The remaining functions use the already-declared ones on the IR level
store_test<float>(q, N);
store_test<double>(q, N);
store_test<char *>(q, N);
Expand Down
31 changes: 31 additions & 0 deletions sycl/test/atomic_ref/sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,22 @@ void sub_test(queue q, size_t N) {
// Floating-point types do not support pre- or post-decrement
template <> void sub_test<float>(queue q, size_t N) {
sub_fetch_test<float>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32)
sub_plus_equal_test<float>(q, N);
}
template <> void sub_test<double>(queue q, size_t N) {
sub_fetch_test<double>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicLoad
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32)
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64)
sub_plus_equal_test<double>(q, N);
}

Expand All @@ -181,12 +193,31 @@ int main() {
}

constexpr int N = 32;
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicISub
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
sub_test<int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i32
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicISub
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32)
sub_test<unsigned int>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicISub
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
sub_test<long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i[[long]]
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicISub
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i[[long]])
sub_test<unsigned long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicISub
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
sub_test<long long>(q, N);
// CHECK-LLVM: declare dso_local spir_func i64
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicISub
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i64)
sub_test<unsigned long long>(q, N);
// The remaining functions have been instantiated earlier
sub_test<float>(q, N);
sub_test<double>(q, N);
sub_test<char *, ptrdiff_t>(q, N);
Expand Down