1; The goal of the test case is to ensure valid SPIR-V code emision 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-COUNT-2: %[[#]] = OpBitReverse %[[#CharTy]] %[[#]] 18 19; TODO: Add a check to ensure that there's no behavior change of bitreverse operation 20; between the LLVM-IR and SPIR-V for i2 and i4 21 22define spir_func void @foo(i2 %a, i4 %b) { 23entry: 24 %res2 = tail call i2 @llvm.bitreverse.i2(i2 %a) 25 %res4 = tail call i4 @llvm.bitreverse.i4(i4 %b) 26 ret void 27} 28 29declare i2 @llvm.bitreverse.i2(i2) 30declare i4 @llvm.bitreverse.i4(i4) 31