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 14tests: 15 - file-name: "jeq" 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: jeq 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 'jeq' instruction with invalid 'v' register. 36 header-template: [] 37 code-template: | 38 .function i32 main() { 39 jeq %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 'jeq' 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 jeq %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: jeq v:in:i32, imm:i32 94 acc: in:i32 95 format: [op_v_8_imm_8, op_v_8_imm_16] 96 description: Check 'jeq' instruction with valid 'v' register. 97 header-template: [] 98 code-template: | 99 .function i32 main() { 100 movi %s, 2 101 ldai 2 102 jeq %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: jeq v:in:i32, imm:i32 124 acc: in:i32 125 format: [op_v_8_imm_8, op_v_8_imm_16] 126 description: Check 'jeq' instruction with valid 'a' register. 127 header-template: [] 128 code-template: | 129 .function i32 foo(%s) <static> { 130 ldai %s 131 jeq %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 - 0xffffffff 146 - a0 147 - | 148 # 149 movi v0, 0xffffffff 150 - values: 151 - i16 a0, i32 a1 152 - 0x0000ffff 153 - a1 154 - | 155 # 156 movi v0, 0x00007fff 157 movi v1, 0x0000ffff 158 tags: [tsan] 159 - values: 160 - "#{[*0..255].map do |i| \" i32 a#{i}\" end .join(\",\")}" 161 - 254 162 - a254 163 - "#{[*0..255].map do |i| \" movi v#{i}, #{i}\\n\" end .join}" 164 bugid: ['3855'] 165 - values: 166 - "#{[*0..255].map do |i| \" i32 a#{i}\" end .join(\",\")}" 167 - 255 168 - a255 169 - "#{[*0..255].map do |i| \" movi v#{i}, #{i}\\n\" end .join}" 170 bugid: ['3855'] 171 172 173 - file-name: "uninitialized_regs" 174 isa: 175 verification: 176 - acc_type 177 - v1_type 178 runner-options: ['verifier-failure', 'verifier-debug-config'] 179 tags: [verifier] 180 description: Check 'jeq' instruction with uninitialized registers. 181 header-template: [] 182 code-template: | 183 .function i32 main() { 184 %s 185 jeq v1, lbl 186 ldai 1 187 return 188 lbl: 189 check-type: exit-positive 190 cases: 191 - description: Accumulator is not initialized. 192 values: 193 - movi v1, 1 194 - description: V register is not initialized. 195 values: 196 - ldai 1 197 - description: Accumulator and 'v' register are both not initialized. 198 values: 199 - "" 200 201 202 - file-name: "invalid_branch_target" 203 isa: 204 verification: 205 - branch_target 206 runner-options: [compile-failure] 207 description: Check 'jeq' instruction with invalid branch target. 208 header-template: [] 209 code-template: | 210 .record R {} 211 212 .function void R.ctor(R a0) <ctor> { 213 lbl_ctor: 214 return.void 215 } 216 217 .function void R.cctor() <cctor> { 218 lbl_cctor: 219 return.void 220 } 221 222 .function i32 foo(i32 a0, i32 a1) <static> { 223 lda a0 224 jeq a1, %s 225 return 226 } 227 228 .function i32 bar() <static> { 229 lbl_bar: 230 ldai 1 231 return 232 } 233 234 .function i32 main() { 235 movi v0, 0 236 movi v1, 1 237 call.short foo, v0, v1 238 lbl_main: 239 check-type: exit-positive 240 cases: 241 - values: ["main"] 242 - values: ["foo"] 243 - values: ["bar"] 244 - values: ["baz"] 245 - values: ["R"] 246 - values: ["lbl_main"] 247 - values: ["lbl_bar"] 248 - values: ["lbl_ctor"] 249 - values: ["lbl_cctor"] 250 251 252 - file-name: "prohibited_branch_target" 253 isa: 254 verification: 255 - branch_target 256 runner-options: ['verifier-failure', 'verifier-debug-config'] 257 tags: [verifier] 258 description: Check 'jeq' instruction with prohibited branch target. 259 header-template: [] 260 code-template: | 261 .record E1 {} 262 .record E2 {} 263 264 .function i32 main() { 265 ldai 1 266 movi v0, 1 267 jeq v0, %s 268 269 begin: 270 ldai 0 271 return 272 mid: 273 ldai 1 274 return 275 end: 276 ldai 2 277 return 278 279 catch_E1_begin: 280 ldai 3 281 return 282 catch_E1_mid: 283 ldai 4 284 return 285 catch_E1_end: 286 ldai 5 287 return 288 289 catch_E2_begin: 290 ldai 6 291 return 292 catch_E2_mid: 293 ldai 7 294 return 295 catch_E2_end: 296 297 quit: 298 ldai 8 299 return 300 301 .catch E1, begin, end, catch_E1_begin, catch_E1_end 302 .catch E2, catch_E1_begin, catch_E1_end, catch_E2_begin, catch_E2_end 303 outside: 304 check-type: none 305 cases: 306 - values: ["begin"] 307 runner-options: ['verifier-only', 'verifier-debug-config'] 308 - values: ["mid"] 309 runner-options: ['verifier-only', 'verifier-debug-config'] 310 - values: ["end"] 311 runner-options: ['verifier-only', 'verifier-debug-config'] 312 - values: ["quit"] 313 runner-options: ['verifier-only', 'verifier-debug-config'] 314 - values: ["catch_E1_begin"] 315 - values: ["catch_E1_mid"] 316 - values: ["catch_E1_end"] 317 runner-options: ['verifier-only', 'verifier-debug-config'] 318 - values: ["catch_E2_begin"] 319 - values: ["catch_E2_mid"] 320 - values: ["catch_E2_end"] 321 runner-options: ['verifier-only', 'verifier-debug-config'] 322 - values: ["outside"] 323 324 325 - file-name: "invalid_acc_value" 326 isa: 327 verification: 328 - acc_type 329 runner-options: ['verifier-failure', 'verifier-debug-config'] 330 tags: [verifier] 331 description: Check 'jeq' instruction with invalid accumulator value 332 header-template: [] 333 code-template: | 334 .record panda.Object <external> 335 .record panda.String <external> 336 .record panda.Class <external> 337 .record R {} 338 .function void R.ctor(R a0) <ctor> { 339 return.void 340 } 341 .function i32 main() { 342 %s 343 movi v1, 1 344 jeq v1, ok 345 ldai 1 346 return 347 ok: 348 check-type: exit-positive 349 cases: 350 - values: 351 - lda.null 352 - values: 353 - initobj R.ctor 354 - values: 355 - lda.str "test" 356 - values: 357 - lda.type panda.Object 358 - values: 359 - | 360 # 361 movi v0, 10 362 newarr v0, v0, i32[] 363 lda.obj v0 364 - values: 365 - | 366 # 367 movi v0, 10 368 newarr v0, v0, f64[] 369 lda.obj v0 370 - values: 371 - | 372 # 373 movi v0, 10 374 newarr v0, v0, R[] 375 lda.obj v0 376 - values: 377 - | 378 # 379 movi v0, 10 380 newarr v0, v0, panda.Class[][] 381 lda.obj v0 382 - values: 383 - | 384 # 385 movi v0, 10 386 newarr v0, v0, panda.String[] 387 lda.obj v0 388 - values: 389 - ldai.64 0 390 - values: 391 - ldai.64 1 392 - values: 393 - ldai.64 0x7fffffffffffffff 394 - values: 395 - ldai.64 0xffffffffffffffff 396 - values: 397 - ldai.64 0x8000000000000000 398 - values: 399 - | 400 # 401 fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 402 - values: 403 - | 404 # 405 fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 406 - values: 407 - | 408 # 409 fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 410 - values: 411 - | 412 # 413 fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 414 - values: 415 - | 416 # 417 fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 418 - values: 419 - | 420 # 421 fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 422 - values: 423 - | 424 # 425 fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 426 - values: 427 - | 428 # 429 fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 430 - values: 431 - | 432 # 433 fldai.64 0x7ff8000000000000 # NaN 434 435 436 - file-name: "invalid_v_value" 437 isa: 438 verification: 439 - v1_type 440 runner-options: ['verifier-failure', 'verifier-debug-config'] 441 tags: [verifier] 442 description: Check 'jeq' instruction with invalid v register value 443 header-template: [] 444 code-template: | 445 .record panda.Object <external> 446 .record panda.String <external> 447 .record panda.Class <external> 448 .record R {} 449 .function void R.ctor(R a0) <ctor> { 450 return.void 451 } 452 .function i32 main() { 453 %s 454 ldai 1 455 jeq v1, ok 456 ldai 1 457 return 458 ok: 459 check-type: exit-positive 460 cases: 461 - values: 462 - mov.null v1 463 - values: 464 - | 465 # 466 initobj R.ctor 467 sta.obj v1 468 - values: 469 - | 470 # 471 lda.str "test" 472 sta.obj v1 473 - values: 474 - | 475 # 476 lda.type panda.Object 477 sta.obj v1 478 - values: 479 - | 480 # 481 movi v0, 10 482 newarr v1, v0, i32[] 483 lda.obj v1 484 - values: 485 - | 486 # 487 movi v0, 10 488 newarr v1, v0, f64[] 489 lda.obj v1 490 - values: 491 - | 492 # 493 movi v0, 10 494 newarr v1, v0, R[] 495 lda.obj v1 496 - values: 497 - | 498 # 499 movi v0, 10 500 newarr v1, v0, panda.Class[][] 501 lda.obj v1 502 - values: 503 - | 504 # 505 movi v0, 10 506 newarr v1, v0, panda.String[] 507 lda.obj v1 508 - values: 509 - movi.64 v1, 0 510 - values: 511 - movi.64 v1, 1 512 - values: 513 - movi.64 v1, 0x7fffffffffffffff 514 - values: 515 - movi.64 v1, 0xffffffffffffffff 516 - values: 517 - movi.64 v1, 0x8000000000000000 518 - values: 519 - | 520 # 521 fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 522 - values: 523 - | 524 # 525 fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 526 - values: 527 - | 528 # 529 fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 530 - values: 531 - | 532 # 533 fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 534 - values: 535 - | 536 # 537 fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 538 - values: 539 - | 540 # 541 fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 542 - values: 543 - | 544 # 545 fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 546 - values: 547 - | 548 # 549 fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 550 - values: 551 - | 552 # 553 fmovi.64 v1, 0x7ff8000000000000 # NaN 554 555 556 - file-name: "invalid_both_acc_and_v_value" 557 isa: 558 verification: 559 - v1_type 560 - acc_type 561 runner-options: ['verifier-failure', 'verifier-debug-config'] 562 tags: [verifier] 563 description: Check 'jeq' instruction with invalid accumulator and v register value 564 header-template: [] 565 code-template: | 566 .record panda.Object <external> 567 .record panda.String <external> 568 .record panda.Class <external> 569 .record R {} 570 .function void R.ctor(R a0) <ctor> { 571 return.void 572 } 573 .function i32 main() { 574 *s 575 %s 576 jeq v1, ok 577 ldai 1 578 return 579 ok: 580 check-type: exit-positive 581 template-cases: 582 - values: 583 - lda.null 584 - values: 585 - initobj R.ctor 586 - values: 587 - lda.str "test" 588 - values: 589 - lda.type panda.Object 590 - values: 591 - | 592 # 593 movi v0, 10 594 newarr v0, v0, i32[] 595 lda.obj v0 596 - values: 597 - | 598 # 599 movi v0, 10 600 newarr v0, v0, f64[] 601 lda.obj v0 602 - values: 603 - | 604 # 605 movi v0, 10 606 newarr v0, v0, R[] 607 lda.obj v0 608 - values: 609 - | 610 # 611 movi v0, 10 612 newarr v0, v0, panda.Class[][] 613 lda.obj v0 614 - values: 615 - | 616 # 617 movi v0, 10 618 newarr v0, v0, panda.String[] 619 lda.obj v0 620 - values: 621 - ldai.64 0 622 - values: 623 - ldai.64 1 624 - values: 625 - ldai.64 0x7fffffffffffffff 626 - values: 627 - ldai.64 0xffffffffffffffff 628 - values: 629 - ldai.64 0x8000000000000000 630 - values: 631 - | 632 # 633 fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 634 - values: 635 - | 636 # 637 fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 638 - values: 639 - | 640 # 641 fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 642 - values: 643 - | 644 # 645 fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 646 - values: 647 - | 648 # 649 fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 650 - values: 651 - | 652 # 653 fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 654 - values: 655 - | 656 # 657 fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 658 - values: 659 - | 660 # 661 fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 662 - values: 663 - | 664 # 665 fldai.64 0x7ff8000000000000 # NaN 666 cases: 667 - values: 668 - mov.null v1 669 - values: 670 - | 671 # 672 initobj R.ctor 673 sta.obj v1 674 - values: 675 - | 676 # 677 lda.str "test" 678 sta.obj v1 679 - values: 680 - | 681 # 682 lda.type panda.Object 683 sta.obj v1 684 - values: 685 - | 686 # 687 movi v0, 10 688 newarr v1, v0, i32[] 689 lda.obj v1 690 - values: 691 - | 692 # 693 movi v0, 10 694 newarr v1, v0, f64[] 695 lda.obj v1 696 - values: 697 - | 698 # 699 movi v0, 10 700 newarr v1, v0, R[] 701 lda.obj v1 702 - values: 703 - | 704 # 705 movi v0, 10 706 newarr v1, v0, panda.Class[][] 707 lda.obj v1 708 - values: 709 - | 710 # 711 movi v0, 10 712 newarr v1, v0, panda.String[] 713 lda.obj v1 714 - values: 715 - movi.64 v1, 0 716 - values: 717 - movi.64 v1, 1 718 - values: 719 - movi.64 v1, 0x7fffffffffffffff 720 - values: 721 - movi.64 v1, 0xffffffffffffffff 722 - values: 723 - movi.64 v1, 0x8000000000000000 724 - values: 725 - | 726 # 727 fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 728 - values: 729 - | 730 # 731 fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 732 - values: 733 - | 734 # 735 fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 736 - values: 737 - | 738 # 739 fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 740 - values: 741 - | 742 # 743 fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 744 - values: 745 - | 746 # 747 fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 748 - values: 749 - | 750 # 751 fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 752 - values: 753 - | 754 # 755 fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 756 - values: 757 - | 758 # 759 fmovi.64 v1, 0x7ff8000000000000 # NaN 760 761 762 - file-name: "valid_values" 763 isa: 764 description: > 765 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed 766 32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of 767 instruction address. 768 description: Check 'jeq' instruction with valid values in registers. 769 header-template: [] 770 code-template: | 771 .function i32 main() { 772 ldai %s 773 movi v1, %s 774 jeq v1, lbl 775 ldai %s 776 return 777 lbl: 778 ldai %s 779 check-type: no-check 780 cases: 781 - values: [-2147483648, -2147483648, 1, 0] 782 - values: [-2147483648, -1, 0, 1] 783 - values: [-2147483648, 0, 0, 1] 784 - values: [-2147483648, 1, 0, 1] 785 - values: [-2147483648, 2147483647, 0, 1] 786 787 - values: [-1, -2147483648, 0, 1] 788 - values: [-1, -1, 1, 0] 789 - values: [-1, 0, 0, 1] 790 - values: [-1, 1, 0, 1] 791 - values: [-1, 2147483647, 0, 1] 792 793 - values: [0, -2147483648, 0, 1] 794 - values: [0, -1, 0, 1] 795 - values: [0, 0, 1, 0] 796 - values: [0, 1, 0, 1] 797 - values: [0, 2147483647, 0, 1] 798 799 - values: [1, -2147483648, 0, 1] 800 - values: [1, -1, 0, 1] 801 - values: [1, 0, 0, 1] 802 - values: [1, 1, 1, 0] 803 - values: [1, 2147483647, 0, 1] 804 805 - values: [2147483647, -2147483648, 0, 1] 806 - values: [2147483647, -1, 0, 1] 807 - values: [2147483647, 0, 0, 1] 808 - values: [2147483647, 1, 0, 1] 809 - values: [2147483647, 2147483647, 1, 0] 810 811 812 - file-name: "valid_offset_values" 813 isa: 814 description: > 815 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed 816 32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of 817 instruction address. 818 description: Check 'jeq' instruction with valid offset values. 819 header-template: [] 820 code-template: | 821 .function i32 main() { 822 ldai 2 823 movi v1, 2 824 %s 825 ldai 1 # 2-byte instruction 826 return # 1-byte instruction 827 quit: 828 check-type: exit-positive 829 cases: 830 - description: Same instruction jump, offset imm8, 0 bytes 831 values: 832 - | 833 # 834 ldai 0 835 lbl: 836 jeq v1, lbl 837 ldai 0 838 return 839 tags: [tsan] 840 bugid: ['3828'] 841 - description: Max forward jump for imm8, 3 + 120 + 1 + 3 = 127 bytes 842 values: 843 - | 844 # 845 jeq v1, quit # 3-byte instruction 846 movi.64 v0, 0 ##*12 847 neg # 1-byte instruction 848 tags: [tsan] 849 - description: Max backward jump for imm8, 3 + 120 + 2 + 2 + 1 = 128 bytes 850 values: 851 - | 852 # 853 jmp lbl2 854 lbl1: 855 jmp quit # 3-byte instruction 856 movi.64 v0, 0 ##*12 857 ldai 1 # 2-byte instruction 858 ldai 1 # 2-byte instruction 859 return # 1-byte instruction 860 lbl2: 861 jeq v1, lbl1 862 - description: Max forward jump for imm16, 32760 + 4 + 3 = 32767 bytes 863 values: 864 - | 865 # 866 jeq v1, quit # 4-byte instruction 867 movi.64 v0, 0 ##*3276 868 - description: Beyond max forward jump for imm16, 40000 + 4 + 3 = 40007 bytes. Converted to jeq + jmp by compiler. 869 values: 870 - | 871 # 872 jeq v1, quit # 4-byte instruction 873 movi.64 v0, 0 ##*4000 874 - description: Max backward jump for imm16, 5 + 32760 + 3 = 32768 bytes 875 values: 876 - | 877 # 878 jmp lbl2 879 lbl1: 880 jmp quit # 5-byte instruction 881 movi.64 v0, 0 ##*3276 882 ldai 1 883 return 884 lbl2: 885 jeq v1, lbl1 886 - description: Beyond max backward jump for imm16, 5 + 40000 = 40005 bytes. Converted to jeq + jmp by compiler. 887 values: 888 - | 889 # 890 jmp lbl2 891 lbl1: 892 jmp quit # 5-byte instruction 893 movi.64 v0, 0 ##*4000 894 ldai 1 895 return 896 lbl2: 897 jeq v1, lbl1 898 - description: Chain of forward jumps 899 values: 900 - | 901 # 902 jeq v1, lbl1 903 ldai 2 904 return 905 lbl1: 906 jeq v1, lbl2 907 ldai 3 908 return 909 lbl2: 910 jeq v1, lbl3 911 ldai 4 912 return 913 lbl3: 914 jeq v1, lbl4 915 ldai 5 916 return 917 lbl4: 918 jeq v1, quit 919 tags: [tsan] 920 - description: Chain of backward jumps 921 values: 922 - | 923 # 924 jmp lbl1 925 lbl6: 926 jmp quit 927 lbl5: 928 jeq v1, lbl6 929 ldai 5 930 return 931 lbl4: 932 jeq v1, lbl5 933 ldai 4 934 return 935 lbl3: 936 jeq v1, lbl4 937 ldai 3 938 return 939 lbl2: 940 jeq v1, lbl3 941 ldai 2 942 return 943 lbl1: 944 jeq v1, lbl2 945 tags: [tsan] 946