[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Headers / __clang_hip_cmath.hip
blobe8d9445204072a237305562b3b2fc274e1027844
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: amdgpu-registered-target
4 // RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h      \
5 // RUN:   -internal-isystem %S/../../lib/Headers/cuda_wrappers \
6 // RUN:   -internal-isystem %S/Inputs/include \
7 // RUN:   -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
8 // RUN:   -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -O1 -o - \
9 // RUN:   -D__HIPCC_RTC__ | FileCheck -check-prefix=DEFAULT %s
11 // Check that we end up with fast math flags set on intrinsic calls
12 // RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h \
13 // RUN:   -internal-isystem %S/../../lib/Headers/cuda_wrappers \
14 // RUN:   -internal-isystem %S/Inputs/include \
15 // RUN:   -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
16 // RUN:   -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -O1 -ffinite-math-only -o - \
17 // RUN:   -D__HIPCC_RTC__ | FileCheck -check-prefix=FINITEONLY %s
19 // DEFAULT-LABEL: @test_fma_f16(
20 // DEFAULT-NEXT:  entry:
21 // DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract half @__ocml_fma_f16(half noundef [[X:%.*]], half noundef [[Y:%.*]], half noundef [[Z:%.*]]) #[[ATTR6:[0-9]+]]
22 // DEFAULT-NEXT:    ret half [[CALL_I]]
24 // FINITEONLY-LABEL: @test_fma_f16(
25 // FINITEONLY-NEXT:  entry:
26 // FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract half @__ocml_fma_f16(half noundef [[X:%.*]], half noundef [[Y:%.*]], half noundef [[Z:%.*]]) #[[ATTR6:[0-9]+]]
27 // FINITEONLY-NEXT:    ret half [[CALL_I]]
29 extern "C" __device__ _Float16 test_fma_f16(_Float16 x, _Float16 y,
30                                             _Float16 z) {
31   return fma(x, y, z);
34 // DEFAULT-LABEL: @test_pow_f16(
35 // DEFAULT-NEXT:  entry:
36 // DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract half @__ocml_pown_f16(half noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR7:[0-9]+]]
37 // DEFAULT-NEXT:    ret half [[CALL_I]]
39 // FINITEONLY-LABEL: @test_pow_f16(
40 // FINITEONLY-NEXT:  entry:
41 // FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract half @__ocml_pown_f16(half noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR7:[0-9]+]]
42 // FINITEONLY-NEXT:    ret half [[CALL_I]]
44 extern "C" __device__ _Float16 test_pow_f16(_Float16 x, int y) {
45   return pow(x, y);