1# Copyright (c) 2021-2022 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: [] 15tests: 16 - file-name: "add2" 17 isa: 18 title: Two address binary operation on accumulator 19 description: > 20 Perform specified binary operation on accumulator and register and store result into accumulator 21 exceptions: 22 - x_none 23 commands: 24 - file-name: "op_vs_8_zero" 25 isa: 26 instructions: 27 - sig: add2 v:in:i32 28 acc: inout:i32 29 format: [op_v_8] 30 code-template: | 31 # 32 ldai 0 33 movi v0, %s 34 add2 v0 35 movi v0, %s 36 jne v0, set_failure 37 ldai 0 38 jmp fall_through 39 set_failure: 40 ldai 1 41 fall_through: 42 description: Check add2 with zero and various values. 43 cases: 44 - values: 45 - "0" 46 - "0" 47 - values: 48 - "1" 49 - "1" 50 - values: 51 - "-1" 52 - "-1" 53 - values: 54 - "0x7FFFFFFF" 55 - "0x7FFFFFFF" 56 - values: 57 - "0x80000000" 58 - "0x80000000" 59 - values: 60 - "-0x7FFFFFFF" 61 - "-0x7FFFFFFF" 62 - values: 63 - "-0x80000000" 64 - "-0x80000000" 65 - values: 66 - "0xFFFFFFFF" 67 - "0xFFFFFFFF" 68 - values: 69 - "-0xFFFFFFFF" 70 - "-0xFFFFFFFF" 71 72 - file-name: "op_vs_8_pone" 73 isa: 74 instructions: 75 - sig: add2 v:in:i32 76 acc: inout:i32 77 format: [op_v_8] 78 code-template: | 79 # 80 ldai 1 81 movi v0, %s 82 add2 v0 83 movi v0, %s 84 jne v0, set_failure 85 ldai 0 86 jmp fall_through 87 set_failure: 88 ldai 1 89 fall_through: 90 description: Check add2 with +1 and various values. 91 cases: 92 - values: 93 - "0" 94 - "1" 95 - values: 96 - "1" 97 - "2" 98 - values: 99 - "-1" 100 - "0" 101 - values: 102 - "0x7FFFFFFF" 103 - "0x80000000" 104 bugid: ["966"] 105 - values: 106 - "0x80000000" 107 - "0x80000001" 108 - values: 109 - "-0x7FFFFFFF" 110 - "-0x7FFFFFFE" 111 - values: 112 - "-0x80000000" 113 - "-0x7FFFFFFF" 114 - values: 115 - "0xFFFFFFFF" 116 - "0" 117 - values: 118 - "-0xFFFFFFFF" 119 - "-0xFFFFFFFE" 120 - file-name: "op_vs_8_none" 121 isa: 122 instructions: 123 - sig: add2 v:in:i32 124 acc: inout:i32 125 format: [op_v_8] 126 code-template: | 127 # 128 ldai -1 129 movi v0, %s 130 add2 v0 131 movi v0, %s 132 jne v0, set_failure 133 ldai 0 134 jmp fall_through 135 set_failure: 136 ldai 1 137 fall_through: 138 description: Check add2 with -1 and various values. 139 cases: 140 - values: 141 - "0" 142 - "-1" 143 - values: 144 - "1" 145 - "0" 146 - values: 147 - "-1" 148 - "-2" 149 - values: 150 - "0x7FFFFFFF" 151 - "0x7FFFFFFE" 152 - values: 153 - "0x80000000" 154 - "0x7FFFFFFF" 155 bugid: ["966"] 156 - values: 157 - "-0x7FFFFFFF" 158 - "-0x80000000" 159 - values: 160 - "-0x80000000" 161 - "-0x80000001" 162 bugid: ["966"] 163 - values: 164 - "0xFFFFFFFF" 165 - "-2" 166 - values: 167 - "-0xFFFFFFFF" 168 - "0" 169 - file-name: "op_vs_8_pmax" 170 isa: 171 instructions: 172 - sig: add2 v:in:i32 173 acc: inout:i32 174 format: [op_v_8] 175 code-template: | 176 # 177 ldai 0x7FFFFFFF 178 movi v0, %s 179 add2 v0 180 movi v0, %s 181 jne v0, set_failure 182 ldai 0 183 jmp fall_through 184 set_failure: 185 ldai 1 186 fall_through: 187 description: Check add2 with +max and various values. 188 cases: 189 - values: 190 - "0" 191 - "0x7fffffff" 192 - values: 193 - "1" 194 - "0x80000000" 195 bugid: ["966"] 196 - values: 197 - "-1" 198 - "0x7FFFFFFE" 199 - values: 200 - "0x7FFFFFFF" 201 - "0xFFFFFFFE" 202 bugid: ["966"] 203 - values: 204 - "0x80000000" 205 - "0xFFFFFFFF" 206 - values: 207 - "-0x7FFFFFFF" 208 - "0" 209 - values: 210 - "-0x80000000" 211 - "0xFFFFFFFF" 212 - values: 213 - "0xFFFFFFFF" 214 - "0x7FFFFFFE" 215 - values: 216 - "-0xFFFFFFFF" 217 - "0x80000000" 218 bugid: ["966"] 219 220 - file-name: "op_vs_8_nmax" 221 isa: 222 instructions: 223 - sig: add2 v:in:i32 224 acc: inout:i32 225 format: [op_v_8] 226 code-template: | 227 # 228 ldai -0x80000000 229 movi v0, %s 230 add2 v0 231 movi v0, %s 232 jne v0, set_failure 233 ldai 0 234 jmp fall_through 235 set_failure: 236 ldai 1 237 fall_through: 238 description: Check add2 with -max and various values. 239 cases: 240 - values: 241 - "0" 242 - "0x80000000" 243 - values: 244 - "1" 245 - "0x80000001" 246 - values: 247 - "-1" 248 - "0x7FFFFFFF" 249 bugid: ["966"] 250 - values: 251 - "0x7FFFFFFF" 252 - "-1" 253 - values: 254 - "0x80000000" 255 - "0" 256 bugid: ["966"] 257 - values: 258 - "-0x7FFFFFFF" 259 - "1" 260 bugid: ["966"] 261 - values: 262 - "-0x80000000" 263 - "0" 264 bugid: ["966"] 265 - values: 266 - "0xFFFFFFFF" 267 - "0x7FFFFFFF" 268 bugid: ["966"] 269 - values: 270 - "-0xFFFFFFFF" 271 - "-0x7FFFFFFF" 272 273 - file-name: "vals" 274 isa: 275 instructions: 276 - sig: add2 v:in:i32 277 acc: inout:i32 278 format: [op_v_8] 279 tags: ['tsan'] 280 code-template: | 281 # 282 ldai %s 283 movi v0, %s 284 add2 v0 285 movi v0, %s 286 jne v0, set_failure 287 ldai 0 288 jmp fall_through 289 set_failure: 290 ldai 1 291 fall_through: 292 description: Check add2 with various values. 293 cases: 294 - values: 295 - "0x455ed8f5" 296 - "0xfe61fbdd" 297 - "0x43c0d4d2" 298 - values: 299 - "0xc3e6a70" 300 - "0xae9b1e98" 301 - "0xbad98908" 302 - values: 303 - "0xd2670242" 304 - "0xef691c0f" 305 - "0xc1d01e51" 306 - values: 307 - "0xf6d0f4f8" 308 - "0x4ee5e5df" 309 - "0x45b6dad7" 310 - values: 311 - "0xded7f996" 312 - "0xd94428a1" 313 - "0xb81c2237" 314 - values: 315 - "0x262d5e15" 316 - "0x1a85200d" 317 - "0x40b27e22" 318 - values: 319 - "0x4bb930e4" 320 - "0x416b3a07" 321 - "0x8d246aeb" 322 bugid: ["966"] 323 - values: 324 - "0x61a80560" 325 - "0xb076ee9" 326 - "0x6caf7449" 327 - values: 328 - "0x42bd8cd3" 329 - "0x9e28b8b6" 330 - "0xe0e64589" 331 - values: 332 - "0x3c0a62e1" 333 - "0xb18cfa" 334 - "0x3cbbefdb" 335 336 - file-name: "vals_mod32_1" 337 bugid: ['1324', '2072'] 338 tags: ['verifier'] 339 runner-options: ['verifier-failure', 'verifier-config'] 340 isa: 341 instructions: 342 - sig: add2 v:in:i32 343 acc: inout:i32 344 format: [op_v_8] 345 code-template: | 346 # 347 ldai %s 348 movi v0, %s 349 add2 v0 350 movi.64 v0, %s 351 cmp.64 v0 352 description: Check add2 with incorrect register and accumulator type. 353 cases: 354 - values: 355 - "0x7FFFFFFF" 356 - "0x7FFFFFFF" 357 - "0xFFFFFFFFFFFFFFFE" 358 bugid: ["966"] 359 - values: 360 - "0x7FFFFFFF" 361 - "0x80000000" 362 - "0xFFFFFFFFFFFFFFFF" 363 - values: 364 - "0x80000000" 365 - "0x80000000" 366 - "0" 367 bugid: ["966"] 368 369 - file-name: "vals_mod32_2" 370 bugid: ['1324'] 371 tags: ['verifier'] 372 runner-options: ['verifier-failure', 'verifier-config'] 373 isa: 374 instructions: 375 - sig: add2 v:in:i32 376 acc: inout:i32 377 format: [op_v_8] 378 code-template: | 379 # 380 ldai.64 %s 381 movi.64 v0, %s 382 add2 v0 383 movi.64 v0, %s 384 cmp.64 v0 385 description: Check add2 with incorrect register and accumulator type. 386 cases: 387 - values: 388 - "0x17FFFFFFF" 389 - "0x17FFFFFFF" 390 - "0xFFFFFFFFFFFFFFFE" 391 bugid: ["966"] 392 - values: 393 - "0x777777777FFFFFFF" 394 - "0x1111111180000000" 395 - "0xFFFFFFFFFFFFFFFF" 396 - values: 397 - "0x180000000" 398 - "0x180000000" 399 - "0" 400 bugid: ["966"] 401 402 - file-name: "regs" 403 isa: 404 instructions: 405 - sig: add2 v:in:i32 406 acc: inout:i32 407 format: [op_v_8] 408 runner-options: ['compile-only'] 409 code-template: | 410 # 411 add2 %s 412 check-type: none 413 description: Check add2 with various register numbers. 414 cases: 415 - values: 416 - "v255" 417 - values: 418 - "v256" 419 runner-options: ['compile-failure'] 420 421 - file-name: "type" 422 bugid: ["964", "966"] 423 tags: ["verifier"] 424 isa: 425 verification: 426 - acc_type 427 - v1_type 428 runner-options: ['verifier-failure', 'verifier-config'] 429 header-template: [] 430 code-template: | 431 .record T {} 432 .function i32 main() { 433 %s 434 *s 435 add2 v0 436 check-type: exit-positive 437 description: Check 'add2' with incorrect accumulator and/or register types. 438 cases: 439 - values: 440 - ldai 0 441 id: acc_ok 442 - values: 443 - ldai.64 0 444 - values: 445 - fldai 0 446 bugid: ['7315'] 447 - values: 448 - fldai.64 0 449 - values: 450 - lda.null 451 - values: 452 - | 453 # 454 movi v1, 0 455 newarr v1, v1, i32[] 456 lda.obj v1 457 - values: 458 - lda.str "0" 459 - values: 460 - lda.type T 461 - values: 462 - | 463 # 464 newobj v1, T 465 lda.obj v1 466 template-cases: 467 - values: 468 - movi v0, 0 469 exclude: [acc_ok] 470 - values: 471 - movi.64 v0, 0 472 - values: 473 - fmovi v0, 0 474 bugid: ['7315'] 475 - values: 476 - fmovi.64 v0, 0 477 - values: 478 - mov.null v0 479 - values: 480 - | 481 # 482 movi v0, 0 483 newarr v0, v0, i32[] 484 - values: 485 - | 486 # 487 lda.str "0" 488 sta.obj v0 489 - values: 490 - | 491 # 492 lda.type T 493 sta.obj v0 494 - values: 495 - newobj v0, T 496 497 - file-name: uninitialized_regs 498 isa: 499 instructions: 500 - sig: add2 v:in:i32 501 acc: inout:i32 502 format: [op_v_8] 503 description: Check 'add2' with uninitialized registers. 504 tags: ['verifier'] 505 runner-options: ['verifier-failure', 'verifier-config'] 506 code-template: | 507 # 508 %s 509 *s 510 add2 *s 511 check-type: exit-positive 512 template-cases: 513 - values: 514 - '' 515 - values: 516 - ldai 0 517 exclude: [init] 518 cases: 519 - values: 520 - '' 521 - v0 522 - values: 523 - movi v1, 0 524 - v1 525 id: init 526 - values: 527 - '' 528 - v8 529 - values: 530 - '' 531 - v15 532 - values: 533 - movi v15, 0 534 - v15 535 id: init 536