Debian Codegraph @

clang/test/CodeGenHLSL/builtins/rsqrt.hlsl

raw
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,SPIR_CHECK,NATIVE_HALF,SPIR_NATIVE_HALF
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,SPIR_CHECK,NO_HALF,SPIR_NO_HALF
15
16 // DXIL_NATIVE_HALF: define noundef half @
17 // SPIR_NATIVE_HALF: define spir_func noundef half @
18 // DXIL_NATIVE_HALF: %hlsl.rsqrt = call half @llvm.dx.rsqrt.f16(
19 // SPIR_NATIVE_HALF: %hlsl.rsqrt = call half @llvm.spv.rsqrt.f16(
20 // NATIVE_HALF: ret half %hlsl.rsqrt
21 // DXIL_NO_HALF: define noundef float @
22 // SPIR_NO_HALF: define spir_func noundef float @
23 // DXIL_NO_HALF: %hlsl.rsqrt = call float @llvm.dx.rsqrt.f32(
24 // SPIR_NO_HALF: %hlsl.rsqrt = call float @llvm.spv.rsqrt.f32(
25 // NO_HALF: ret float %hlsl.rsqrt
26 half test_rsqrt_half(half p0) { return rsqrt(p0); }
27 // DXIL_NATIVE_HALF: define noundef <2 x half> @
28 // SPIR_NATIVE_HALF: define spir_func noundef <2 x half> @
29 // DXIL_NATIVE_HALF: %hlsl.rsqrt = call <2 x half> @llvm.dx.rsqrt.v2f16
30 // SPIR_NATIVE_HALF: %hlsl.rsqrt = call <2 x half> @llvm.spv.rsqrt.v2f16
31 // NATIVE_HALF: ret <2 x half> %hlsl.rsqrt
32 // DXIL_NO_HALF: define noundef <2 x float> @
33 // SPIR_NO_HALF: define spir_func noundef <2 x float> @
34 // DXIL_NO_HALF: %hlsl.rsqrt = call <2 x float> @llvm.dx.rsqrt.v2f32(
35 // SPIR_NO_HALF: %hlsl.rsqrt = call <2 x float> @llvm.spv.rsqrt.v2f32(
36 // NO_HALF: ret <2 x float> %hlsl.rsqrt
37 half2 test_rsqrt_half2(half2 p0) { return rsqrt(p0); }
38 // DXIL_NATIVE_HALF: define noundef <3 x half> @
39 // SPIR_NATIVE_HALF: define spir_func noundef <3 x half> @
40 // DXIL_NATIVE_HALF: %hlsl.rsqrt = call <3 x half> @llvm.dx.rsqrt.v3f16
41 // SPIR_NATIVE_HALF: %hlsl.rsqrt = call <3 x half> @llvm.spv.rsqrt.v3f16
42 // NATIVE_HALF: ret <3 x half> %hlsl.rsqrt
43 // DXIL_NO_HALF: define noundef <3 x float> @
44 // SPIR_NO_HALF: define spir_func noundef <3 x float> @
45 // DXIL_NO_HALF: %hlsl.rsqrt = call <3 x float> @llvm.dx.rsqrt.v3f32(
46 // SPIR_NO_HALF: %hlsl.rsqrt = call <3 x float> @llvm.spv.rsqrt.v3f32(
47 // NO_HALF: ret <3 x float> %hlsl.rsqrt
48 half3 test_rsqrt_half3(half3 p0) { return rsqrt(p0); }
49 // DXIL_NATIVE_HALF: define noundef <4 x half> @
50 // SPIR_NATIVE_HALF: define spir_func noundef <4 x half> @
51 // DXIL_NATIVE_HALF: %hlsl.rsqrt = call <4 x half> @llvm.dx.rsqrt.v4f16
52 // SPIR_NATIVE_HALF: %hlsl.rsqrt = call <4 x half> @llvm.spv.rsqrt.v4f16
53 // NATIVE_HALF: ret <4 x half> %hlsl.rsqrt
54 // DXIL_NO_HALF: define noundef <4 x float> @
55 // SPIR_NO_HALF: define spir_func noundef <4 x float> @
56 // DXIL_NO_HALF: %hlsl.rsqrt = call <4 x float> @llvm.dx.rsqrt.v4f32(
57 // SPIR_NO_HALF: %hlsl.rsqrt = call <4 x float> @llvm.spv.rsqrt.v4f32(
58 // NO_HALF: ret <4 x float> %hlsl.rsqrt
59 half4 test_rsqrt_half4(half4 p0) { return rsqrt(p0); }
60
61 // DXIL_CHECK: define noundef float @
62 // SPIR_CHECK: define spir_func noundef float @
63 // DXIL_CHECK: %hlsl.rsqrt = call float @llvm.dx.rsqrt.f32(
64 // SPIR_CHECK: %hlsl.rsqrt = call float @llvm.spv.rsqrt.f32(
65 // CHECK: ret float %hlsl.rsqrt
66 float test_rsqrt_float(float p0) { return rsqrt(p0); }
67 // DXIL_CHECK: define noundef <2 x float> @
68 // SPIR_CHECK: define spir_func noundef <2 x float> @
69 // DXIL_CHECK: %hlsl.rsqrt = call <2 x float> @llvm.dx.rsqrt.v2f32
70 // SPIR_CHECK: %hlsl.rsqrt = call <2 x float> @llvm.spv.rsqrt.v2f32
71 // CHECK: ret <2 x float> %hlsl.rsqrt
72 float2 test_rsqrt_float2(float2 p0) { return rsqrt(p0); }
73 // DXIL_CHECK: define noundef <3 x float> @
74 // SPIR_CHECK: define spir_func noundef <3 x float> @
75 // DXIL_CHECK: %hlsl.rsqrt = call <3 x float> @llvm.dx.rsqrt.v3f32
76 // SPIR_CHECK: %hlsl.rsqrt = call <3 x float> @llvm.spv.rsqrt.v3f32
77 // CHECK: ret <3 x float> %hlsl.rsqrt
78 float3 test_rsqrt_float3(float3 p0) { return rsqrt(p0); }
79 // DXIL_CHECK: define noundef <4 x float> @
80 // SPIR_CHECK: define spir_func noundef <4 x float> @
81 // DXIL_CHECK: %hlsl.rsqrt = call <4 x float> @llvm.dx.rsqrt.v4f32
82 // SPIR_CHECK: %hlsl.rsqrt = call <4 x float> @llvm.spv.rsqrt.v4f32
83 // CHECK: ret <4 x float> %hlsl.rsqrt
84 float4 test_rsqrt_float4(float4 p0) { return rsqrt(p0); }