1 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
\r
2 // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
\r
3 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
\r
4 // RUN: --check-prefixes=CHECK,NATIVE_HALF \
\r
5 // RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx
\r
6 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
\r
7 // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
\r
8 // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
\r
9 // RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx
\r
10 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
\r
11 // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
\r
12 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
\r
13 // RUN: --check-prefixes=CHECK,NATIVE_HALF \
\r
14 // RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv
\r
15 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
\r
16 // RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
\r
17 // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
\r
18 // RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv
\r
20 // NATIVE_HALF: define [[FNATTRS]] half @
\r
21 // NATIVE_HALF: call reassoc nnan ninf nsz arcp afn half @llvm.[[TARGET]].normalize.f16(half
\r
22 // NO_HALF: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float
\r
23 // NATIVE_HALF: ret half
\r
24 // NO_HALF: ret float
\r
25 half test_normalize_half(half p0)
\r
27 return normalize(p0);
\r
29 // NATIVE_HALF: define [[FNATTRS]] <2 x half> @
\r
30 // NATIVE_HALF: call reassoc nnan ninf nsz arcp afn <2 x half> @llvm.[[TARGET]].normalize.v2f16(<2 x half>
\r
31 // NO_HALF: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float>
\r
32 // NATIVE_HALF: ret <2 x half> %hlsl.normalize
\r
33 // NO_HALF: ret <2 x float> %hlsl.normalize
\r
34 half2 test_normalize_half2(half2 p0)
\r
36 return normalize(p0);
\r
38 // NATIVE_HALF: define [[FNATTRS]] <3 x half> @
\r
39 // NATIVE_HALF: call reassoc nnan ninf nsz arcp afn <3 x half> @llvm.[[TARGET]].normalize.v3f16(<3 x half>
\r
40 // NO_HALF: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32(<3 x float>
\r
41 // NATIVE_HALF: ret <3 x half> %hlsl.normalize
\r
42 // NO_HALF: ret <3 x float> %hlsl.normalize
\r
43 half3 test_normalize_half3(half3 p0)
\r
45 return normalize(p0);
\r
47 // NATIVE_HALF: define [[FNATTRS]] <4 x half> @
\r
48 // NATIVE_HALF: call reassoc nnan ninf nsz arcp afn <4 x half> @llvm.[[TARGET]].normalize.v4f16(<4 x half>
\r
49 // NO_HALF: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32(<4 x float>
\r
50 // NATIVE_HALF: ret <4 x half> %hlsl.normalize
\r
51 // NO_HALF: ret <4 x float> %hlsl.normalize
\r
52 half4 test_normalize_half4(half4 p0)
\r
54 return normalize(p0);
\r
57 // CHECK: define [[FNATTRS]] float @
\r
58 // CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float
\r
60 float test_normalize_float(float p0)
\r
62 return normalize(p0);
\r
64 // CHECK: define [[FNATTRS]] <2 x float> @
\r
65 // CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float>
\r
67 // CHECK: ret <2 x float> %hlsl.normalize
\r
68 float2 test_normalize_float2(float2 p0)
\r
70 return normalize(p0);
\r
72 // CHECK: define [[FNATTRS]] <3 x float> @
\r
73 // CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32(
\r
74 // CHECK: ret <3 x float> %hlsl.normalize
\r
75 float3 test_normalize_float3(float3 p0)
\r
77 return normalize(p0);
\r
79 // CHECK: define [[FNATTRS]] <4 x float> @
\r
80 // CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32(
\r
81 // CHECK: ret <4 x float> %hlsl.normalize
\r
82 float4 test_length_float4(float4 p0)
\r
84 return normalize(p0);
\r