1 // RUN: %clang_cc1 -finclude-default-header -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: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx
6 // RUN: %clang_cc1 -finclude-default-header -triple \
7 // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
8 // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
9 // RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx
10 // RUN: %clang_cc1 -finclude-default-header -triple \
11 // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
12 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
13 // RUN: --check-prefixes=CHECK,NATIVE_HALF \
14 // RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv
15 // RUN: %clang_cc1 -finclude-default-header -triple \
16 // RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
17 // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
18 // RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv
20 // NATIVE_HALF: define [[FNATTRS]] half @
21 // NATIVE_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn half @llvm.[[TARGET]].degrees.f16(
22 // NATIVE_HALF: ret half %hlsl.degrees
23 // NO_HALF: define [[FNATTRS]] float @
24 // NO_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32(
25 // NO_HALF: ret float %hlsl.degrees
26 half test_degrees_half(half p0) { return degrees(p0); }
27 // NATIVE_HALF: define [[FNATTRS]] <2 x half> @
28 // NATIVE_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x half> @llvm.[[TARGET]].degrees.v2f16
29 // NATIVE_HALF: ret <2 x half> %hlsl.degrees
30 // NO_HALF: define [[FNATTRS]] <2 x float> @
31 // NO_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32(
32 // NO_HALF: ret <2 x float> %hlsl.degrees
33 half2 test_degrees_half2(half2 p0) { return degrees(p0); }
34 // NATIVE_HALF: define [[FNATTRS]] <3 x half> @
35 // NATIVE_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x half> @llvm.[[TARGET]].degrees.v3f16
36 // NATIVE_HALF: ret <3 x half> %hlsl.degrees
37 // NO_HALF: define [[FNATTRS]] <3 x float> @
38 // NO_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32(
39 // NO_HALF: ret <3 x float> %hlsl.degrees
40 half3 test_degrees_half3(half3 p0) { return degrees(p0); }
41 // NATIVE_HALF: define [[FNATTRS]] <4 x half> @
42 // NATIVE_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x half> @llvm.[[TARGET]].degrees.v4f16
43 // NATIVE_HALF: ret <4 x half> %hlsl.degrees
44 // NO_HALF: define [[FNATTRS]] <4 x float> @
45 // NO_HALF: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32(
46 // NO_HALF: ret <4 x float> %hlsl.degrees
47 half4 test_degrees_half4(half4 p0) { return degrees(p0); }
49 // CHECK: define [[FNATTRS]] float @
50 // CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32(
51 // CHECK: ret float %hlsl.degrees
52 float test_degrees_float(float p0) { return degrees(p0); }
53 // CHECK: define [[FNATTRS]] <2 x float> @
54 // CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32
55 // CHECK: ret <2 x float> %hlsl.degrees
56 float2 test_degrees_float2(float2 p0) { return degrees(p0); }
57 // CHECK: define [[FNATTRS]] <3 x float> @
58 // CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32
59 // CHECK: ret <3 x float> %hlsl.degrees
60 float3 test_degrees_float3(float3 p0) { return degrees(p0); }
61 // CHECK: define [[FNATTRS]] <4 x float> @
62 // CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32
63 // CHECK: ret <4 x float> %hlsl.degrees
64 float4 test_degrees_float4(float4 p0) { return degrees(p0); }