Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/sitofp-with-bool.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s
3 ; RUN: llvm-spirv %t.bc -o %t.spv
4 ; RUN: spirv-val %t.spv
5
6 ; CHECK: TypeInt [[int_32:[0-9]+]] 32 0
7 ; CHECK: Constant {{[0-9]+}} [[zero:[0-9]+]] 0
8 ; CHECK: Constant {{[0-9]+}} [[one:[0-9]+]] 1
9 ; CHECK: TypeBool [[bool:[0-9]+]]
10
11 ; CHECK: Function
12 ; CHECK: FunctionParameter {{[0-9]+}} [[A:[0-9]+]]
13 ; CHECK: FunctionParameter {{[0-9]+}} [[B:[0-9]+]]
14 ; CHECK: SGreaterThan [[bool]] [[cmp_res:[0-9]+]] [[B]] [[zero]]
15 ; CHECK: Select [[int_32]] [[select_res:[0-9]+]] [[cmp_res]] [[one]] [[zero]]
16 ; CHECK: ConvertSToF {{[0-9]+}} [[stof_res:[0-9]+]] [[select_res]]
17 ; CHECK: Store [[A]] [[stof_res]]
18
19
20 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
21 target triple = "spir64"
22
23 ; Function Attrs: nofree norecurse nounwind writeonly
24 define dso_local spir_kernel void @K(float addrspace(1)* nocapture %A, i32 %B) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
25 entry:
26 %cmp = icmp sgt i32 %B, 0
27 %conv = sitofp i1 %cmp to float
28 store float %conv, float addrspace(1)* %A, align 4
29 ret void
30 }
31
32 attributes #0 = { nofree norecurse nounwind writeonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
33
34 !llvm.module.flags = !{!0}
35 !opencl.ocl.version = !{!1}
36 !opencl.spir.version = !{!1}
37
38 !0 = !{i32 1, !"wchar_size", i32 4}
39 !1 = !{i32 2, i32 0}
40 !2 = !{i32 1, i32 0}
41 !3 = !{!"none", !"none"}
42 !4 = !{!"float*", !"int"}
43 !5 = !{!"", !""}