|
| 1 | +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +// RUN: %clang_cc1 -finclude-default-header -triple \ |
| 3 | +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ |
| 4 | +// RUN: -emit-llvm -O1 -o - | FileCheck %s |
| 5 | +// RUN: %clang_cc1 -finclude-default-header -triple \ |
| 6 | +// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ |
| 7 | +// RUN: -emit-llvm -O1 -o - | FileCheck %s --check-prefix=SPVCHECK |
| 8 | + |
| 9 | +// CHECK-LABEL: define noundef nofpclass(nan inf) float @_Z18test_refract_floatff( |
| 10 | +// CHECK-SAME: float noundef nofpclass(nan inf) [[I:%.*]], float noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 11 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 12 | +// CHECK-NEXT: [[MUL_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[I]], 2.000000e+00 |
| 13 | +// CHECK-NEXT: [[TMP0:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[N]], [[N]] |
| 14 | +// CHECK-NEXT: [[MUL2_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[TMP0]], [[MUL_I]] |
| 15 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn float [[I]], [[MUL2_I]] |
| 16 | +// CHECK-NEXT: ret float [[SUB_I]] |
| 17 | +// |
| 18 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) float @_Z18test_refract_floatff( |
| 19 | +// SPVCHECK-SAME: float noundef nofpclass(nan inf) [[I:%.*]], float noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 20 | +// SPVCHECK-NEXT: [[ENTRY:.*:]] |
| 21 | +// SPVCHECK-NEXT: [[MUL_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[I]], 2.000000e+00 |
| 22 | +// SPVCHECK-NEXT: [[TMP0:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[N]], [[N]] |
| 23 | +// SPVCHECK-NEXT: [[MUL2_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[TMP0]], [[MUL_I]] |
| 24 | +// SPVCHECK-NEXT: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn float [[I]], [[MUL2_I]] |
| 25 | +// SPVCHECK-NEXT: ret float [[SUB_I]] |
| 26 | +// |
| 27 | +float test_refract_float(float I, float N, float eta) { |
| 28 | + return refract(I, N, eta); |
| 29 | +} |
| 30 | + |
| 31 | +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> @_Z19test_refract_float2Dv2_fS_( |
| 32 | +// CHECK-SAME: <2 x float> noundef nofpclass(nan inf) [[I:%.*]], <2 x float> noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 33 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 34 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn float @llvm.dx.fdot.v2f32(<2 x float> [[I]], <2 x float> [[N]]) |
| 35 | +// CHECK-NEXT: [[DOTSCALAR:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[HLSL_DOT_I]], 2.000000e+00 |
| 36 | +// CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x float> poison, float [[DOTSCALAR]], i64 0 |
| 37 | +// CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x float> [[TMP0]], <2 x float> poison, <2 x i32> zeroinitializer |
| 38 | +// CHECK-NEXT: [[MUL1_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> [[TMP1]], [[N]] |
| 39 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn <2 x float> [[I]], [[MUL1_I]] |
| 40 | +// CHECK-NEXT: ret <2 x float> [[SUB_I]] |
| 41 | +// |
| 42 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) <2 x float> @_Z19test_refract_float2Dv2_fS_( |
| 43 | +// SPVCHECK-SAME: <2 x float> noundef nofpclass(nan inf) [[I:%.*]], <2 x float> noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 44 | +// SPVCHECK-NEXT: [[ENTRY:.*:]] |
| 45 | +// SPVCHECK-NEXT: [[SPV_refract_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef <2 x float> @llvm.spv.refract.v2f32(<2 x float> [[I]], <2 x float> [[N]]) |
| 46 | +// SPVCHECK-NEXT: ret <2 x float> [[SPV_refract_I]] |
| 47 | +// |
| 48 | +float2 test_refract_float2(float2 I, float2 N, float eta) { |
| 49 | + return refract(I, N, eta); |
| 50 | +} |
| 51 | + |
| 52 | +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> @_Z19test_refract_float3Dv3_fS_( |
| 53 | +// CHECK-SAME: <3 x float> noundef nofpclass(nan inf) [[I:%.*]], <3 x float> noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 54 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 55 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn float @llvm.dx.fdot.v3f32(<3 x float> [[I]], <3 x float> [[N]]) |
| 56 | +// CHECK-NEXT: [[DOTSCALAR:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[HLSL_DOT_I]], 2.000000e+00 |
| 57 | +// CHECK-NEXT: [[TMP0:%.*]] = insertelement <3 x float> poison, float [[DOTSCALAR]], i64 0 |
| 58 | +// CHECK-NEXT: [[TMP1:%.*]] = shufflevector <3 x float> [[TMP0]], <3 x float> poison, <3 x i32> zeroinitializer |
| 59 | +// CHECK-NEXT: [[MUL1_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> [[TMP1]], [[N]] |
| 60 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn <3 x float> [[I]], [[MUL1_I]] |
| 61 | +// CHECK-NEXT: ret <3 x float> [[SUB_I]] |
| 62 | +// |
| 63 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) <3 x float> @_Z19test_refract_float3Dv3_fS_( |
| 64 | +// SPVCHECK-SAME: <3 x float> noundef nofpclass(nan inf) [[I:%.*]], <3 x float> noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 65 | +// SPVCHECK-NEXT: [[ENTRY:.*:]] |
| 66 | +// SPVCHECK-NEXT: [[SPV_refract_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef <3 x float> @llvm.spv.refract.v3f32(<3 x float> [[I]], <3 x float> [[N]]) |
| 67 | +// SPVCHECK-NEXT: ret <3 x float> [[SPV_refract_I]] |
| 68 | +// |
| 69 | +float3 test_refract_float3(float3 I, float3 N, float eta) { |
| 70 | + return refract(I, N, eta); |
| 71 | +} |
| 72 | + |
| 73 | +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z19test_refract_float4Dv4_fS_( |
| 74 | +// CHECK-SAME: <4 x float> noundef nofpclass(nan inf) [[I:%.*]], <4 x float> noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 75 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 76 | +// CHECK-NEXT: [[HLSL_DOT_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn float @llvm.dx.fdot.v4f32(<4 x float> [[I]], <4 x float> [[N]]) |
| 77 | +// CHECK-NEXT: [[DOTSCALAR:%.*]] = fmul reassoc nnan ninf nsz arcp afn float [[HLSL_DOT_I]], 2.000000e+00 |
| 78 | +// CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x float> poison, float [[DOTSCALAR]], i64 0 |
| 79 | +// CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[TMP0]], <4 x float> poison, <4 x i32> zeroinitializer |
| 80 | +// CHECK-NEXT: [[MUL1_I:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> [[TMP1]], [[N]] |
| 81 | +// CHECK-NEXT: [[SUB_I:%.*]] = fsub reassoc nnan ninf nsz arcp afn <4 x float> [[I]], [[MUL1_I]] |
| 82 | +// CHECK-NEXT: ret <4 x float> [[SUB_I]] |
| 83 | +// |
| 84 | +// SPVCHECK-LABEL: define spir_func noundef nofpclass(nan inf) <4 x float> @_Z19test_refract_float4Dv4_fS_( |
| 85 | +// SPVCHECK-SAME: <4 x float> noundef nofpclass(nan inf) [[I:%.*]], <4 x float> noundef nofpclass(nan inf) [[N:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 86 | +// SPVCHECK-NEXT: [[ENTRY:.*:]] |
| 87 | +// SPVCHECK-NEXT: [[SPV_refract_I:%.*]] = tail call reassoc nnan ninf nsz arcp afn noundef <4 x float> @llvm.spv.refract.v4f32(<4 x float> [[I]], <4 x float> [[N]]) |
| 88 | +// SPVCHECK-NEXT: ret <4 x float> [[SPV_refract_I]] |
| 89 | +// |
| 90 | +float4 test_refract_float4(float4 I, float4 N, float eta) { |
| 91 | + return refract(I, N, eta); |
| 92 | +} |
0 commit comments