library-builtin.cu 938 B

12345678910111213141516171819202122
  1. // REQUIRES: x86-registered-target
  2. // REQUIRES: nvptx-registered-target
  3. // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | \
  4. // RUN: FileCheck --check-prefixes=HOST,BOTH %s
  5. // RUN: %clang_cc1 -fcuda-is-device -triple nvptx64-nvidia-cuda \
  6. // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=DEVICE,BOTH
  7. // BOTH-LABEL: define float @logf(float
  8. // logf() should be calling itself recursively as we don't have any standard
  9. // library on device side.
  10. // DEVICE: call float @logf(float
  11. extern "C" __attribute__((device)) float logf(float __x) { return logf(__x); }
  12. // NOTE: this case is to illustrate the expected differences in behavior between
  13. // the host and device. In general we do not mess with host-side standard
  14. // library.
  15. //
  16. // Host is assumed to have standard library, so logf() calls LLVM intrinsic.
  17. // HOST: call float @llvm.log.f32(float
  18. extern "C" float logf(float __x) { return logf(__x); }