Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/lshr-constexpr.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
4 ; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
5 ; RUN: llvm-spirv --to-text %t.spv -o - | FileCheck %s --check-prefix=CHECK-SPIRV
6
7 ; TODO: spirv-val command is not presented here because it fails with error:
8 ; line 29: Invalid source language operand: 12 which is not related to
9 ; functionality that is being checked in this test.
10
11 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
12 target triple = "spir64-unknown-unknown"
13
14 ; CHECK-SPIRV: TypeInt [[type_int32:[0-9]+]] 32 0
15 ; CHECK-SPIRV: TypeInt [[type_int64:[0-9]+]] 64 0
16 ; CHECK-SPIRV: Constant [[type_int32]] [[const1:[0-9]+]] 1
17 ; CHECK-SPIRV: Constant [[type_int64]] [[const32:[0-9]+]] 32 0
18 ; CHECK-SPIRV: TypeVector [[type_vec:[0-9]+]] [[type_int32]] 2
19 ; CHECK-SPIRV: ConstantComposite [[type_vec]] [[vec_const:[0-9]+]] [[const1]] [[const1]]
20
21 ; CHECK-SPIRV: Bitcast [[type_int64]] [[bitcast_res:[0-9]+]] [[vec_const]]
22 ; CHECK-SPIRV: ShiftRightLogical [[type_int64]] [[shift_res:[0-9]+]] [[bitcast_res]] [[const32]]
23 ; CHECK-SPIRV: DebugValue {{[0-9]+}} [[shift_res]]
24
25 ; Function Attrs: nounwind ssp uwtable
26 define void @foo() #0 !dbg !4 {
27 entry:
28 tail call void @llvm.dbg.value(metadata i64 lshr (i64 bitcast (<2 x i32> <i32 1, i32 1> to i64), i64 32), metadata !12, metadata !17) #3, !dbg !18
29 ret void, !dbg !20
30 ; CHECK-LLVM: %[[bitcast:[0-9]+]] = bitcast <2 x i32> <i32 1, i32 1> to i64
31 ; CHECK-LLVM: %[[shift:[0-9]+]] = lshr i64 %[[bitcast]], 32
32 ; CHECK-LLVM: call void @llvm.dbg.value(metadata i64 %[[shift]], metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
33 }
34
35 ; Function Attrs: nounwind readnone
36 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
37
38 attributes #0 = { nounwind ssp uwtable }
39 attributes #2 = { nounwind readnone }
40 attributes #3 = { nounwind }
41
42 !llvm.dbg.cu = !{!0}
43 !llvm.module.flags = !{!13, !14, !15}
44 !llvm.ident = !{!16}
45
46 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
47 !1 = !DIFile(filename: "t.c", directory: "/path/to/dir")
48 !2 = !{}
49 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
50 !5 = !DISubroutineType(types: !6)
51 !6 = !{null}
52 !7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !8, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11)
53 !8 = !DISubroutineType(types: !9)
54 !9 = !{null, !10}
55 !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
56 !11 = !{!12}
57 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
58 !13 = !{i32 2, !"Dwarf Version", i32 2}
59 !14 = !{i32 2, !"Debug Info Version", i32 3}
60 !15 = !{i32 1, !"PIC Level", i32 2}
61 !16 = !{!"clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)"}
62 !17 = !DIExpression()
63 !18 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !19)
64 !19 = distinct !DILocation(line: 4, column: 3, scope: !4)
65 !20 = !DILocation(line: 6, column: 1, scope: !4)