[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-09-16 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG56069b5c71ca: [OpenMP] Support `std::complex` math functions 
in target regions (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85777/new/

https://reviews.llvm.org/D85777

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/openmp_wrappers/complex
  clang/lib/Headers/openmp_wrappers/complex_cmath.h
  clang/test/Headers/Inputs/include/complex
  clang/test/Headers/Inputs/include/type_traits
  clang/test/Headers/nvptx_device_math_complex.cpp

Index: clang/test/Headers/nvptx_device_math_complex.cpp
===
--- clang/test/Headers/nvptx_device_math_complex.cpp
+++ clang/test/Headers/nvptx_device_math_complex.cpp
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -verify -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -aux-triple powerpc64le-unknown-unknown -o - | FileCheck %s
 // expected-no-diagnostics
 
+#include 
 #include 
 
 // CHECK: define weak {{.*}} @__muldc3
@@ -33,6 +34,12 @@
 // CHECK-DAG: call float @__nv_fabsf(
 // CHECK-DAG: call float @__nv_logbf(
 
+// We actually check that there are no declarations of non-OpenMP functions.
+// That is, as long as we don't call an unkown function with a name that
+// doesn't start with '__' we are good :)
+
+// CHECK-NOT: declare.*@[^_]
+
 void test_scmplx(std::complex a) {
 #pragma omp target
   {
@@ -46,3 +53,35 @@
 (void)(a * (a / a));
   }
 }
+
+template 
+std::complex test_template_math_calls(std::complex a) {
+  decltype(a) r = a;
+#pragma omp target
+  {
+r = std::sin(r);
+r = std::cos(r);
+r = std::exp(r);
+r = std::atan(r);
+r = std::acos(r);
+  }
+  return r;
+}
+
+std::complex test_scall(std::complex a) {
+  decltype(a) r;
+#pragma omp target
+  {
+r = std::sin(a);
+  }
+  return test_template_math_calls(r);
+}
+
+std::complex test_dcall(std::complex a) {
+  decltype(a) r;
+#pragma omp target
+  {
+r = std::exp(a);
+  }
+  return test_template_math_calls(r);
+}
Index: clang/test/Headers/Inputs/include/type_traits
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/type_traits
@@ -0,0 +1,43 @@
+/// Copied from libcxx type_traits and simplified
+
+#pragma once
+
+namespace std {
+
+template 
+struct integral_constant {
+  static const _Tp value = __v;
+  typedef _Tp value_type;
+  typedef integral_constant type;
+};
+
+typedef integral_constant true_type;
+typedef integral_constant false_type;
+
+// is_same, functional
+template  struct is_same : public false_type {};
+template  struct is_same<_Tp, _Tp> : public true_type {};
+
+// is_integral, for some types.
+template  struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+
+// enable_if, functional
+template  struct enable_if{};
+template  struct enable_if{
+  using type = _Tp;
+};
+
+}
Index: clang/test/Headers/Inputs/include/complex
===
--- clang/test/Headers/Inputs/include/complex
+++ clang/test/Headers/Inputs/include/complex
@@ -3,6 +3,7 @@
 #include 
 
 #define INFINITY (__builtin_inff())
+#define NAN (__builtin_nanf (""))
 
 namespace std {
 
@@ -298,4 +299,114 @@
   return !(__x == __y);
 }
 
+template  _Tp abs(const std::complex<_Tp> &__c);
+
+// arg
+
+template  _Tp arg(const std::complex<_Tp> &__c);
+
+// norm
+
+template  _Tp norm(const std::complex<_Tp> &__c);
+
+// conj
+
+template  std::complex<_Tp> conj(const std::complex<_Tp> &__c);
+
+// proj
+
+template  std::complex<_Tp> proj(const std::complex<_Tp> &__c);
+
+// polar
+
+template 
+complex<_Tp> polar(const _Tp &__rho, const _Tp &__theta = _Tp());
+
+// log
+
+template  std::complex<_Tp> log(const std::complex<_Tp> &__x);
+
+// log10
+
+template  std::complex<_Tp> log10(const std::complex<_Tp> &__x);
+
+// sqrt
+
+template 
+std::complex<_Tp> sqrt(const std::complex<_Tp> &__x);
+
+// exp
+
+template 
+std::complex<_Tp> exp(const std::complex<_Tp> &__x);
+
+// pow
+
+template 
+std::complex<_Tp> pow(const std::complex<_Tp> &__x,
+  const std::complex<_Tp> &__y);
+
+// __sqr, computes pow(x, 2)
+
+template  std::complex<_Tp> __sqr(const std

[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-08-25 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/lib/Headers/openmp_wrappers/complex_cmath.h:58
+
+template  __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) {
+  if (std::isinf(__c.real()))

JonChesterfield wrote:
> Doesn't matter hugely given inlining, but I'm surprised to see std::complex 
> taken by const & instead of by value.
I took this from the libc++, I hope they know ;)



Comment at: clang/test/Headers/Inputs/include/type_traits:3
+
+#pragma once
+

JonChesterfield wrote:
> In order to run the tests without libc++/libstdc++ available?
yes. this allows to include the header in the test w/o any system dependence.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85777/new/

https://reviews.llvm.org/D85777

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-08-25 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield accepted this revision.
JonChesterfield added a comment.
This revision is now accepted and ready to land.

The duplication from libc++ doesn't feel good but I can see how it happened. 
Dependency breaking etc.




Comment at: clang/lib/Headers/openmp_wrappers/complex_cmath.h:58
+
+template  __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) {
+  if (std::isinf(__c.real()))

Doesn't matter hugely given inlining, but I'm surprised to see std::complex 
taken by const & instead of by value.



Comment at: clang/test/Headers/Inputs/include/type_traits:3
+
+#pragma once
+

In order to run the tests without libc++/libstdc++ available?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85777/new/

https://reviews.llvm.org/D85777

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-08-11 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

I think the test fail because D85735  was not 
part of the build. Works locally just fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85777/new/

https://reviews.llvm.org/D85777

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-08-11 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 284954.
jdoerfert added a comment.

Reintroduce requires-target into tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85777/new/

https://reviews.llvm.org/D85777

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/openmp_wrappers/complex
  clang/lib/Headers/openmp_wrappers/complex_cmath.h
  clang/test/Headers/Inputs/include/complex
  clang/test/Headers/Inputs/include/type_traits
  clang/test/Headers/nvptx_device_math_complex.cpp

Index: clang/test/Headers/nvptx_device_math_complex.cpp
===
--- clang/test/Headers/nvptx_device_math_complex.cpp
+++ clang/test/Headers/nvptx_device_math_complex.cpp
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -verify -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -aux-triple powerpc64le-unknown-unknown -o - | FileCheck %s
 // expected-no-diagnostics
 
+#include 
 #include 
 
 // CHECK: define weak {{.*}} @__muldc3
@@ -33,6 +34,12 @@
 // CHECK-DAG: call float @__nv_fabsf(
 // CHECK-DAG: call float @__nv_logbf(
 
+// We actually check that there are no declarations of non-OpenMP functions.
+// That is, as long as we don't call an unkown function with a name that
+// doesn't start with '__' we are good :)
+
+// CHECK-NOT: declare.*@[^_]
+
 void test_scmplx(std::complex a) {
 #pragma omp target
   {
@@ -46,3 +53,35 @@
 (void)(a * (a / a));
   }
 }
+
+template 
+std::complex test_template_math_calls(std::complex a) {
+  decltype(a) r = a;
+#pragma omp target
+  {
+r = std::sin(r);
+r = std::cos(r);
+r = std::exp(r);
+r = std::atan(r);
+r = std::acos(r);
+  }
+  return r;
+}
+
+std::complex test_scall(std::complex a) {
+  decltype(a) r;
+#pragma omp target
+  {
+r = std::sin(a);
+  }
+  return test_template_math_calls(r);
+}
+
+std::complex test_dcall(std::complex a) {
+  decltype(a) r;
+#pragma omp target
+  {
+r = std::exp(a);
+  }
+  return test_template_math_calls(r);
+}
Index: clang/test/Headers/Inputs/include/type_traits
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/type_traits
@@ -0,0 +1,43 @@
+/// Copied from libcxx type_traits and simplified
+
+#pragma once
+
+namespace std {
+
+template 
+struct integral_constant {
+  static const _Tp value = __v;
+  typedef _Tp value_type;
+  typedef integral_constant type;
+};
+
+typedef integral_constant true_type;
+typedef integral_constant false_type;
+
+// is_same, functional
+template  struct is_same : public false_type {};
+template  struct is_same<_Tp, _Tp> : public true_type {};
+
+// is_integral, for some types.
+template  struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+
+// enable_if, functional
+template  struct enable_if{};
+template  struct enable_if{
+  using type = _Tp;
+};
+
+}
Index: clang/test/Headers/Inputs/include/complex
===
--- clang/test/Headers/Inputs/include/complex
+++ clang/test/Headers/Inputs/include/complex
@@ -3,6 +3,7 @@
 #include 
 
 #define INFINITY (__builtin_inff())
+#define NAN (__builtin_nanf (""))
 
 namespace std {
 
@@ -298,4 +299,114 @@
   return !(__x == __y);
 }
 
+template  _Tp abs(const std::complex<_Tp> &__c);
+
+// arg
+
+template  _Tp arg(const std::complex<_Tp> &__c);
+
+// norm
+
+template  _Tp norm(const std::complex<_Tp> &__c);
+
+// conj
+
+template  std::complex<_Tp> conj(const std::complex<_Tp> &__c);
+
+// proj
+
+template  std::complex<_Tp> proj(const std::complex<_Tp> &__c);
+
+// polar
+
+template 
+complex<_Tp> polar(const _Tp &__rho, const _Tp &__theta = _Tp());
+
+// log
+
+template  std::complex<_Tp> log(const std::complex<_Tp> &__x);
+
+// log10
+
+template  std::complex<_Tp> log10(const std::complex<_Tp> &__x);
+
+// sqrt
+
+template 
+std::complex<_Tp> sqrt(const std::complex<_Tp> &__x);
+
+// exp
+
+template 
+std::complex<_Tp> exp(const std::complex<_Tp> &__x);
+
+// pow
+
+template 
+std::complex<_Tp> pow(const std::complex<_Tp> &__x,
+  const std::complex<_Tp> &__y);
+
+// __sqr, computes pow(x, 2)
+
+template  std::complex<_Tp> __sqr(const std::complex<_Tp> &__x);
+
+// asinh
+
+template 
+std::complex<_Tp> asinh(const std::complex<_Tp> &__x);
+
+// acosh
+
+template 
+std::comp

[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-08-11 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 284898.
jdoerfert added a comment.

Update test and include mock `type_traits` header


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85777/new/

https://reviews.llvm.org/D85777

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/openmp_wrappers/complex
  clang/lib/Headers/openmp_wrappers/complex_cmath.h
  clang/test/Headers/Inputs/include/complex
  clang/test/Headers/Inputs/include/type_traits
  clang/test/Headers/nvptx_device_math_complex.c
  clang/test/Headers/nvptx_device_math_complex.cpp

Index: clang/test/Headers/nvptx_device_math_complex.cpp
===
--- clang/test/Headers/nvptx_device_math_complex.cpp
+++ clang/test/Headers/nvptx_device_math_complex.cpp
@@ -1,8 +1,8 @@
-// REQUIRES: nvptx-registered-target
 // RUN: %clang_cc1 -verify -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
 // RUN: %clang_cc1 -verify -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -aux-triple powerpc64le-unknown-unknown -o - | FileCheck %s
 // expected-no-diagnostics
 
+#include 
 #include 
 
 // CHECK: define weak {{.*}} @__muldc3
@@ -33,6 +33,12 @@
 // CHECK-DAG: call float @__nv_fabsf(
 // CHECK-DAG: call float @__nv_logbf(
 
+// We actually check that there are no declarations of non-OpenMP functions.
+// That is, as long as we don't call an unkown function with a name that
+// doesn't start with '__' we are good :)
+
+// CHECK-NOT: declare.*@[^_]
+
 void test_scmplx(std::complex a) {
 #pragma omp target
   {
@@ -46,3 +52,35 @@
 (void)(a * (a / a));
   }
 }
+
+template 
+std::complex test_template_math_calls(std::complex a) {
+  decltype(a) r = a;
+#pragma omp target
+  {
+r = std::sin(r);
+r = std::cos(r);
+r = std::exp(r);
+r = std::atan(r);
+r = std::acos(r);
+  }
+  return r;
+}
+
+std::complex test_scall(std::complex a) {
+  decltype(a) r;
+#pragma omp target
+  {
+r = std::sin(a);
+  }
+  return test_template_math_calls(r);
+}
+
+std::complex test_dcall(std::complex a) {
+  decltype(a) r;
+#pragma omp target
+  {
+r = std::exp(a);
+  }
+  return test_template_math_calls(r);
+}
Index: clang/test/Headers/nvptx_device_math_complex.c
===
--- clang/test/Headers/nvptx_device_math_complex.c
+++ clang/test/Headers/nvptx_device_math_complex.c
@@ -1,4 +1,3 @@
-// REQUIRES: nvptx-registered-target
 // RUN: %clang_cc1 -verify -internal-isystem %S/Inputs/include -fopenmp -x c -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
 // RUN: %clang_cc1 -verify -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -x c -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -aux-triple powerpc64le-unknown-unknown -o - | FileCheck %s
 // RUN: %clang_cc1 -verify -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
Index: clang/test/Headers/Inputs/include/type_traits
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/type_traits
@@ -0,0 +1,43 @@
+/// Copied from libcxx type_traits and simplified
+
+#pragma once
+
+namespace std {
+
+template 
+struct integral_constant {
+  static const _Tp value = __v;
+  typedef _Tp value_type;
+  typedef integral_constant type;
+};
+
+typedef integral_constant true_type;
+typedef integral_constant false_type;
+
+// is_same, functional
+template  struct is_same : public false_type {};
+template  struct is_same<_Tp, _Tp> : public true_type {};
+
+// is_integral, for some types.
+template  struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+template <> struct is_integral
+: public integral_constant {};
+
+// enable_if, functional
+template  struct enable_if{};
+template  struct enable_if{
+  using type = _Tp;
+};
+
+}
Index: clang/test/Headers/Inputs/include/complex
===
--- clang/test/Headers/Inputs/

[PATCH] D85777: [OpenMP] Support std::complex math functions in target regions

2020-08-11 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert created this revision.
jdoerfert added reviewers: JonChesterfield, jhuber6, ABataev.
Herald added subscribers: guansong, bollu, yaxunl, mgorny.
Herald added a project: clang.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.

The last (big) missing piece to get "math" working in OpenMP target
regions (that I know of) was complex math functions, e.g.,
`std::sin(std::complex)`. With this patch we overload the system
template functions for these operations with versions that have been
distilled from `libcxx/include/complex`. We use the same

  `omp begin/end declare variant`

mechanism we use for other math functions before, except that we this
time overload templates (via D85735 ).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85777

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/openmp_wrappers/complex
  clang/lib/Headers/openmp_wrappers/complex_cmath.h
  clang/test/Headers/Inputs/include/complex
  clang/test/Headers/nvptx_device_math_complex.c
  clang/test/Headers/nvptx_device_math_complex.cpp

Index: clang/test/Headers/nvptx_device_math_complex.cpp
===
--- clang/test/Headers/nvptx_device_math_complex.cpp
+++ clang/test/Headers/nvptx_device_math_complex.cpp
@@ -1,8 +1,8 @@
-// REQUIRES: nvptx-registered-target
 // RUN: %clang_cc1 -verify -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
 // RUN: %clang_cc1 -verify -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -aux-triple powerpc64le-unknown-unknown -o - | FileCheck %s
 // expected-no-diagnostics
 
+#include 
 #include 
 
 // CHECK: define weak {{.*}} @__muldc3
@@ -33,6 +33,38 @@
 // CHECK-DAG: call float @__nv_fabsf(
 // CHECK-DAG: call float @__nv_logbf(
 
+// We might actually want to check that there are no declarations of non-OpenMP functions instead.
+// That is, as long as we don't call an unkown function with a name that doesn't start with '__' we are good :)
+
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL71sin$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL72sinh$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex.0" @"_ZStL71exp$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIdESt7complexIT_ERKS2_"(%"struct.std::complex.0"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL71sin$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZSt71cos$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL71exp$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL72atan$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL72acos$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL72cosh$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL73atanh$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZSt73__sqr$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZStL72sqrt$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex" @"_ZSt71log$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIfESt7complexIT_ERKS2_"(%"struct.std::complex"*
+// CHECK-DAG: call %"struct.std::complex.0" @"_ZStL71sin$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIdESt7complexIT_ERKS2_"(%"struct.std::complex.0"*
+// CHECK-DAG: call %"struct.std::complex.0" @"_ZSt71cos$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_any$Pallow_templatesIdESt7complexIT_ERKS2_"(%"struct.std::complex.0"*
+// CHECK-DAG: call %"struct.std::