Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Headers / gpu_disabled_math.cpp
blob6e697f52120aebda50135b5c40515bc75d981c3e
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2 // RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h \
3 // RUN: -internal-isystem %S/../../lib/Headers/cuda_wrappers \
4 // RUN: -internal-isystem %S/Inputs/include \
5 // RUN: -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
6 // RUN: -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -o - \
7 // RUN: -D __CLANG_GPU_DISABLE_MATH_WRAPPERS | FileCheck -check-prefix=AMDGPU %s
9 // RUN: %clang_cc1 -include __clang_cuda_runtime_wrapper.h \
10 // RUN: -internal-isystem %S/../../lib/Headers/cuda_wrappers \
11 // RUN: -internal-isystem %S/Inputs/include \
12 // RUN: -triple nvptx64-nvidia-cuda -aux-triple x86_64-unknown-unknown \
13 // RUN: -target-cpu sm_90 -emit-llvm %s -fcuda-is-device -o - \
14 // RUN: -D __CLANG_GPU_DISABLE_MATH_WRAPPERS | FileCheck -check-prefix=NVPTX %s
16 extern "C" double sin(double x);
18 // AMDGPU-LABEL: define dso_local noundef double @_Z3food(
19 // AMDGPU-SAME: double noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] {
20 // AMDGPU-NEXT: [[ENTRY:.*:]]
21 // AMDGPU-NEXT: [[RETVAL:%.*]] = alloca double, align 8, addrspace(5)
22 // AMDGPU-NEXT: [[X_ADDR:%.*]] = alloca double, align 8, addrspace(5)
23 // AMDGPU-NEXT: [[RETVAL_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL]] to ptr
24 // AMDGPU-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
25 // AMDGPU-NEXT: store double [[X]], ptr [[X_ADDR_ASCAST]], align 8
26 // AMDGPU-NEXT: [[TMP0:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
27 // AMDGPU-NEXT: [[TMP1:%.*]] = call double @llvm.sin.f64(double [[TMP0]])
28 // AMDGPU-NEXT: ret double [[TMP1]]
30 // NVPTX-LABEL: define dso_local noundef double @_Z3food(
31 // NVPTX-SAME: double noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] {
32 // NVPTX-NEXT: [[ENTRY:.*:]]
33 // NVPTX-NEXT: [[X_ADDR:%.*]] = alloca double, align 8
34 // NVPTX-NEXT: store double [[X]], ptr [[X_ADDR]], align 8
35 // NVPTX-NEXT: [[TMP0:%.*]] = load double, ptr [[X_ADDR]], align 8
36 // NVPTX-NEXT: [[TMP1:%.*]] = call double @llvm.sin.f64(double [[TMP0]])
37 // NVPTX-NEXT: ret double [[TMP1]]
39 double foo(double x) {
40 return sin(x);