[AArch64][SME2] Add multi-vector saturating doubling multiply high intrinsics
[llvm-project.git] / lld / test / wasm / gc-sections.ll
blobe709ab7ba2c3d4b3971d66bdbbffa36d9be689f3
1 ; RUN: llc -mcpu=mvp -filetype=obj %s -o %t.o
2 ; RUN: yaml2obj %S/Inputs/globals.yaml -o %t_globals.o
3 ; RUN: wasm-ld -print-gc-sections -o %t1.wasm %t.o %t_globals.o | \
4 ; RUN:     FileCheck %s -check-prefix=PRINT-GC
5 ; PRINT-GC: removing unused section {{.*}}:(unused_function)
6 ; PRINT-GC-NOT: removing unused section {{.*}}:(used_function)
7 ; PRINT-GC: removing unused section {{.*}}:(.data.unused_data)
8 ; PRINT-GC-NOT: removing unused section {{.*}}:(.data.used_data)
9 ; PRINT-GC: removing unused section {{.*}}:(unused_global)
10 ; PRINT-GC-NOT: removing unused section {{.*}}:(used_global)
12 target triple = "wasm32-unknown-unknown"
14 @unused_data = hidden global i64 1, align 4
15 @used_data = hidden global i32 2, align 4
17 define hidden i64 @unused_function(i64 %arg) {
18   %1 = load i64, ptr @unused_data, align 4
19   ret i64 %1
22 define hidden i32 @used_function() {
23   %1 = load i32, ptr @used_data, align 4
24   ret i32 %1
27 declare i64 @use_global()
29 define hidden void @_start() {
30 entry:
31   call i32 @used_function()
32   call i64 @use_global()
33   ret void
36 ; RUN: obj2yaml %t1.wasm | FileCheck %s
38 ; CHECK:        - Type:            TYPE
39 ; CHECK-NEXT:     Signatures:
40 ; CHECK-NEXT:       - Index:           0
41 ; CHECK-NEXT:         ParamTypes:      []
42 ; CHECK-NEXT:         ReturnTypes:
43 ; CHECK-NEXT:           - I32
44 ; CHECK-NEXT:       - Index:           1
45 ; CHECK-NEXT:         ParamTypes:      []
46 ; CHECK-NEXT:         ReturnTypes:     []
47 ; CHECK-NEXT:       - Index:           2
48 ; CHECK-NEXT:         ParamTypes:      []
49 ; CHECK-NEXT:         ReturnTypes:
50 ; CHECK-NEXT:           - I64
51 ; CHECK-NEXT:   - Type:            FUNCTION
53 ; CHECK:        - Type:            GLOBAL
54 ; CHECK-NEXT:     Globals:
55 ; CHECK-NEXT:       - Index:           0
56 ; CHECK-NEXT:         Type:            I32
57 ; CHECK-NEXT:         Mutable:         true
58 ; CHECK-NEXT:         InitExpr:
59 ; CHECK-NEXT:           Opcode:          I32_CONST
60 ; CHECK-NEXT:           Value:           66576
61 ; CHECK-NEXT:       - Index:       1
62 ; CHECK-NEXT:         Type:        I64
63 ; CHECK-NEXT:         Mutable:     true
64 ; CHECK-NEXT:         InitExpr:
65 ; CHECK-NEXT:           Opcode:          I64_CONST
66 ; CHECK-NEXT:           Value:           456
68 ; CHECK:        - Type:            DATA
69 ; CHECK-NEXT:     Segments:
70 ; CHECK-NEXT:       - SectionOffset:   7
71 ; CHECK-NEXT:         InitFlags:       0
72 ; CHECK-NEXT:         Offset:
73 ; CHECK-NEXT:           Opcode:          I32_CONST
74 ; CHECK-NEXT:           Value:           1024
75 ; CHECK-NEXT:         Content:         '02000000'
76 ; CHECK-NEXT:   - Type:            CUSTOM
77 ; CHECK-NEXT:     Name:            name
78 ; CHECK-NEXT:     FunctionNames:
79 ; CHECK-NEXT:       - Index:           0
80 ; CHECK-NEXT:         Name:            used_function
81 ; CHECK-NEXT:       - Index:           1
82 ; CHECK-NEXT:         Name:            _start
83 ; CHECK-NEXT:       - Index:           2
84 ; CHECK-NEXT:         Name:            use_global
85 ; CHECK-NEXT:     GlobalNames:
86 ; CHECK-NEXT:       - Index:           0
87 ; CHECK-NEXT:         Name:            __stack_pointer
88 ; CHECK-NEXT:       - Index:           1
89 ; CHECK-NEXT:         Name:            used_global
90 ; CHECK-NEXT:     DataSegmentNames:
91 ; CHECK-NEXT:       - Index:           0
92 ; CHECK-NEXT:         Name:            .data
93 ; CHECK-NEXT: ...
95 ; RUN: wasm-ld -print-gc-sections --no-gc-sections -o %t1.no-gc.wasm \
96 ; RUN:     %t.o %t_globals.o
97 ; RUN: obj2yaml %t1.no-gc.wasm | FileCheck %s -check-prefix=NO-GC
99 ; NO-GC:        - Type:            TYPE
100 ; NO-GC-NEXT:     Signatures:
101 ; NO-GC-NEXT:       - Index:           0
102 ; NO-GC-NEXT:         ParamTypes:      []
103 ; NO-GC-NEXT:         ReturnTypes:     []
104 ; NO-GC-NEXT:       - Index:           1
105 ; NO-GC-NEXT:         ParamTypes:
106 ; NO-GC-NEXT:           - I64
107 ; NO-GC-NEXT:         ReturnTypes:
108 ; NO-GC-NEXT:           - I64
109 ; NO-GC-NEXT:       - Index:           2
110 ; NO-GC-NEXT:         ParamTypes:      []
111 ; NO-GC-NEXT:         ReturnTypes:
112 ; NO-GC-NEXT:           - I32
113 ; NO-GC-NEXT:       - Index:           3
114 ; NO-GC-NEXT:         ParamTypes:      []
115 ; NO-GC-NEXT:         ReturnTypes:
116 ; NO-GC-NEXT:           - I64
117 ; NO-GC-NEXT:   - Type:            FUNCTION
119 ; NO-GC:        - Type:            GLOBAL
120 ; NO-GC-NEXT:     Globals:
121 ; NO-GC-NEXT:       - Index:           0
122 ; NO-GC-NEXT:         Type:            I32
123 ; NO-GC-NEXT:         Mutable:         true
124 ; NO-GC-NEXT:         InitExpr:
125 ; NO-GC-NEXT:           Opcode:          I32_CONST
126 ; NO-GC-NEXT:           Value:           66576
127 ; NO-GC-NEXT:       - Index:       1
128 ; NO-GC-NEXT:         Type:        I64
129 ; NO-GC-NEXT:         Mutable:     true
130 ; NO-GC-NEXT:         InitExpr:
131 ; NO-GC-NEXT:           Opcode:          I64_CONST
132 ; NO-GC-NEXT:           Value:           123
133 ; NO-GC-NEXT:       - Index:       2
134 ; NO-GC-NEXT:         Type:        I64
135 ; NO-GC-NEXT:         Mutable:     true
136 ; NO-GC-NEXT:         InitExpr:
137 ; NO-GC-NEXT:           Opcode:          I64_CONST
138 ; NO-GC-NEXT:           Value:           456
140 ; NO-GC:        - Type:            DATA
141 ; NO-GC-NEXT:     Segments:
142 ; NO-GC-NEXT:       - SectionOffset:   7
143 ; NO-GC-NEXT:         InitFlags:       0
144 ; NO-GC-NEXT:         Offset:
145 ; NO-GC-NEXT:           Opcode:          I32_CONST
146 ; NO-GC-NEXT:           Value:           1024
147 ; NO-GC-NEXT:         Content:         '010000000000000002000000'
148 ; NO-GC-NEXT:   - Type:            CUSTOM
149 ; NO-GC-NEXT:     Name:            name
150 ; NO-GC-NEXT:     FunctionNames:
151 ; NO-GC-NEXT:       - Index:           0
152 ; NO-GC-NEXT:         Name:            __wasm_call_ctors
153 ; NO-GC-NEXT:       - Index:           1
154 ; NO-GC-NEXT:         Name:            unused_function
155 ; NO-GC-NEXT:       - Index:           2
156 ; NO-GC-NEXT:         Name:            used_function
157 ; NO-GC-NEXT:       - Index:           3
158 ; NO-GC-NEXT:         Name:            _start
159 ; NO-GC-NEXT:       - Index:           4
160 ; NO-GC-NEXT:         Name:            use_global
161 ; NO-GC-NEXT:     GlobalNames:
162 ; NO-GC-NEXT:       - Index:           0
163 ; NO-GC-NEXT:         Name:            __stack_pointer
164 ; NO-GC-NEXT:       - Index:           1
165 ; NO-GC-NEXT:         Name:            unused_global
166 ; NO-GC-NEXT:       - Index:           2
167 ; NO-GC-NEXT:         Name:            used_global
168 ; NO-GC-NEXT:     DataSegmentNames:
169 ; NO-GC-NEXT:       - Index:           0
170 ; NO-GC-NEXT:         Name:            .data
171 ; NO-GC-NEXT: ...
173 ; RUN: not wasm-ld --gc-sections --relocatable -o %t1.no-gc.wasm %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR
174 ; CHECK-ERROR: error: -r and --gc-sections may not be used together