|
1 |
| -// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ |
2 |
| -// RUN: dxil-pc-shadermodel6.2-library %s -fnative-half-type \ |
3 |
| -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s |
| 1 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 2 | +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ |
| 3 | +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ |
| 4 | +// RUN: --check-prefixes=CHECK,NATIVE_HALF |
| 5 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 6 | +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ |
| 7 | +// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF |
4 | 8 |
|
5 |
| -using hlsl::sqrt; |
| 9 | +// NATIVE_HALF: define noundef half @ |
| 10 | +// NATIVE_HALF: %{{.*}} = call half @llvm.sqrt.f16( |
| 11 | +// NATIVE_HALF: ret half %{{.*}} |
| 12 | +// NO_HALF: define noundef float @"?test_sqrt_half@@YA$halff@$halff@@Z"( |
| 13 | +// NO_HALF: %{{.*}} = call float @llvm.sqrt.f32( |
| 14 | +// NO_HALF: ret float %{{.*}} |
| 15 | +half test_sqrt_half(half p0) { return sqrt(p0); } |
| 16 | +// NATIVE_HALF: define noundef <2 x half> @ |
| 17 | +// NATIVE_HALF: %{{.*}} = call <2 x half> @llvm.sqrt.v2f16 |
| 18 | +// NATIVE_HALF: ret <2 x half> %{{.*}} |
| 19 | +// NO_HALF: define noundef <2 x float> @ |
| 20 | +// NO_HALF: %{{.*}} = call <2 x float> @llvm.sqrt.v2f32( |
| 21 | +// NO_HALF: ret <2 x float> %{{.*}} |
| 22 | +half2 test_sqrt_half2(half2 p0) { return sqrt(p0); } |
| 23 | +// NATIVE_HALF: define noundef <3 x half> @ |
| 24 | +// NATIVE_HALF: %{{.*}} = call <3 x half> @llvm.sqrt.v3f16 |
| 25 | +// NATIVE_HALF: ret <3 x half> %{{.*}} |
| 26 | +// NO_HALF: define noundef <3 x float> @ |
| 27 | +// NO_HALF: %{{.*}} = call <3 x float> @llvm.sqrt.v3f32( |
| 28 | +// NO_HALF: ret <3 x float> %{{.*}} |
| 29 | +half3 test_sqrt_half3(half3 p0) { return sqrt(p0); } |
| 30 | +// NATIVE_HALF: define noundef <4 x half> @ |
| 31 | +// NATIVE_HALF: %{{.*}} = call <4 x half> @llvm.sqrt.v4f16 |
| 32 | +// NATIVE_HALF: ret <4 x half> %{{.*}} |
| 33 | +// NO_HALF: define noundef <4 x float> @ |
| 34 | +// NO_HALF: %{{.*}} = call <4 x float> @llvm.sqrt.v4f32( |
| 35 | +// NO_HALF: ret <4 x float> %{{.*}} |
| 36 | +half4 test_sqrt_half4(half4 p0) { return sqrt(p0); } |
6 | 37 |
|
7 |
| -double sqrt_d(double x) |
8 |
| -{ |
9 |
| - return sqrt(x); |
10 |
| -} |
11 |
| - |
12 |
| -// CHECK: define noundef double @"?sqrt_d@@YANN@Z"( |
13 |
| -// CHECK: call double @llvm.sqrt.f64(double %0) |
14 |
| - |
15 |
| -float sqrt_f(float x) |
16 |
| -{ |
17 |
| - return sqrt(x); |
18 |
| -} |
19 |
| - |
20 |
| -// CHECK: define noundef float @"?sqrt_f@@YAMM@Z"( |
21 |
| -// CHECK: call float @llvm.sqrt.f32(float %0) |
22 |
| - |
23 |
| -half sqrt_h(half x) |
24 |
| -{ |
25 |
| - return sqrt(x); |
26 |
| -} |
27 |
| - |
28 |
| -// CHECK: define noundef half @"?sqrt_h@@YA$f16@$f16@@Z"( |
29 |
| -// CHECK: call half @llvm.sqrt.f16(half %0) |
| 38 | +// CHECK: define noundef float @ |
| 39 | +// CHECK: %{{.*}} = call float @llvm.sqrt.f32( |
| 40 | +// CHECK: ret float %{{.*}} |
| 41 | +float test_sqrt_float(float p0) { return sqrt(p0); } |
| 42 | +// CHECK: define noundef <2 x float> @ |
| 43 | +// CHECK: %{{.*}} = call <2 x float> @llvm.sqrt.v2f32 |
| 44 | +// CHECK: ret <2 x float> %{{.*}} |
| 45 | +float2 test_sqrt_float2(float2 p0) { return sqrt(p0); } |
| 46 | +// CHECK: define noundef <3 x float> @ |
| 47 | +// CHECK: %{{.*}} = call <3 x float> @llvm.sqrt.v3f32 |
| 48 | +// CHECK: ret <3 x float> %{{.*}} |
| 49 | +float3 test_sqrt_float3(float3 p0) { return sqrt(p0); } |
| 50 | +// CHECK: define noundef <4 x float> @ |
| 51 | +// CHECK: %{{.*}} = call <4 x float> @llvm.sqrt.v4f32 |
| 52 | +// CHECK: ret <4 x float> %{{.*}} |
| 53 | +float4 test_sqrt_float4(float4 p0) { return sqrt(p0); } |
0 commit comments