|
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 |
8 |
| - |
9 |
| -// NATIVE_HALF: define noundef nofpclass(nan inf) half @ |
10 |
| -// NATIVE_HALF: call reassoc nnan ninf nsz arcp afn half @llvm.fabs.f16(half |
11 |
| -// NO_HALF: call reassoc nnan ninf nsz arcp afn float @llvm.fabs.f32(float |
12 |
| -// NATIVE_HALF: ret half |
13 |
| -// NO_HALF: ret float |
14 |
| -half test_length_half(half p0) |
15 |
| -{ |
16 |
| - return length(p0); |
17 |
| -} |
18 |
| -// NATIVE_HALF: define noundef nofpclass(nan inf) half @ |
19 |
| -// NATIVE_HALF: %hlsl.length = call reassoc nnan ninf nsz arcp afn half @llvm.dx.length.v2f16 |
20 |
| -// NO_HALF: %hlsl.length = call reassoc nnan ninf nsz arcp afn float @llvm.dx.length.v2f32( |
21 |
| -// NATIVE_HALF: ret half %hlsl.length |
22 |
| -// NO_HALF: ret float %hlsl.length |
23 |
| -half test_length_half2(half2 p0) |
24 |
| -{ |
25 |
| - return length(p0); |
26 |
| -} |
27 |
| -// NATIVE_HALF: define noundef nofpclass(nan inf) half @ |
28 |
| -// NATIVE_HALF: %hlsl.length = call reassoc nnan ninf nsz arcp afn half @llvm.dx.length.v3f16 |
29 |
| -// NO_HALF: %hlsl.length = call reassoc nnan ninf nsz arcp afn float @llvm.dx.length.v3f32( |
30 |
| -// NATIVE_HALF: ret half %hlsl.length |
31 |
| -// NO_HALF: ret float %hlsl.length |
32 |
| -half test_length_half3(half3 p0) |
33 |
| -{ |
34 |
| - return length(p0); |
35 |
| -} |
36 |
| -// NATIVE_HALF: define noundef nofpclass(nan inf) half @ |
37 |
| -// NATIVE_HALF: %hlsl.length = call reassoc nnan ninf nsz arcp afn half @llvm.dx.length.v4f16 |
38 |
| -// NO_HALF: %hlsl.length = call reassoc nnan ninf nsz arcp afn float @llvm.dx.length.v4f32( |
39 |
| -// NATIVE_HALF: ret half %hlsl.length |
40 |
| -// NO_HALF: ret float %hlsl.length |
41 |
| -half test_length_half4(half4 p0) |
42 |
| -{ |
43 |
| - return length(p0); |
44 |
| -} |
45 |
| - |
46 |
| -// CHECK: define noundef nofpclass(nan inf) float @ |
47 |
| -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.fabs.f32(float |
48 |
| -// CHECK: ret float |
49 |
| -float test_length_float(float p0) |
50 |
| -{ |
51 |
| - return length(p0); |
52 |
| -} |
53 |
| -// CHECK: define noundef nofpclass(nan inf) float @ |
54 |
| -// CHECK: %hlsl.length = call reassoc nnan ninf nsz arcp afn float @llvm.dx.length.v2f32( |
55 |
| -// CHECK: ret float %hlsl.length |
56 |
| -float test_length_float2(float2 p0) |
57 |
| -{ |
58 |
| - return length(p0); |
59 |
| -} |
60 |
| -// CHECK: define noundef nofpclass(nan inf) float @ |
61 |
| -// CHECK: %hlsl.length = call reassoc nnan ninf nsz arcp afn float @llvm.dx.length.v3f32( |
62 |
| -// CHECK: ret float %hlsl.length |
63 |
| -float test_length_float3(float3 p0) |
64 |
| -{ |
65 |
| - return length(p0); |
66 |
| -} |
67 |
| -// CHECK: define noundef nofpclass(nan inf) float @ |
68 |
| -// CHECK: %hlsl.length = call reassoc nnan ninf nsz arcp afn float @llvm.dx.length.v4f32( |
69 |
| -// CHECK: ret float %hlsl.length |
70 |
| -float test_length_float4(float4 p0) |
71 |
| -{ |
72 |
| - return length(p0); |
73 |
| -} |
| 1 | +// RUN: %clang_cc1 -finclude-default-header -triple \ |
| 2 | +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ |
| 3 | +// RUN: -emit-llvm -O1 -o - | FileCheck %s --check-prefixes=CHECK,DXCHECK \ |
| 4 | +// RUN: -DTARGET=dx |
| 5 | + |
| 6 | +// RUN: %clang_cc1 -finclude-default-header -triple \ |
| 7 | +// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ |
| 8 | +// RUN: -emit-llvm -O1 -o - | FileCheck %s --check-prefixes=CHECK,SPVCHECK \ |
| 9 | +// RUN: -DTARGET=spv |
| 10 | + |
| 11 | + |
| 12 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) half @_Z16test_length_halfDh( |
| 13 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) half @_Z16test_length_halfDh( |
| 14 | +// CHECK-SAME: half noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 15 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 16 | +// CHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef half @llvm.fabs.f16(half [[P0]]) |
| 17 | +// CHECK-NEXT: ret half [[ELT_ABS_I]] |
| 18 | +// |
| 19 | + |
| 20 | +half test_length_half(half p0) |
| 21 | +{ |
| 22 | + return length(p0); |
| 23 | +} |
| 24 | + |
| 25 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) half @_Z17test_length_half2Dv2_Dh( |
| 26 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) half @_Z17test_length_half2Dv2_Dh( |
| 27 | +// CHECK-SAME: <2 x half> noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 28 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 29 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn half @llvm.[[TARGET]].fdot.v2f16(<2 x half> [[P0]], <2 x half> [[P0]]) |
| 30 | +// CHECK-NEXT: [[TMP0:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef half @llvm.sqrt.f16(half [[HLSL_DOT_I]]) |
| 31 | +// CHECK-NEXT: ret half [[TMP0]] |
| 32 | +// |
| 33 | + |
| 34 | + |
| 35 | +half test_length_half2(half2 p0) |
| 36 | +{ |
| 37 | + return length(p0); |
| 38 | +} |
| 39 | + |
| 40 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) half @_Z17test_length_half3Dv3_Dh( |
| 41 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) half @_Z17test_length_half3Dv3_Dh( |
| 42 | +// CHECK-SAME: <3 x half> noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 43 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 44 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn half @llvm.[[TARGET]].fdot.v3f16(<3 x half> [[P0]], <3 x half> [[P0]]) |
| 45 | +// CHECK-NEXT: [[TMP0:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef half @llvm.sqrt.f16(half [[HLSL_DOT_I]]) |
| 46 | +// CHECK-NEXT: ret half [[TMP0]] |
| 47 | +// |
| 48 | +half test_length_half3(half3 p0) |
| 49 | +{ |
| 50 | + return length(p0); |
| 51 | +} |
| 52 | + |
| 53 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) half @_Z17test_length_half4Dv4_Dh( |
| 54 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) half @_Z17test_length_half4Dv4_Dh( |
| 55 | +// CHECK-SAME: <4 x half> noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 56 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 57 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn half @llvm.[[TARGET]].fdot.v4f16(<4 x half> [[P0]], <4 x half> [[P0]]) |
| 58 | +// CHECK-NEXT: [[TMP0:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef half @llvm.sqrt.f16(half [[HLSL_DOT_I]]) |
| 59 | +// CHECK-NEXT: ret half [[TMP0]] |
| 60 | +// |
| 61 | +half test_length_half4(half4 p0) |
| 62 | +{ |
| 63 | + return length(p0); |
| 64 | +} |
| 65 | + |
| 66 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) float @_Z17test_length_floatf( |
| 67 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) float @_Z17test_length_floatf( |
| 68 | +// CHECK-SAME: float noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 69 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 70 | +// CHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef float @llvm.fabs.f32(float [[P0]]) |
| 71 | +// CHECK-NEXT: ret float [[ELT_ABS_I]] |
| 72 | +// |
| 73 | +float test_length_float(float p0) |
| 74 | +{ |
| 75 | + return length(p0); |
| 76 | +} |
| 77 | + |
| 78 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) float @_Z18test_length_float2Dv2_f( |
| 79 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) float @_Z18test_length_float2Dv2_f( |
| 80 | +// CHECK-SAME: <2 x float> noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 81 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 82 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].fdot.v2f32(<2 x float> [[P0]], <2 x float> [[P0]]) |
| 83 | +// CHECK-NEXT: [[TMP0:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef float @llvm.sqrt.f32(float [[HLSL_DOT_I]]) |
| 84 | +// CHECK-NEXT: ret float [[TMP0]] |
| 85 | +// |
| 86 | +float test_length_float2(float2 p0) |
| 87 | +{ |
| 88 | + return length(p0); |
| 89 | +} |
| 90 | + |
| 91 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) float @_Z18test_length_float3Dv3_f( |
| 92 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) float @_Z18test_length_float3Dv3_f( |
| 93 | +// CHECK-SAME: <3 x float> noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 94 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 95 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].fdot.v3f32(<3 x float> [[P0]], <3 x float> [[P0]]) |
| 96 | +// CHECK-NEXT: [[TMP0:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef float @llvm.sqrt.f32(float [[HLSL_DOT_I]]) |
| 97 | +// CHECK-NEXT: ret float [[TMP0]] |
| 98 | +// |
| 99 | +float test_length_float3(float3 p0) |
| 100 | +{ |
| 101 | + return length(p0); |
| 102 | +} |
| 103 | + |
| 104 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) float @_Z18test_length_float4Dv4_f( |
| 105 | +// DXCHECK-LABEL: define noundef nofpclass(nan inf) float @_Z18test_length_float4Dv4_f( |
| 106 | +// CHECK-SAME: <4 x float> noundef nofpclass(nan inf) [[P0:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 107 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 108 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].fdot.v4f32(<4 x float> [[P0]], <4 x float> [[P0]]) |
| 109 | +// CHECK-NEXT: [[TMP0:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef float @llvm.sqrt.f32(float [[HLSL_DOT_I]]) |
| 110 | +// CHECK-NEXT: ret float [[TMP0]] |
| 111 | +// |
| 112 | +float test_length_float4(float4 p0) |
| 113 | +{ |
| 114 | + return length(p0); |
| 115 | +} |
0 commit comments