|
| 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,DXIL_CHECK,DXIL_NATIVE_HALF,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,DXIL_CHECK,NO_HALF,DXIL_NO_HALF |
| 8 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 9 | +// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ |
| 10 | +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ |
| 11 | +// RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK |
| 12 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 13 | +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ |
| 14 | +// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_NO_HALF,SPIR_CHECK |
| 15 | + |
| 16 | +// DXIL_NATIVE_HALF: define noundef half @ |
| 17 | +// SPIR_NATIVE_HALF: define spir_func noundef half @ |
| 18 | +// DXIL_NATIVE_HALF: call half @llvm.dx.normalize.f16(half |
| 19 | +// SPIR_NATIVE_HALF: call half @llvm.spv.normalize.f16(half |
| 20 | +// DXIL_NO_HALF: call float @llvm.dx.normalize.f32(float |
| 21 | +// SPIR_NO_HALF: call float @llvm.spv.normalize.f32(float |
| 22 | +// NATIVE_HALF: ret half |
| 23 | +// NO_HALF: ret float |
| 24 | +half test_normalize_half(half p0) |
| 25 | +{ |
| 26 | + return normalize(p0); |
| 27 | +} |
| 28 | +// DXIL_NATIVE_HALF: define noundef <2 x half> @ |
| 29 | +// SPIR_NATIVE_HALF: define spir_func noundef <2 x half> @ |
| 30 | +// DXIL_NATIVE_HALF: call <2 x half> @llvm.dx.normalize.v2f16(<2 x half> |
| 31 | +// SPIR_NATIVE_HALF: call <2 x half> @llvm.spv.normalize.v2f16(<2 x half> |
| 32 | +// DXIL_NO_HALF: call <2 x float> @llvm.dx.normalize.v2f32(<2 x float> |
| 33 | +// SPIR_NO_HALF: call <2 x float> @llvm.spv.normalize.v2f32(<2 x float> |
| 34 | +// NATIVE_HALF: ret <2 x half> %hlsl.normalize |
| 35 | +// NO_HALF: ret <2 x float> %hlsl.normalize |
| 36 | +half2 test_normalize_half2(half2 p0) |
| 37 | +{ |
| 38 | + return normalize(p0); |
| 39 | +} |
| 40 | +// DXIL_NATIVE_HALF: define noundef <3 x half> @ |
| 41 | +// SPIR_NATIVE_HALF: define spir_func noundef <3 x half> @ |
| 42 | +// DXIL_NATIVE_HALF: call <3 x half> @llvm.dx.normalize.v3f16(<3 x half> |
| 43 | +// SPIR_NATIVE_HALF: call <3 x half> @llvm.spv.normalize.v3f16(<3 x half> |
| 44 | +// DXIL_NO_HALF: call <3 x float> @llvm.dx.normalize.v3f32(<3 x float> |
| 45 | +// SPIR_NO_HALF: call <3 x float> @llvm.spv.normalize.v3f32(<3 x float> |
| 46 | +// NATIVE_HALF: ret <3 x half> %hlsl.normalize |
| 47 | +// NO_HALF: ret <3 x float> %hlsl.normalize |
| 48 | +half3 test_normalize_half3(half3 p0) |
| 49 | +{ |
| 50 | + return normalize(p0); |
| 51 | +} |
| 52 | +// DXIL_NATIVE_HALF: define noundef <4 x half> @ |
| 53 | +// SPIR_NATIVE_HALF: define spir_func noundef <4 x half> @ |
| 54 | +// DXIL_NATIVE_HALF: call <4 x half> @llvm.dx.normalize.v4f16(<4 x half> |
| 55 | +// SPIR_NATIVE_HALF: call <4 x half> @llvm.spv.normalize.v4f16(<4 x half> |
| 56 | +// DXIL_NO_HALF: call <4 x float> @llvm.dx.normalize.v4f32(<4 x float> |
| 57 | +// SPIR_NO_HALF: call <4 x float> @llvm.spv.normalize.v4f32(<4 x float> |
| 58 | +// NATIVE_HALF: ret <4 x half> %hlsl.normalize |
| 59 | +// NO_HALF: ret <4 x float> %hlsl.normalize |
| 60 | +half4 test_normalize_half4(half4 p0) |
| 61 | +{ |
| 62 | + return normalize(p0); |
| 63 | +} |
| 64 | + |
| 65 | +// DXIL_CHECK: define noundef float @ |
| 66 | +// SPIR_CHECK: define spir_func noundef float @ |
| 67 | +// DXIL_CHECK: call float @llvm.dx.normalize.f32(float |
| 68 | +// SPIR_CHECK: call float @llvm.spv.normalize.f32(float |
| 69 | +// CHECK: ret float |
| 70 | +float test_normalize_float(float p0) |
| 71 | +{ |
| 72 | + return normalize(p0); |
| 73 | +} |
| 74 | +// DXIL_CHECK: define noundef <2 x float> @ |
| 75 | +// SPIR_CHECK: define spir_func noundef <2 x float> @ |
| 76 | +// DXIL_CHECK: %hlsl.normalize = call <2 x float> @llvm.dx.normalize.v2f32( |
| 77 | +// SPIR_CHECK: %hlsl.normalize = call <2 x float> @llvm.spv.normalize.v2f32(<2 x float> |
| 78 | +// CHECK: ret <2 x float> %hlsl.normalize |
| 79 | +float2 test_normalize_float2(float2 p0) |
| 80 | +{ |
| 81 | + return normalize(p0); |
| 82 | +} |
| 83 | +// DXIL_CHECK: define noundef <3 x float> @ |
| 84 | +// SPIR_CHECK: define spir_func noundef <3 x float> @ |
| 85 | +// DXIL_CHECK: %hlsl.normalize = call <3 x float> @llvm.dx.normalize.v3f32( |
| 86 | +// SPIR_CHECK: %hlsl.normalize = call <3 x float> @llvm.spv.normalize.v3f32(<3 x float> |
| 87 | +// CHECK: ret <3 x float> %hlsl.normalize |
| 88 | +float3 test_normalize_float3(float3 p0) |
| 89 | +{ |
| 90 | + return normalize(p0); |
| 91 | +} |
| 92 | +// DXIL_CHECK: define noundef <4 x float> @ |
| 93 | +// SPIR_CHECK: define spir_func noundef <4 x float> @ |
| 94 | +// DXIL_CHECK: %hlsl.normalize = call <4 x float> @llvm.dx.normalize.v4f32( |
| 95 | +// SPIR_CHECK: %hlsl.normalize = call <4 x float> @llvm.spv.normalize.v4f32( |
| 96 | +// CHECK: ret <4 x float> %hlsl.normalize |
| 97 | +float4 test_length_float4(float4 p0) |
| 98 | +{ |
| 99 | + return normalize(p0); |
| 100 | +} |
0 commit comments