Debian Codegraph @

clang/test/CodeGenSPIRV/Builtins/ddx.c

raw
1 // RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-pixel %s -emit-llvm -o - | FileCheck %s
2
3 typedef _Float16 half;
4 typedef half half2 __attribute__((ext_vector_type(2)));
5 typedef half half3 __attribute__((ext_vector_type(3)));
6 typedef half half4 __attribute__((ext_vector_type(4)));
7 typedef float float2 __attribute__((ext_vector_type(2)));
8 typedef float float3 __attribute__((ext_vector_type(3)));
9 typedef float float4 __attribute__((ext_vector_type(4)));
10
11 // CHECK: [[ddx0:%.*]] = tail call half @llvm.spv.ddx.f16(half {{%.*}})
12 // CHECK: ret half [[ddx0]]
13 half test_ddx_half(half X) { return __builtin_spirv_ddx(X); }
14
15 // CHECK: [[ddx0:%.*]] = tail call <2 x half> @llvm.spv.ddx.v2f16(<2 x half> {{%.*}})
16 // CHECK: ret <2 x half> [[ddx0]]
17 half2 test_ddx_half2(half2 X) { return __builtin_spirv_ddx(X); }
18
19 // CHECK: [[ddx0:%.*]] = tail call <3 x half> @llvm.spv.ddx.v3f16(<3 x half> {{%.*}})
20 // CHECK: ret <3 x half> [[ddx0]]
21 half3 test_ddx_half3(half3 X) { return __builtin_spirv_ddx(X); }
22
23 // CHECK: [[ddx0:%.*]] = tail call <4 x half> @llvm.spv.ddx.v4f16(<4 x half> {{%.*}})
24 // CHECK: ret <4 x half> [[ddx0]]
25 half4 test_ddx_half4(half4 X) { return __builtin_spirv_ddx(X); }
26
27 // CHECK: [[ddx0:%.*]] = tail call float @llvm.spv.ddx.f32(float {{%.*}})
28 // CHECK: ret float [[ddx0]]
29 float test_ddx_float(float X) { return __builtin_spirv_ddx(X); }
30
31 // CHECK: [[ddx1:%.*]] = tail call <2 x float> @llvm.spv.ddx.v2f32(<2 x float> {{%.*}})
32 // CHECK: ret <2 x float> [[ddx1]]
33 float2 test_ddx_float2(float2 X) { return __builtin_spirv_ddx(X); }
34
35 // CHECK: [[ddx2:%.*]] = tail call <3 x float> @llvm.spv.ddx.v3f32(<3 x float> {{%.*}})
36 // CHECK: ret <3 x float> [[ddx2]]
37 float3 test_ddx_float3(float3 X) { return __builtin_spirv_ddx(X); }
38
39 // CHECK: [[ddx3:%.*]] = tail call <4 x float> @llvm.spv.ddx.v4f32(<4 x float> {{%.*}})
40 // CHECK: ret <4 x float> [[ddx3]]
41 float4 test_ddx_float4(float4 X) { return __builtin_spirv_ddx(X); }