1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14definitions: 15 - name: main 16 template: | 17 # header 18 .function i32 main() { 19 - name: none 20 template: | 21 } 22 - name: empty 23 template: "" 24 - name: exit-positive 25 template: | 26 # 27 ldai 0 28 return 29 } 30 - name: no-check 31 template: | 32 # 33 return 34 } 35 - name: check-positive 36 template: | 37 # check positive 38 movi v0, 0 # expected result 39 jne v0, exit_failure 40 ldai 0 # passed 41 return 42 exit_failure: 43 ldai 1 # failed 44 return 45 } 46 - name: check-negative 47 template: | 48 # check negative 49 movi v0, 0 # unexpected result 50 jeq v0, exit_failure 51 ldai 0 # passed 52 return 53 exit_failure: 54 ldai 1 # failed 55 return 56 } 57 - name: check-acc-nan 58 template: | 59 # check acc contains NaN 60 sta.64 v0 61 fcmpg.64 v0 62 jeqz exit_failure 63 # NaN != NaN 64 ldai 0 # passed 65 return 66 exit_failure: 67 ldai 1 # failed 68 return 69 } 70 - name: check-acc-minus-1 71 template: | 72 # check acc = -1 73 movi v0, -1 # unexpected result 74 jne v0, exit_failure 75 ldai 0 # passed 76 return 77 exit_failure: 78 ldai 1 # failed 79 return 80 } 81 - name: check-acc-1 82 template: | 83 # check positive 84 movi v0, 1 # expected result 85 jne v0, exit_failure 86 ldai 0 # passed 87 return 88 exit_failure: 89 ldai 1 # failed 90 return 91 } 92 93 - name: ArithmeticException 94 template: | 95 # header 96 .record panda.ArithmeticException <external> 97 98 - name: main-exitcode-wrapper 99 # This is the wrapper for _GLOBAL::main function to avoid false-positive cases. 100 # Please, do not use this wrapper in test definition directly 101 template: | 102 # 103 .function i32 main_exitcode_wrapper() { 104 call main 105 jeqz wrapper_exit_positive 106 ldai 81 107 return 108 wrapper_exit_positive: 109 ldai 80 110 return 111 } 112 113 - name: obj_ctor 114 template: | 115 .record Obj {} 116 117 .function void Obj.ctor(Obj a0) { 118 return.void 119 } 120 121 - name: panda_string 122 template: | 123 .record panda.String <external> 124 125 - name: xorshift32 126 template: | 127 # 128 # Next random number 129 # x ^= x << 13; 130 # x ^= x >> 17; 131 # x ^= x << 5; 132 .function i32 nextRand(i32 a0) { 133 mov v0, a0 134 lda v0 135 shli 13 136 xor2 v0 137 sta v0 # v-: v0 ^= v0 << 13; 138 shri 17 139 xor2 v0 140 sta v0 # v0: v0 ^= v0>> 17; 141 shli 5 142 xor2 v0 # acc: v0 ^= v0 << 5; 143 return 144 } 145 146tests: 147 - include: "add.yaml" 148 - include: "add2.64.yaml" 149 - include: "add2.yaml" 150 - include: "addi.yaml" 151 - include: "and.yaml" 152 - include: "and2.64.yaml" 153 - include: "and2.yaml" 154 - include: "andi.yaml" 155 - include: "ashr.yaml" 156 - include: "ashr2.64.yaml" 157 - include: "ashr2.yaml" 158 - include: "ashri.yaml" 159 - include: "call.range.yaml" 160 - include: "call.short.yaml" 161 - include: "call.virt.negative.yaml" 162 - include: "call.virt.range.negative.yaml" 163 - include: "call.virt.range.yaml" 164 - include: "call.virt.range_base.yaml" 165 - include: "call.virt.short.negative.yaml" 166 - include: "call.virt.short.yaml" 167 - include: "call.virt.yaml" 168 - include: "call.yaml" 169 - include: "checkcast.yaml" 170 - include: "cmp.64.yaml" 171 - include: "div.yaml" 172 - include: "div2.64.yaml" 173 - include: "div2.yaml" 174 - include: "divi.yaml" 175 - include: "divu2.64.yaml" 176 - include: "divu2.yaml" 177 - include: "f64toi32.yaml" 178 - include: "f64toi64.yaml" 179 - include: "f64tou32.yaml" 180 - include: "f64tou64.yaml" 181 - include: "fadd2.yaml" 182 - include: "fcmpg.yaml" 183 - include: "fcmpl.yaml" 184 - include: "fdiv2.yaml" 185 - include: "fldarr.32.yaml" 186 - include: "fldarr.64.yaml" 187 - include: "fldai.yaml" 188 - include: "fmod2.yaml" 189 - include: "fmovi.64.yaml" 190 - include: "fmul2.yaml" 191 - include: "fneg.yaml" 192 - include: "fp.yaml" 193 - include: "fstarr.32.yaml" 194 - include: "fstarr.64.yaml" 195 - include: "fsub2.yaml" 196 - include: "i32toi64.yaml" 197 - include: "i32toi16.yaml" 198 - include: "i32tou16.yaml" 199 - include: "i32tou8.yaml" 200 - include: "i32toi8.yaml" 201 - include: "i32tou1.yaml" 202 - include: "i32tof64.yaml" 203 - include: "i64toi32.yaml" 204 - include: "i64tou1.yaml" 205 - include: "i64tof64.yaml" 206 - include: "inci.yaml" 207 - include: "initobj.range.yaml" 208 - include: "initobj.short.yaml" 209 - include: "initobj.yaml" 210 - include: "isinstance.yaml" 211 - include: "jeq.obj.yaml" 212 - include: "jeqz.obj.yaml" 213 - include: "jeqz.yaml" 214 - include: "jgez.yaml" 215 - include: "jgtz.yaml" 216 - include: "jlez.yaml" 217 - include: "jltz.yaml" 218 - include: "jmp.yaml" 219 - include: "jne.obj.yaml" 220 - include: "jnez.obj.yaml" 221 - include: "jnez.yaml" 222 - include: "jeq.yaml" 223 - include: "jge.yaml" 224 - include: "jgt.yaml" 225 - include: "jle.yaml" 226 - include: "jlt.yaml" 227 - include: "jne.yaml" 228 - include: "lda.64.yaml" 229 - include: "lda.null.yaml" 230 - include: "lda.obj.yaml" 231 - include: "lda.str.yaml" 232 - include: "lda.type.yaml" 233 - include: "lda.yaml" 234 - include: "ldai.64.yaml" 235 - include: "ldai.yaml" 236 - include: "ldarr.yaml" 237 - include: "ldarr.16.yaml" 238 - include: "ldarr.64.yaml" 239 - include: "ldarr.8.yaml" 240 - include: "ldarr.obj.yaml" 241 - include: "ldarru.16.yaml" 242 - include: "ldarru.8.yaml" 243 - include: "ldobj.64.yaml" 244 - include: "ldobj.obj.yaml" 245 - include: "ldobj.yaml" 246 - include: "ldstatic.64.yaml" 247 - include: "ldstatic.obj.yaml" 248 - include: "ldstatic.yaml" 249 - include: "lenarr.yaml" 250 - include: "mod.yaml" 251 - include: "mod2.64.yaml" 252 - include: "mod2.yaml" 253 - include: "modi.yaml" 254 - include: "modu2.64.yaml" 255 - include: "modu2.yaml" 256 - include: "mov.64.yaml" 257 - include: "mov.null.yaml" 258 - include: "mov.obj.yaml" 259 - include: "mov.yaml" 260 - include: "movi.64.yaml" 261 - include: "movi.yaml" 262 - include: "mul.yaml" 263 - include: "mul2.64.yaml" 264 - include: "mul2.yaml" 265 - include: "muli.yaml" 266 - include: "neg.64.yaml" 267 - include: "neg.yaml" 268 - include: "newarr.yaml" 269 - include: "newobj.yaml" 270 - include: "not.64.yaml" 271 - include: "not.yaml" 272 - include: "or.yaml" 273 - include: "or2.64.yaml" 274 - include: "or2.yaml" 275 - include: "ori.yaml" 276 - include: "return.64.yaml" 277 - include: "return.obj.yaml" 278 - include: "return.void.yaml" 279 - include: "return.yaml" 280 - include: "shl.yaml" 281 - include: "shl2.64.yaml" 282 - include: "shl2.yaml" 283 - include: "shli.yaml" 284 - include: "shr.yaml" 285 - include: "shr2.64.yaml" 286 - include: "shr2.yaml" 287 - include: "shri.yaml" 288 - include: "sta.64.yaml" 289 - include: "sta.obj.yaml" 290 - include: "sta.yaml" 291 - include: "starr.yaml" 292 - include: "starr.16.yaml" 293 - include: "starr.64.yaml" 294 - include: "starr.8.yaml" 295 - include: "starr.obj.yaml" 296 - include: "stobj.64.yaml" 297 - include: "stobj.obj.yaml" 298 - include: "stobj.yaml" 299 - include: "ststatic.64.yaml" 300 - include: "ststatic.obj.yaml" 301 - include: "ststatic.yaml" 302 - include: "sub.yaml" 303 - include: "sub2.64.yaml" 304 - include: "sub2.yaml" 305 - include: "subi.yaml" 306 - include: "throw.yaml" 307 - include: "u32tof64.yaml" 308 - include: "u32toi16.yaml" 309 - include: "u32toi8.yaml" 310 - include: "u32toi64.yaml" 311 - include: "u32tou1.yaml" 312 - include: "u32tou16.yaml" 313 - include: "u32tou8.yaml" 314 - include: "u64tof64.yaml" 315 - include: "u64toi32.yaml" 316 - include: "u64tou1.yaml" 317 - include: "u64tou32.yaml" 318 - include: "ucmp.64.yaml" 319 - include: "ucmp.yaml" 320 - include: "xor.yaml" 321 - include: "xor2.64.yaml" 322 - include: "xor2.yaml" 323 - include: "xori.yaml" 324