Debian Codegraph @

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

raw
1 // 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
2 // RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 // RUN: llvm-spirv %t.bc -o %t.spv
4 // RUN: spirv-val %t.spv
5 // RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
6 // RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
8 kernel void testBitOperations(int a, int b, int c, global int *res) {
9 *res = (a & b) | (0x6F ^ c);
10 *res += popcount(b);
11 }
12
13 // CHECK-SPIRV: BitwiseAnd
14 // CHECK-SPIRV: BitwiseXor
15 // CHECK-SPIRV: BitwiseOr
16 // CHECK-SPIRV: BitCount
17
18 // CHECK-LLVM-LABEL: @testBitOperations
19 // CHECK-LLVM: and i32
20 // CHECK-LLVM: xor i32
21 // CHECK-LLVM: or i32
22 // CHECK-LLVM: call spir_func i32 @_Z8popcounti(i32 %b)