Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/ldexp.cl

raw
1 // Check that translator converts scalar arg to vector for ldexp math instructions
2 // RUN: %clang_cc1 -triple spir-unknown-unknown -O1 -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -emit-llvm-bc %s -o %t.bc
3 // RUN: llvm-spirv %t.bc -o %t.spv
4 // RUN: spirv-val %t.spv
5 // RUN: llvm-spirv -to-text %t.spv -o %t.spt
6 // RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
7 // RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
8 // RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefixes=CHECK-LLVM-CL20
9
10 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
11 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
12
13 __kernel void test_kernel_half(half3 x, int k, __global half3* ret) {
14 *ret = ldexp(x, k);
15 }
16
17 // CHECK-SPIRV: {{.*}} ldexp
18 // CHECK-LLVM-CL20: %call = call spir_func <3 x half> @_Z5ldexpDv3_DhDv3_i(
19
20 __kernel void test_kernel_float(float3 x, int k, __global float3* ret) {
21 *ret = ldexp(x, k);
22 }
23
24 // CHECK-SPIRV: {{.*}} ldexp
25 // CHECK-LLVM-CL20: %call = call spir_func <3 x float> @_Z5ldexpDv3_fDv3_i(
26
27 __kernel void test_kernel_double(double3 x, int k, __global double3* ret) {
28 *ret = ldexp(x, k);
29 }
30
31 // CHECK-SPIRV: {{.*}} ldexp
32 // CHECK-LLVM-CL20: %call = call spir_func <3 x double> @_Z5ldexpDv3_dDv3_i(