|
| 1 | +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 3 | +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ |
| 4 | +// RUN: -emit-llvm -O1 -o - | FileCheck %s |
| 5 | + |
| 6 | +// CHECK-LABEL: define noundef half @_Z18test_distance_halfDhDh( |
| 7 | +// CHECK-SAME: half noundef [[X:%.*]], half noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 8 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 9 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub half [[X]], [[Y]] |
| 10 | +// CHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call noundef half @llvm.fabs.f16(half [[SUB_I]]) |
| 11 | +// CHECK-NEXT: ret half [[ELT_ABS_I]] |
| 12 | +// |
| 13 | +half test_distance_half(half X, half Y) { return distance(X, Y); } |
| 14 | + |
| 15 | +// CHECK-LABEL: define noundef half @_Z19test_distance_half2Dv2_DhS_( |
| 16 | +// CHECK-SAME: <2 x half> noundef [[X:%.*]], <2 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 17 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 18 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub <2 x half> [[X]], [[Y]] |
| 19 | +// CHECK-NEXT: [[HLSL_LENGTH_I:%.*]] = tail call noundef half @llvm.dx.length.v2f16(<2 x half> [[SUB_I]]) |
| 20 | +// CHECK-NEXT: ret half [[HLSL_LENGTH_I]] |
| 21 | +// |
| 22 | +half test_distance_half2(half2 X, half2 Y) { return distance(X, Y); } |
| 23 | + |
| 24 | +// CHECK-LABEL: define noundef half @_Z19test_distance_half3Dv3_DhS_( |
| 25 | +// CHECK-SAME: <3 x half> noundef [[X:%.*]], <3 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 26 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 27 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub <3 x half> [[X]], [[Y]] |
| 28 | +// CHECK-NEXT: [[HLSL_LENGTH_I:%.*]] = tail call noundef half @llvm.dx.length.v3f16(<3 x half> [[SUB_I]]) |
| 29 | +// CHECK-NEXT: ret half [[HLSL_LENGTH_I]] |
| 30 | +// |
| 31 | +half test_distance_half3(half3 X, half3 Y) { return distance(X, Y); } |
| 32 | + |
| 33 | +// CHECK-LABEL: define noundef half @_Z19test_distance_half4Dv4_DhS_( |
| 34 | +// CHECK-SAME: <4 x half> noundef [[X:%.*]], <4 x half> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 35 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 36 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub <4 x half> [[X]], [[Y]] |
| 37 | +// CHECK-NEXT: [[HLSL_LENGTH_I:%.*]] = tail call noundef half @llvm.dx.length.v4f16(<4 x half> [[SUB_I]]) |
| 38 | +// CHECK-NEXT: ret half [[HLSL_LENGTH_I]] |
| 39 | +// |
| 40 | +half test_distance_half4(half4 X, half4 Y) { return distance(X, Y); } |
| 41 | + |
| 42 | +// CHECK-LABEL: define noundef float @_Z19test_distance_floatff( |
| 43 | +// CHECK-SAME: float noundef [[X:%.*]], float noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 44 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 45 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub float [[X]], [[Y]] |
| 46 | +// CHECK-NEXT: [[ELT_ABS_I:%.*]] = tail call noundef float @llvm.fabs.f32(float [[SUB_I]]) |
| 47 | +// CHECK-NEXT: ret float [[ELT_ABS_I]] |
| 48 | +// |
| 49 | +float test_distance_float(float X, float Y) { return distance(X, Y); } |
| 50 | + |
| 51 | +// CHECK-LABEL: define noundef float @_Z20test_distance_float2Dv2_fS_( |
| 52 | +// CHECK-SAME: <2 x float> noundef [[X:%.*]], <2 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 53 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 54 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub <2 x float> [[X]], [[Y]] |
| 55 | +// CHECK-NEXT: [[HLSL_LENGTH_I:%.*]] = tail call noundef float @llvm.dx.length.v2f32(<2 x float> [[SUB_I]]) |
| 56 | +// CHECK-NEXT: ret float [[HLSL_LENGTH_I]] |
| 57 | +// |
| 58 | +float test_distance_float2(float2 X, float2 Y) { return distance(X, Y); } |
| 59 | + |
| 60 | +// CHECK-LABEL: define noundef float @_Z20test_distance_float3Dv3_fS_( |
| 61 | +// CHECK-SAME: <3 x float> noundef [[X:%.*]], <3 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 62 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 63 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub <3 x float> [[X]], [[Y]] |
| 64 | +// CHECK-NEXT: [[HLSL_LENGTH_I:%.*]] = tail call noundef float @llvm.dx.length.v3f32(<3 x float> [[SUB_I]]) |
| 65 | +// CHECK-NEXT: ret float [[HLSL_LENGTH_I]] |
| 66 | +// |
| 67 | +float test_distance_float3(float3 X, float3 Y) { return distance(X, Y); } |
| 68 | + |
| 69 | +// CHECK-LABEL: define noundef float @_Z20test_distance_float4Dv4_fS_( |
| 70 | +// CHECK-SAME: <4 x float> noundef [[X:%.*]], <4 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 71 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 72 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub <4 x float> [[X]], [[Y]] |
| 73 | +// CHECK-NEXT: [[HLSL_LENGTH_I:%.*]] = tail call noundef float @llvm.dx.length.v4f32(<4 x float> [[SUB_I]]) |
| 74 | +// CHECK-NEXT: ret float [[HLSL_LENGTH_I]] |
| 75 | +// |
| 76 | +float test_distance_float4(float4 X, float4 Y) { return distance(X, Y); } |
0 commit comments