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 14tests: 15 - file-name: "jne" 16 isa: 17 title: Conditional compared to register jump 18 description: > 19 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed 20 32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of 21 instruction address. 22 exceptions: 23 - x_none 24 instructions: 25 - sig: jne v:in:i32, imm:i32 26 acc: in:i32 27 format: [op_v_8_imm_8, op_v_8_imm_16] 28 commands: 29 30 - file-name: "invalid_v_reg" 31 isa: 32 verification: 33 - v1_type 34 runner-options: [compile-failure] 35 description: Check 'jne' instruction with invalid 'v' register. 36 header-template: [] 37 code-template: | 38 .function i32 main() { 39 jne %s 40 lbl: 41 check-type: exit-positive 42 cases: 43 - values: ["v256, lbl"] 44 - values: ["v65535, lbl"] 45 - values: ["v65536, lbl"] 46 - values: ["a0, lbl"] 47 - values: ["a256, lbl"] 48 - values: ["a65535, lbl"] 49 - values: ["lbl"] 50 - values: [""] 51 - values: ["}"] 52 - values: ["# v1, lbl"] 53 - values: ["V1, lbl"] 54 - values: ["v1, Lbl"] 55 56 57 - file-name: "invalid_a_reg" 58 isa: 59 verification: 60 - v1_type 61 runner-options: [compile-failure] 62 description: Check 'jne' instruction with invalid 'a' register. 63 header-template: [] 64 code-template: | 65 .function void foo(i32 a0, i32 a1, i32 a2, i32 a3, i32 a4, i32 a5) <static> { 66 jne %s 67 lbl: 68 return.void 69 } 70 .function i32 main() { 71 call.range foo, v0 72 check-type: exit-positive 73 cases: 74 - values: ["v256, lbl"] 75 - values: ["v65535, lbl"] 76 - values: ["v65536, lbl"] 77 - values: ["a6, lbl"] 78 - values: ["a256, lbl"] 79 - values: ["a65535, lbl"] 80 - values: ["lbl"] 81 - values: [""] 82 - values: ["}"] 83 - values: ["# a1, lbl"] 84 - values: ["A1, lbl"] 85 - values: ["a1, Lbl"] 86 87 88 - file-name: "valid_v_reg" 89 isa: 90 verification: 91 - v1_type 92 instructions: 93 - sig: jne v:in:i32, imm:i32 94 acc: in:i32 95 format: [op_v_8_imm_8, op_v_8_imm_16] 96 description: Check 'jne' instruction with valid 'v' register. 97 header-template: [] 98 code-template: | 99 .function i32 main() { 100 movi %s, 0 101 ldai 2 102 jne %s, lbl 103 ldai 1 104 return 105 lbl: 106 check-type: exit-positive 107 cases: 108 - values: ["v0", "v0"] 109 - values: ["v7", "v7"] 110 - values: ["v8", "v8"] 111 - values: ["v15", "v15"] 112 - values: ["v16", "v16"] 113 - values: ["v254", "v254"] 114 - values: ["v255", "v255"] 115 tags: [tsan] 116 117 118 - file-name: "valid_a_reg" 119 isa: 120 verification: 121 - v1_type 122 instructions: 123 - sig: jne v:in:i32, imm:i32 124 acc: in:i32 125 format: [op_v_8_imm_8, op_v_8_imm_16] 126 description: Check 'jne' instruction with valid 'a' register. 127 header-template: [] 128 code-template: | 129 .function i32 foo(%s) <static> { 130 ldai 0xffffffff 131 jne %s, lbl 132 ldai 1 133 return 134 lbl: 135 ldai 0 136 return 137 } 138 .function i32 main() { 139 %s 140 call.range foo, v0 141 check-type: no-check 142 cases: 143 - values: 144 - i32 a0 145 - a0 146 - | 147 # 148 movi v0, 0x7fffffff 149 - values: 150 - i16 a0, i32 a1 151 - a1 152 - | 153 # 154 movi v0, 0x00007fff 155 movi v1, 0x0000ffff 156 tags: [tsan] 157 - values: 158 - "#{[*0..255].map do |i| \" i32 a#{i}\" end .join(\",\")}" 159 - a254 160 - "#{[*0..255].map do |i| \" movi v#{i}, #{i}\\n\" end .join}" 161 bugid: ['3855'] 162 - values: 163 - "#{[*0..255].map do |i| \" i32 a#{i}\" end .join(\",\")}" 164 - a255 165 - "#{[*0..255].map do |i| \" movi v#{i}, #{i}\\n\" end .join}" 166 bugid: ['3855'] 167 168 169 - file-name: "uninitialized_regs" 170 isa: 171 verification: 172 - acc_type 173 - v1_type 174 runner-options: ['verifier-failure', 'verifier-config'] 175 tags: [verifier] 176 description: Check 'jne' instruction with uninitialized registers. 177 header-template: [] 178 code-template: | 179 .function i32 main() { 180 %s 181 jne v1, lbl 182 ldai 1 183 return 184 lbl: 185 check-type: exit-positive 186 cases: 187 - description: Accumulator is not initialized. 188 values: 189 - movi v1, 1 190 - description: V register is not initialized. 191 values: 192 - ldai 1 193 - description: Accumulator and 'v' register are both not initialized. 194 values: 195 - "" 196 197 198 - file-name: "invalid_branch_target" 199 isa: 200 verification: 201 - branch_target 202 runner-options: [compile-failure] 203 description: Check 'jne' instruction with invalid branch target. 204 header-template: [] 205 code-template: | 206 .record R {} 207 208 .function void R.ctor(R a0) <ctor> { 209 lbl_ctor: 210 return.void 211 } 212 213 .function void R.cctor() <cctor> { 214 lbl_cctor: 215 return.void 216 } 217 218 .function i32 foo(i32 a0, i32 a1) <static> { 219 lda a0 220 jne a1, %s 221 return 222 } 223 224 .function i32 bar() <static> { 225 lbl_bar: 226 ldai 1 227 return 228 } 229 230 .function i32 main() { 231 movi v0, 0 232 movi v1, 1 233 call.short foo, v0, v1 234 lbl_main: 235 check-type: exit-positive 236 cases: 237 - values: ["main"] 238 - values: ["foo"] 239 - values: ["bar"] 240 - values: ["baz"] 241 - values: ["R"] 242 - values: ["lbl_main"] 243 - values: ["lbl_bar"] 244 - values: ["lbl_ctor"] 245 - values: ["lbl_cctor"] 246 247 248 - file-name: "prohibited_branch_target" 249 isa: 250 verification: 251 - branch_target 252 runner-options: ['verifier-failure', 'verifier-config'] 253 tags: [verifier] 254 description: Check 'jne' instruction with prohibited branch target. 255 header-template: [] 256 code-template: | 257 .record E1 {} 258 .record E2 {} 259 260 .function i32 main() { 261 ldai 1 262 movi v0, 1 263 jne v0, %s 264 265 begin: 266 ldai 0 267 return 268 mid: 269 ldai 1 270 return 271 end: 272 ldai 2 273 return 274 275 catch_E1_begin: 276 ldai 3 277 return 278 catch_E1_mid: 279 ldai 4 280 return 281 catch_E1_end: 282 ldai 5 283 return 284 285 catch_E2_begin: 286 ldai 6 287 return 288 catch_E2_mid: 289 ldai 7 290 return 291 catch_E2_end: 292 293 quit: 294 ldai 8 295 return 296 297 .catch E1, begin, end, catch_E1_begin, catch_E1_end 298 .catch E2, catch_E1_begin, catch_E1_end, catch_E2_begin, catch_E2_end 299 outside: 300 check-type: none 301 cases: 302 - values: ["begin"] 303 runner-options: ['verifier-only', 'verifier-config'] 304 - values: ["mid"] 305 runner-options: ['verifier-only', 'verifier-config'] 306 - values: ["end"] 307 runner-options: ['verifier-only', 'verifier-config'] 308 - values: ["quit"] 309 runner-options: ['verifier-only', 'verifier-config'] 310 - values: ["catch_E1_begin"] 311 - values: ["catch_E1_mid"] 312 - values: ["catch_E1_end"] 313 runner-options: ['verifier-only', 'verifier-config'] 314 - values: ["catch_E2_begin"] 315 - values: ["catch_E2_mid"] 316 - values: ["catch_E2_end"] 317 runner-options: ['verifier-only', 'verifier-config'] 318 - values: ["outside"] 319 320 321 - file-name: "invalid_acc_value" 322 isa: 323 verification: 324 - acc_type 325 runner-options: ['verifier-failure', 'verifier-config'] 326 tags: [verifier] 327 description: Check 'jne' instruction with invalid accumulator value 328 header-template: [] 329 code-template: | 330 .record panda.Object <external> 331 .record panda.String <external> 332 .record panda.Class <external> 333 .record R {} 334 .function void R.ctor(R a0) <ctor> { 335 return.void 336 } 337 .function i32 main() { 338 %s 339 movi v1, 1 340 jne v1, ok 341 ldai 1 342 return 343 ok: 344 check-type: exit-positive 345 cases: 346 - values: 347 - lda.null 348 - values: 349 - initobj R.ctor 350 - values: 351 - lda.str "test" 352 - values: 353 - lda.type panda.Object 354 - values: 355 - | 356 # 357 movi v0, 10 358 newarr v0, v0, i32[] 359 lda.obj v0 360 - values: 361 - | 362 # 363 movi v0, 10 364 newarr v0, v0, f64[] 365 lda.obj v0 366 - values: 367 - | 368 # 369 movi v0, 10 370 newarr v0, v0, R[] 371 lda.obj v0 372 - values: 373 - | 374 # 375 movi v0, 10 376 newarr v0, v0, panda.Class[][] 377 lda.obj v0 378 - values: 379 - | 380 # 381 movi v0, 10 382 newarr v0, v0, panda.String[] 383 lda.obj v0 384 - values: 385 - ldai.64 0 386 - values: 387 - ldai.64 1 388 - values: 389 - ldai.64 0x7fffffffffffffff 390 - values: 391 - ldai.64 0xffffffffffffffff 392 - values: 393 - ldai.64 0x8000000000000000 394 - values: 395 - | 396 # 397 fldai 0x00000000 # Positive zero (+0.0) 398 - values: 399 - | 400 # 401 fldai 0x80000000 # Negative zero (-0.0) 402 - values: 403 - | 404 # 405 fldai 0x00000001 # Minimal positive value (1.4012985e-45) 406 - values: 407 - | 408 # 409 fldai 0x80000001 # Maximal negative value (-1.4012985e-45) 410 - values: 411 - | 412 # 413 fldai 0x7f7fffff # Maximal positive value (3.4028235e38) 414 - values: 415 - | 416 # 417 fldai 0xff7fffff # Minimal negative value (-3.4028235e38) 418 - values: 419 - | 420 # 421 fldai 0x7f800000 # Positive infinity 422 - values: 423 - | 424 # 425 fldai 0xff800000 # Negative infinity 426 - values: 427 - | 428 # 429 fldai 0x7fc00000 # NaN 430 - values: 431 - | 432 # 433 fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 434 - values: 435 - | 436 # 437 fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 438 - values: 439 - | 440 # 441 fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 442 - values: 443 - | 444 # 445 fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 446 - values: 447 - | 448 # 449 fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 450 - values: 451 - | 452 # 453 fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 454 - values: 455 - | 456 # 457 fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 458 - values: 459 - | 460 # 461 fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 462 - values: 463 - | 464 # 465 fldai.64 0x7ff8000000000000 # NaN 466 467 468 - file-name: "invalid_v_value" 469 isa: 470 verification: 471 - v1_type 472 runner-options: ['verifier-failure', 'verifier-config'] 473 tags: [verifier] 474 description: Check 'jne' instruction with invalid v register value 475 header-template: [] 476 code-template: | 477 .record panda.Object <external> 478 .record panda.String <external> 479 .record panda.Class <external> 480 .record R {} 481 .function void R.ctor(R a0) <ctor> { 482 return.void 483 } 484 .function i32 main() { 485 %s 486 ldai 1 487 jne v1, ok 488 ldai 1 489 return 490 ok: 491 check-type: exit-positive 492 cases: 493 - values: 494 - mov.null v1 495 - values: 496 - | 497 # 498 initobj R.ctor 499 sta.obj v1 500 - values: 501 - | 502 # 503 lda.str "test" 504 sta.obj v1 505 - values: 506 - | 507 # 508 lda.type panda.Object 509 sta.obj v1 510 - values: 511 - | 512 # 513 movi v0, 10 514 newarr v1, v0, i32[] 515 lda.obj v1 516 - values: 517 - | 518 # 519 movi v0, 10 520 newarr v1, v0, f64[] 521 lda.obj v1 522 - values: 523 - | 524 # 525 movi v0, 10 526 newarr v1, v0, R[] 527 lda.obj v1 528 - values: 529 - | 530 # 531 movi v0, 10 532 newarr v1, v0, panda.Class[][] 533 lda.obj v1 534 - values: 535 - | 536 # 537 movi v0, 10 538 newarr v1, v0, panda.String[] 539 lda.obj v1 540 - values: 541 - movi.64 v1, 0 542 - values: 543 - movi.64 v1, 1 544 - values: 545 - movi.64 v1, 0x7fffffffffffffff 546 - values: 547 - movi.64 v1, 0xffffffffffffffff 548 - values: 549 - movi.64 v1, 0x8000000000000000 550 - values: 551 - | 552 # 553 fmovi v1, 0x00000000 # Positive zero (+0.0) 554 - values: 555 - | 556 # 557 fmovi v1, 0x80000000 # Negative zero (-0.0) 558 - values: 559 - | 560 # 561 fmovi v1, 0x00000001 # Minimal positive value (1.4012985e-45) 562 - values: 563 - | 564 # 565 fmovi v1, 0x80000001 # Maximal negative value (-1.4012985e-45) 566 - values: 567 - | 568 # 569 fmovi v1, 0x7f7fffff # Maximal positive value (3.4028235e38) 570 - values: 571 - | 572 # 573 fmovi v1, 0xff7fffff # Minimal negative value (-3.4028235e38) 574 - values: 575 - | 576 # 577 fmovi v1, 0x7f800000 # Positive infinity 578 - values: 579 - | 580 # 581 fmovi v1, 0xff800000 # Negative infinity 582 - values: 583 - | 584 # 585 fmovi v1, 0x7fc00000 # NaN 586 - values: 587 - | 588 # 589 fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 590 - values: 591 - | 592 # 593 fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 594 - values: 595 - | 596 # 597 fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 598 - values: 599 - | 600 # 601 fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 602 - values: 603 - | 604 # 605 fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 606 - values: 607 - | 608 # 609 fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 610 - values: 611 - | 612 # 613 fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 614 - values: 615 - | 616 # 617 fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 618 - values: 619 - | 620 # 621 fmovi.64 v1, 0x7ff8000000000000 # NaN 622 623 624 - file-name: "invalid_both_acc_and_v_value" 625 isa: 626 verification: 627 - v1_type 628 - acc_type 629 runner-options: ['verifier-failure', 'verifier-config'] 630 tags: [verifier] 631 description: Check 'jne' instruction with invalid accumulator and v register value 632 header-template: [] 633 code-template: | 634 .record panda.Object <external> 635 .record panda.String <external> 636 .record panda.Class <external> 637 .record R {} 638 .function void R.ctor(R a0) <ctor> { 639 return.void 640 } 641 .function i32 main() { 642 *s 643 %s 644 jne v1, ok 645 ldai 1 646 return 647 ok: 648 check-type: exit-positive 649 template-cases: 650 - values: 651 - lda.null 652 - values: 653 - initobj R.ctor 654 - values: 655 - lda.str "test" 656 - values: 657 - lda.type panda.Object 658 - values: 659 - | 660 # 661 movi v0, 10 662 newarr v0, v0, i32[] 663 lda.obj v0 664 - values: 665 - | 666 # 667 movi v0, 10 668 newarr v0, v0, f64[] 669 lda.obj v0 670 - values: 671 - | 672 # 673 movi v0, 10 674 newarr v0, v0, R[] 675 lda.obj v0 676 - values: 677 - | 678 # 679 movi v0, 10 680 newarr v0, v0, panda.Class[][] 681 lda.obj v0 682 - values: 683 - | 684 # 685 movi v0, 10 686 newarr v0, v0, panda.String[] 687 lda.obj v0 688 - values: 689 - ldai.64 0 690 - values: 691 - ldai.64 1 692 - values: 693 - ldai.64 0x7fffffffffffffff 694 - values: 695 - ldai.64 0xffffffffffffffff 696 - values: 697 - ldai.64 0x8000000000000000 698 - values: 699 - | 700 # 701 fldai 0x00000000 # Positive zero (+0.0) 702 - values: 703 - | 704 # 705 fldai 0x80000000 # Negative zero (-0.0) 706 - values: 707 - | 708 # 709 fldai 0x00000001 # Minimal positive value (1.4012985e-45) 710 - values: 711 - | 712 # 713 fldai 0x80000001 # Maximal negative value (-1.4012985e-45) 714 - values: 715 - | 716 # 717 fldai 0x7f7fffff # Maximal positive value (3.4028235e38) 718 - values: 719 - | 720 # 721 fldai 0xff7fffff # Minimal negative value (-3.4028235e38) 722 - values: 723 - | 724 # 725 fldai 0x7f800000 # Positive infinity 726 - values: 727 - | 728 # 729 fldai 0xff800000 # Negative infinity 730 - values: 731 - | 732 # 733 fldai 0x7fc00000 # NaN 734 - values: 735 - | 736 # 737 fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 738 - values: 739 - | 740 # 741 fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 742 - values: 743 - | 744 # 745 fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 746 - values: 747 - | 748 # 749 fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 750 - values: 751 - | 752 # 753 fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 754 - values: 755 - | 756 # 757 fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 758 - values: 759 - | 760 # 761 fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 762 - values: 763 - | 764 # 765 fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 766 - values: 767 - | 768 # 769 fldai.64 0x7ff8000000000000 # NaN 770 cases: 771 - values: 772 - mov.null v1 773 - values: 774 - | 775 # 776 initobj R.ctor 777 sta.obj v1 778 - values: 779 - | 780 # 781 lda.str "test" 782 sta.obj v1 783 - values: 784 - | 785 # 786 lda.type panda.Object 787 sta.obj v1 788 - values: 789 - | 790 # 791 movi v0, 10 792 newarr v1, v0, i32[] 793 lda.obj v1 794 - values: 795 - | 796 # 797 movi v0, 10 798 newarr v1, v0, f64[] 799 lda.obj v1 800 - values: 801 - | 802 # 803 movi v0, 10 804 newarr v1, v0, R[] 805 lda.obj v1 806 - values: 807 - | 808 # 809 movi v0, 10 810 newarr v1, v0, panda.Class[][] 811 lda.obj v1 812 - values: 813 - | 814 # 815 movi v0, 10 816 newarr v1, v0, panda.String[] 817 lda.obj v1 818 - values: 819 - movi.64 v1, 0 820 - values: 821 - movi.64 v1, 1 822 - values: 823 - movi.64 v1, 0x7fffffffffffffff 824 - values: 825 - movi.64 v1, 0xffffffffffffffff 826 - values: 827 - movi.64 v1, 0x8000000000000000 828 - values: 829 - | 830 # 831 fmovi v1, 0x00000000 # Positive zero (+0.0) 832 - values: 833 - | 834 # 835 fmovi v1, 0x80000000 # Negative zero (-0.0) 836 - values: 837 - | 838 # 839 fmovi v1, 0x00000001 # Minimal positive value (1.4012985e-45) 840 - values: 841 - | 842 # 843 fmovi v1, 0x80000001 # Maximal negative value (-1.4012985e-45) 844 - values: 845 - | 846 # 847 fmovi v1, 0x7f7fffff # Maximal positive value (3.4028235e38) 848 - values: 849 - | 850 # 851 fmovi v1, 0xff7fffff # Minimal negative value (-3.4028235e38) 852 - values: 853 - | 854 # 855 fmovi v1, 0x7f800000 # Positive infinity 856 - values: 857 - | 858 # 859 fmovi v1, 0xff800000 # Negative infinity 860 - values: 861 - | 862 # 863 fmovi v1, 0x7fc00000 # NaN 864 - values: 865 - | 866 # 867 fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 868 - values: 869 - | 870 # 871 fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 872 - values: 873 - | 874 # 875 fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 876 - values: 877 - | 878 # 879 fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 880 - values: 881 - | 882 # 883 fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 884 - values: 885 - | 886 # 887 fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 888 - values: 889 - | 890 # 891 fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 892 - values: 893 - | 894 # 895 fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 896 - values: 897 - | 898 # 899 fmovi.64 v1, 0x7ff8000000000000 # NaN 900 901 902 - file-name: "valid_values" 903 isa: 904 description: > 905 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed 906 32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of 907 instruction address. 908 description: Check 'jne' instruction with valid values in registers. 909 header-template: [] 910 code-template: | 911 .function i32 main() { 912 ldai %s 913 movi v1, %s 914 jne v1, lbl 915 ldai %s 916 return 917 lbl: 918 ldai %s 919 check-type: no-check 920 cases: 921 - values: [-2147483648, -2147483648, 0, 1] 922 - values: [-2147483648, -1, 1, 0] 923 - values: [-2147483648, 0, 1, 0] 924 - values: [-2147483648, 1, 1, 0] 925 - values: [-2147483648, 2147483647, 1, 0] 926 927 - values: [-1, -2147483648, 1, 0] 928 - values: [-1, -1, 0, 1] 929 - values: [-1, 0, 1, 0] 930 - values: [-1, 1, 1, 0] 931 - values: [-1, 2147483647, 1, 0] 932 933 - values: [0, -2147483648, 1, 0] 934 - values: [0, -1, 1, 0] 935 - values: [0, 0, 0, 1] 936 - values: [0, 1, 1, 0] 937 - values: [0, 2147483647, 1, 0] 938 939 - values: [1, -2147483648, 1, 0] 940 - values: [1, -1, 1, 0] 941 - values: [1, 0, 1, 0] 942 - values: [1, 1, 0, 1] 943 - values: [1, 2147483647, 1, 0] 944 945 - values: [2147483647, -2147483648, 1, 0] 946 - values: [2147483647, -1, 1, 0] 947 - values: [2147483647, 0, 1, 0] 948 - values: [2147483647, 1, 1, 0] 949 - values: [2147483647, 2147483647, 0, 1] 950 951 952 - file-name: "valid_offset_values" 953 isa: 954 description: > 955 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed 956 32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of 957 instruction address. 958 description: Check 'jne' instruction with valid offset values. 959 header-template: [] 960 code-template: | 961 .function i32 main() { 962 ldai 0xffffffff 963 movi v1, 2 964 %s 965 ldai 1 # 2-byte instruction 966 return # 1-byte instruction 967 quit: 968 check-type: exit-positive 969 cases: 970 - description: Same instruction jump, offset imm8, 0 bytes 971 values: 972 - | 973 # 974 ldai 2 975 lbl: 976 jne v1, lbl 977 ldai 0 978 return 979 tags: [tsan] 980 bugid: ['3828'] 981 - description: Max forward jump for imm8, 3 + 120 + 1 + 3 = 127 bytes 982 values: 983 - | 984 # 985 jne v1, quit # 3-byte instruction 986 movi.64 v0, 0 ##*12 987 neg # 1-byte instruction 988 tags: [tsan] 989 - description: Max backward jump for imm8, 3 + 120 + 2 + 2 + 1 = 128 bytes 990 values: 991 - | 992 # 993 jmp lbl2 994 lbl1: 995 jmp quit # 3-byte instruction 996 movi.64 v0, 0 ##*12 997 ldai 1 # 2-byte instruction 998 ldai 1 # 2-byte instruction 999 return # 1-byte instruction 1000 lbl2: 1001 jne v1, lbl1 1002 - description: Max forward jump for imm16, 32760 + 4 + 3 = 32767 bytes 1003 values: 1004 - | 1005 # 1006 jne v1, quit # 4-byte instruction 1007 movi.64 v0, 0 ##*3276 1008 - description: Beyond max forward jump for imm16, 40000 + 4 + 3 = 40007 bytes. Converted to jne + jmp by compiler. 1009 values: 1010 - | 1011 # 1012 jne v1, quit # 4-byte instruction 1013 movi.64 v0, 0 ##*4000 1014 - description: Max backward jump for imm16, 5 + 32760 + 3 = 32768 bytes 1015 values: 1016 - | 1017 # 1018 jmp lbl2 1019 lbl1: 1020 jmp quit # 5-byte instruction 1021 movi.64 v0, 0 ##*3276 1022 ldai 1 1023 return 1024 lbl2: 1025 jne v1, lbl1 1026 - description: Beyond max backward jump for imm16, 5 + 40000 = 40005 bytes. Converted to jne + jmp by compiler. 1027 values: 1028 - | 1029 # 1030 jmp lbl2 1031 lbl1: 1032 jmp quit # 5-byte instruction 1033 movi.64 v0, 0 ##*4000 1034 ldai 1 1035 return 1036 lbl2: 1037 jne v1, lbl1 1038 - description: Chain of forward jumps 1039 values: 1040 - | 1041 # 1042 jne v1, lbl1 1043 ldai 2 1044 return 1045 lbl1: 1046 jne v1, lbl2 1047 ldai 3 1048 return 1049 lbl2: 1050 jne v1, lbl3 1051 ldai 4 1052 return 1053 lbl3: 1054 jne v1, lbl4 1055 ldai 5 1056 return 1057 lbl4: 1058 jne v1, quit 1059 tags: [tsan] 1060 - description: Chain of backward jumps 1061 values: 1062 - | 1063 # 1064 jmp lbl1 1065 lbl6: 1066 jmp quit 1067 lbl5: 1068 jne v1, lbl6 1069 ldai 5 1070 return 1071 lbl4: 1072 jne v1, lbl5 1073 ldai 4 1074 return 1075 lbl3: 1076 jne v1, lbl4 1077 ldai 3 1078 return 1079 lbl2: 1080 jne v1, lbl3 1081 ldai 2 1082 return 1083 lbl1: 1084 jne v1, lbl2 1085 tags: [tsan] 1086