Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/OpConstantBool.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
3 ; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: spirv-val %t.spv
6 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
7 ; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
8
9 ; CHECK-LLVM-LABEL: @f
10 ; CHECK-LLVM: ret i1 true
11 ; CHECK-LLVM-LABEL: @f2
12 ; CHECK-LLVM: ret i1 false
13
14 ; CHECK-SPIRV: 3 ConstantTrue
15 ; CHECK-SPIRV: 3 ConstantFalse
16
17 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
18 target triple = "spir-unknown-unknown"
19
20 ; Function Attrs: nounwind
21 define spir_func zeroext i1 @f() #0 {
22 entry:
23 ret i1 true
24 }
25
26 ; Function Attrs: nounwind
27 define spir_func zeroext i1 @f2() #0 {
28 entry:
29 ret i1 false
30 }
31
32 ; Function Attrs: nounwind
33 define spir_kernel void @test(i32 addrspace(1)* %i) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
34 entry:
35 %i.addr = alloca i32 addrspace(1)*, align 4
36 store i32 addrspace(1)* %i, i32 addrspace(1)** %i.addr, align 4
37 %call = call spir_func zeroext i1 @f()
38 %conv = zext i1 %call to i32
39 %0 = load i32 addrspace(1)*, i32 addrspace(1)** %i.addr, align 4
40 store i32 %conv, i32 addrspace(1)* %0, align 4
41 ret void
42 }
43
44 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
45
46 !opencl.enable.FP_CONTRACT = !{}
47 !opencl.spir.version = !{!6}
48 !opencl.ocl.version = !{!7}
49 !opencl.used.extensions = !{!8}
50 !opencl.used.optional.core.features = !{!8}
51 !opencl.compiler.options = !{!8}
52
53 !1 = !{i32 1}
54 !2 = !{!"none"}
55 !3 = !{!"int*"}
56 !4 = !{!"int*"}
57 !5 = !{!""}
58 !6 = !{i32 1, i32 2}
59 !7 = !{i32 2, i32 0}
60 !8 = !{}