Debian Codegraph @

llvm/test/CodeGen/SPIRV/transcoding/OpBitReverse_i2.ll

raw
1 ; The goal of the test case is to ensure that there's no crash
2 ; on translation of integers with bit width less than 8.
3
4 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-SPIRV
5 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - -filetype=obj | spirv-val %}
6
7 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-SPIRV
8 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - -filetype=obj | spirv-val %}
9
10 ; TODO: This test currently fails with LLVM_ENABLE_EXPENSIVE_CHECKS enabled
11 ; XFAIL: expensive_checks
12
13 ; CHECK-SPIRV: OpCapability BitInstructions
14 ; CHECK-SPIRV: OpExtension "SPV_KHR_bit_instructions"
15 ; CHECK-SPIRV: %[[#CharTy:]] = OpTypeInt 8 0
16 ; CHECK-SPIRV-NO: %[[#CharTy:]] = OpTypeInt 8 0
17 ; CHECK-SPIRV: %[[#Arg:]] = OpFunctionParameter %[[#CharTy]]
18 ; CHECK-SPIRV: %[[#Res:]] = OpBitReverse %[[#CharTy]] %[[#Arg]]
19 ; CHECK-SPIRV: OpReturnValue %[[#Res]]
20
21 ; TODO: Add a check to ensure that there's no behavior change of bitreverse operation
22 ; between the LLVM-IR and SPIR-V for i2
23
24 define spir_func signext i2 @foo(i2 noundef signext %a) {
25 entry:
26 %b = tail call i2 @llvm.bitreverse.i2(i2 %a)
27 ret i2 %b
28 }
29
30 declare i2 @llvm.bitreverse.i2(i2)