| 1 |
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py |
| 2 |
// REQUIRES: amdgpu-registered-target |
| 3 |
|
| 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 |
| 10 |
|
| 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 |
| 18 |
|
| 19 |
// DEFAULT-LABEL: @test_fma_f16( |
| 20 |
// DEFAULT-NEXT: entry: |
| 21 |
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef half @llvm.fma.f16(half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) |
| 22 |
// DEFAULT-NEXT: ret half [[TMP0]] |
| 23 |
// |
| 24 |
// FINITEONLY-LABEL: @test_fma_f16( |
| 25 |
// FINITEONLY-NEXT: entry: |
| 26 |
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef half @llvm.fma.f16(half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) |
| 27 |
// FINITEONLY-NEXT: ret half [[TMP0]] |
| 28 |
// |
| 29 |
extern "C" __device__ _Float16 test_fma_f16(_Float16 x, _Float16 y, |
| 30 |
_Float16 z) { |
| 31 |
return fma(x, y, z); |
| 32 |
} |
| 33 |
|
| 34 |
// DEFAULT-LABEL: @test_pow_f16( |
| 35 |
// DEFAULT-NEXT: entry: |
| 36 |
// DEFAULT-NEXT: [[CALL_I:%.*]] = tail call contract noundef half @__ocml_pown_f16(half noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR7:[0-9]+]] |
| 37 |
// DEFAULT-NEXT: ret half [[CALL_I]] |
| 38 |
// |
| 39 |
// FINITEONLY-LABEL: @test_pow_f16( |
| 40 |
// FINITEONLY-NEXT: entry: |
| 41 |
// FINITEONLY-NEXT: [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) half @__ocml_pown_f16(half noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR7:[0-9]+]] |
| 42 |
// FINITEONLY-NEXT: ret half [[CALL_I]] |
| 43 |
// |
| 44 |
extern "C" __device__ _Float16 test_pow_f16(_Float16 x, int y) { |
| 45 |
return pow(x, y); |
| 46 |
} |
| 47 |
|
| 48 |
// DEFAULT-LABEL: @test_fabs_f32( |
| 49 |
// DEFAULT-NEXT: entry: |
| 50 |
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.fabs.f32(float [[X:%.*]]) |
| 51 |
// DEFAULT-NEXT: ret float [[TMP0]] |
| 52 |
// |
| 53 |
// FINITEONLY-LABEL: @test_fabs_f32( |
| 54 |
// FINITEONLY-NEXT: entry: |
| 55 |
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.fabs.f32(float [[X:%.*]]) |
| 56 |
// FINITEONLY-NEXT: ret float [[TMP0]] |
| 57 |
// |
| 58 |
extern "C" __device__ float test_fabs_f32(float x) { |
| 59 |
return fabs(x); |
| 60 |
} |
| 61 |
|
| 62 |
// DEFAULT-LABEL: @test_sin_f32( |
| 63 |
// DEFAULT-NEXT: entry: |
| 64 |
// DEFAULT-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_sin_f32(float noundef [[X:%.*]]) #[[ATTR8:[0-9]+]] |
| 65 |
// DEFAULT-NEXT: ret float [[CALL_I1]] |
| 66 |
// |
| 67 |
// FINITEONLY-LABEL: @test_sin_f32( |
| 68 |
// FINITEONLY-NEXT: entry: |
| 69 |
// FINITEONLY-NEXT: [[CALL_I1:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR8:[0-9]+]] |
| 70 |
// FINITEONLY-NEXT: ret float [[CALL_I1]] |
| 71 |
// |
| 72 |
extern "C" __device__ float test_sin_f32(float x) { |
| 73 |
return sin(x); |
| 74 |
} |
| 75 |
|
| 76 |
// DEFAULT-LABEL: @test_cos_f32( |
| 77 |
// DEFAULT-NEXT: entry: |
| 78 |
// DEFAULT-NEXT: [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_cos_f32(float noundef [[X:%.*]]) #[[ATTR8]] |
| 79 |
// DEFAULT-NEXT: ret float [[CALL_I1]] |
| 80 |
// |
| 81 |
// FINITEONLY-LABEL: @test_cos_f32( |
| 82 |
// FINITEONLY-NEXT: entry: |
| 83 |
// FINITEONLY-NEXT: [[CALL_I1:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR8]] |
| 84 |
// FINITEONLY-NEXT: ret float [[CALL_I1]] |
| 85 |
// |
| 86 |
extern "C" __device__ float test_cos_f32(float x) { |
| 87 |
return cos(x); |
| 88 |
} |