File: explicit-conversions.cl

package info (click to toggle)
spirv-llvm-translator-14 14.0.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,640 kB
  • sloc: cpp: 47,664; lisp: 3,704; sh: 153; python: 43; makefile: 33
file content (86 lines) | stat: -rw-r--r-- 2,923 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// 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
// RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
// RUN: llvm-spirv %t.bc -o %t.spv
// RUN: spirv-val %t.spv
// RUN: llvm-spirv -r %t.spv -o %t.rev.bc
// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
// RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR

// CHECK-SPIRV: SatConvertSToU

// CHECK-LLVM-LABEL: @testSToU
// CHECK-LLVM: call spir_func <2 x i8> @_Z18convert_uchar2_satDv2_i

// CHECK-SPV-IR-LABEL: @testSToU
// CHECK-SPV-IR: call spir_func <2 x i8> @_Z30__spirv_SatConvertSToU_Ruchar2Dv2_i

kernel void testSToU(global int2 *a, global uchar2 *res) {
  res[0] = convert_uchar2_sat(*a);
}

// CHECK-SPIRV: SatConvertUToS

// CHECK-LLVM-LABEL: @testUToS
// CHECK-LLVM: call spir_func <2 x i8> @_Z17convert_char2_satDv2_j

// CHECK-SPV-IR-LABEL: @testUToS
// CHECK-SPV-IR: call spir_func <2 x i8> @_Z29__spirv_SatConvertUToS_Rchar2Dv2_j
kernel void testUToS(global uint2 *a, global char2 *res) {
  res[0] = convert_char2_sat(*a);
}

// CHECK-SPIRV: ConvertUToF

// CHECK-LLVM-LABEL: @testUToF
// CHECK-LLVM: call spir_func <2 x float> @_Z18convert_float2_rtzDv2_j

// CHECK-SPV-IR-LABEL: @testUToF
// CHECK-SPV-IR: call spir_func <2 x float> @_Z31__spirv_ConvertUToF_Rfloat2_rtzDv2_j
kernel void testUToF(global uint2 *a, global float2 *res) {
  res[0] = convert_float2_rtz(*a);
}

// CHECK-SPIRV: ConvertFToU

// CHECK-LLVM-LABEL: @testFToUSat
// CHECK-LLVM: call spir_func <2 x i32> @_Z21convert_uint2_sat_rtnDv2_f

// CHECK-SPV-IR-LABEL: @testFToUSat
// CHECK-SPV-IR: call spir_func <2 x i32> @_Z34__spirv_ConvertFToU_Ruint2_sat_rtnDv2_f
kernel void testFToUSat(global float2 *a, global uint2 *res) {
  res[0] = convert_uint2_sat_rtn(*a);
}

// CHECK-SPIRV: UConvert

// CHECK-LLVM-LABEL: @testUToUSat
// CHECK-LLVM: call spir_func i32 @_Z16convert_uint_sath

// CHECK-SPV-IR-LABEL: @testUToUSat
// CHECK-SPV-IR: call spir_func i32 @_Z26__spirv_UConvert_Ruint_sath
kernel void testUToUSat(global uchar *a, global uint *res) {
  res[0] = convert_uint_sat(*a);
}

// CHECK-SPIRV: UConvert

// CHECK-LLVM-LABEL: @testUToUSat1
// CHECK-LLVM: call spir_func i8 @_Z17convert_uchar_satj

// CHECK-SPV-IR-LABEL: @testUToUSat1
// CHECK-SPV-IR: call spir_func i8 @_Z27__spirv_UConvert_Ruchar_satj
kernel void testUToUSat1(global uint *a, global uchar *res) {
  res[0] = convert_uchar_sat(*a);
}

// CHECK-SPIRV: ConvertFToU

// CHECK-LLVM-LABEL: @testFToU
// CHECK-LLVM: call spir_func <3 x i32> @_Z17convert_uint3_rtpDv3_f

// CHECK-SPV-IR-LABEL: @testFToU
// CHECK-SPV-IR: call spir_func <3 x i32> @_Z30__spirv_ConvertFToU_Ruint3_rtpDv3_f
kernel void testFToU(global float3 *a, global uint3 *res) {
  res[0] = convert_uint3_rtp(*a);
}