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