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: 15 - name: PandaAssembly 16 template: | 17 .language PandaAssembly 18 19tests: 20 - file-name: "jeq.obj" 21 isa: 22 title: Conditional object comparison jump 23 description: > 24 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if 25 object references in accumulator and source register compare as specified. Offset is sign extended to the size of 26 instruction address. 27 exceptions: 28 - x_none 29 verification: 30 - branch_target 31 - acc_obj_or_null 32 - v1_obj_or_null 33 instructions: 34 - sig: jeq.obj v:in:ref, imm:i32 35 acc: in:ref 36 format: [op_v_8_imm_8, op_v_8_imm_16] 37 commands: 38 39 - file-name: "invalid_v_reg" 40 isa: 41 verification: 42 - v1_obj_or_null 43 instructions: 44 - sig: jeq.obj v:in:ref, imm:i32 45 acc: in:ref 46 format: [op_v_8_imm_8, op_v_8_imm_16] 47 runner-options: [compile-failure] 48 description: Check 'jeq.obj' instruction with invalid 'v' register. 49 header-template: [] 50 code-template: | 51 .function i32 main() { 52 jeq.obj %s 53 lbl: 54 check-type: exit-positive 55 cases: 56 - values: ["v256, lbl"] 57 - values: ["v65535, lbl"] 58 - values: ["v65536, lbl"] 59 - values: ["a0, lbl"] 60 - values: ["a256, lbl"] 61 - values: ["a65535, lbl"] 62 - values: ["lbl"] 63 - values: [""] 64 - values: ["}"] 65 - values: ["# v1, lbl"] 66 - values: ["V1, lbl"] 67 68 69 - file-name: "invalid_a_reg" 70 isa: 71 verification: 72 - v1_obj_or_null 73 instructions: 74 - sig: jeq.obj v:in:ref, imm:i32 75 acc: in:ref 76 format: [op_v_8_imm_8, op_v_8_imm_16] 77 runner-options: [compile-failure] 78 description: Check 'jeq.obj' instruction with invalid 'a' register. 79 header-template: [] 80 code-template: | 81 .record R {} 82 .function void foo(R a0, R a1, R a2, R a3, R a4, R a5) <static> { 83 jeq.obj %s 84 lbl: 85 return.void 86 } 87 .function i32 main() { 88 call.range foo, v0 89 check-type: exit-positive 90 cases: 91 - values: ["v256, lbl"] 92 - values: ["v65535, lbl"] 93 - values: ["v65536, lbl"] 94 - values: ["a6, lbl"] 95 - values: ["a256, lbl"] 96 - values: ["a65535, lbl"] 97 - values: ["lbl"] 98 - values: [""] 99 - values: ["}"] 100 - values: ["# v1, lbl"] 101 - values: ["V1, lbl"] 102 103 104 - file-name: "valid_v_reg" 105 isa: 106 verification: 107 - v1_obj_or_null 108 instructions: 109 - sig: jeq.obj v:in:ref, imm:i32 110 acc: in:ref 111 format: [op_v_8_imm_8, op_v_8_imm_16] 112 description: Check 'jeq.obj' instruction with valid 'v' register. 113 header-template: [] 114 code-template: | 115 .function i32 main() { 116 mov.null %s 117 lda.null 118 jeq.obj %s, lbl 119 ldai 1 120 return 121 lbl: 122 check-type: exit-positive 123 cases: 124 - values: ["v0", "v0"] 125 - values: ["v7", "v7"] 126 - values: ["v8", "v8"] 127 - values: ["v15", "v15"] 128 - values: ["v16", "v16"] 129 - values: ["v254", "v254"] 130 - values: ["v255", "v255"] 131 tags: [tsan] 132 133 134 - file-name: "valid_a_reg" 135 isa: 136 verification: 137 - v1_obj_or_null 138 instructions: 139 - sig: jeq.obj v:in:ref, imm:i32 140 acc: in:ref 141 format: [op_v_8_imm_8, op_v_8_imm_16] 142 description: Check 'jeq.obj' instruction with valid 'a' register. 143 header-template: [] 144 code-template: | 145 .record R {} 146 .function void R.ctor(R a0) <ctor> { 147 return.void 148 } 149 .function i32 foo(%s) <static> { 150 lda.obj a0 151 jeq.obj %s, lbl 152 ldai 1 153 return 154 lbl: 155 ldai 0 156 return 157 } 158 .function i32 main() { 159 initobj R.ctor 160 %s 161 call.range foo, v0 162 check-type: no-check 163 cases: 164 - values: 165 - R a0 166 - a0 167 - | 168 # 169 sta.obj v0 170 - values: 171 - R a0, R a1 172 - a1 173 - | 174 # 175 sta.obj v0 176 sta.obj v1 177 tags: [tsan] 178 - values: 179 - "#{[*0..255].map do |i| \" R a#{i}\" end .join(\",\")}" 180 - a254 181 - "#{[*0..255].map do |i| \" sta.obj v#{i}\\n\" end .join}" 182 bugid: ['3855'] 183 - values: 184 - "#{[*0..255].map do |i| \" R a#{i}\" end .join(\",\")}" 185 - a255 186 - "#{[*0..255].map do |i| \" sta.obj v#{i}\\n\" end .join}" 187 bugid: ['3855'] 188 189 190 - file-name: "uninitialized_regs" 191 isa: 192 verification: 193 - acc_obj_or_null 194 - v1_obj_or_null 195 runner-options: ['verifier-failure', 'verifier-config'] 196 tags: [verifier] 197 description: Check 'jeq.obj' instruction with uninitialized registers. 198 header-template: [] 199 code-template: | 200 .function i32 main() { 201 %s 202 jeq.obj v1, lbl 203 ldai 1 204 return 205 lbl: 206 check-type: exit-positive 207 cases: 208 - description: Accumulator is not initialized. 209 values: 210 - mov.null v1 211 - description: V register is not initialized. 212 values: 213 - lda.null 214 - description: Accumulator and 'v' register are both not initialized. 215 values: 216 - "" 217 218 219 - file-name: "invalid_branch_target" 220 isa: 221 verification: 222 - branch_target 223 runner-options: [compile-failure] 224 description: Check 'jeq.obj' instruction with invalid branch target. 225 header-template: [] 226 code-template: | 227 .record R {} 228 229 .function void R.ctor(R a0) <ctor> { 230 lbl_ctor: 231 return.void 232 } 233 234 .function void R.cctor() <cctor> { 235 lbl_cctor: 236 return.void 237 } 238 239 .function i32 foo() <static> { 240 lda.obj a0 241 jeq.obj a1, %s 242 } 243 244 .function i32 bar() <static> { 245 lbl_bar: 246 ldai 1 247 return 248 } 249 250 .function i32 main() { 251 call.short foo 252 lbl_main: 253 check-type: exit-positive 254 cases: 255 - values: ["main"] 256 - values: ["foo"] 257 - values: ["bar"] 258 - values: ["baz"] 259 - values: ["R"] 260 - values: ["lbl_main"] 261 - values: ["lbl_bar"] 262 - values: ["lbl_ctor"] 263 - values: ["lbl_cctor"] 264 265 266 - file-name: "prohibited_branch_target_p" 267 isa: 268 verification: 269 - branch_target 270 runner-options: ['verifier-failure', 'verifier-config'] 271 tags: [verifier] 272 description: Check 'jeq.obj' instruction with prohibited branch target in PandaAssembly context. 273 header-template: [] 274 code-template: | 275 .record E1 {} 276 .record E2 {} 277 .record R {} 278 279 .function void R.ctor(R a0) <ctor> { 280 return.void 281 } 282 283 .function i32 main() { 284 initobj R.ctor 285 sta.obj v0 286 jeq.obj v0, %s 287 288 begin: 289 ldai 0 290 return 291 mid: 292 ldai 1 293 return 294 end: 295 ldai 2 296 return 297 298 catch_E1_begin: 299 ldai 3 300 return 301 catch_E1_mid: 302 ldai 4 303 return 304 catch_E1_end: 305 ldai 5 306 return 307 308 catch_E2_begin: 309 ldai 6 310 return 311 catch_E2_mid: 312 ldai 7 313 return 314 catch_E2_end: 315 316 quit: 317 ldai 8 318 return 319 320 .catch E1, begin, end, catch_E1_begin, catch_E1_end 321 .catch E2, catch_E1_begin, catch_E1_end, catch_E2_begin, catch_E2_end 322 outside: 323 check-type: none 324 cases: 325 - values: ["begin"] 326 runner-options: ['verifier-only', 'verifier-config'] 327 - values: ["mid"] 328 runner-options: ['verifier-only', 'verifier-config'] 329 - values: ["end"] 330 runner-options: ['verifier-only', 'verifier-config'] 331 - values: ["quit"] 332 runner-options: ['verifier-only', 'verifier-config'] 333 - values: ["catch_E1_begin"] 334 - values: ["catch_E1_mid"] 335 - values: ["catch_E1_end"] 336 runner-options: ['verifier-only', 'verifier-config'] 337 - values: ["catch_E2_begin"] 338 - values: ["catch_E2_mid"] 339 - values: ["catch_E2_end"] 340 runner-options: ['verifier-only', 'verifier-config'] 341 - values: ["outside"] 342 343 344 - file-name: "prohibited_branch_target_j" 345 isa: 346 verification: 347 - branch_target 348 runner-options: [verifier-failure, use-pa, verifier-config] 349 tags: [verifier, pa-verifier] 350 description: Check 'jeq.obj' instruction with prohibited branch target in PandaAssembly context. 351 header-template: [PandaAssembly] 352 code-template: | 353 .record panda.NullPointerException <external> 354 .record panda.Exception <external> 355 356 .function i32 main() { 357 lda.str "test" 358 sta.obj v0 359 jeq.obj v0, %s 360 361 begin: 362 ldai 0 363 return 364 mid: 365 ldai 1 366 return 367 end: 368 ldai 2 369 return 370 371 catch_NPE_begin: 372 ldai 3 373 return 374 catch_NPE_mid: 375 ldai 4 376 return 377 catch_NPE_end: 378 ldai 5 379 return 380 381 catch_E_begin: 382 ldai 6 383 return 384 catch_E_mid: 385 ldai 7 386 return 387 catch_E_end: 388 389 quit: 390 ldai 8 391 return 392 393 .catch panda.NullPointerException, begin, end, catch_NPE_begin, catch_NPE_end 394 .catch panda.Exception, catch_NPE_begin, catch_NPE_end, catch_E_begin, catch_E_end 395 outside: 396 check-type: none 397 cases: 398 - values: ["begin"] 399 runner-options: [verifier-only, use-pa, verifier-config] 400 - values: ["mid"] 401 runner-options: [verifier-only, use-pa, verifier-config] 402 - values: ["end"] 403 runner-options: [verifier-only, use-pa, verifier-config] 404 - values: ["quit"] 405 runner-options: [verifier-only, use-pa, verifier-config] 406 - values: ["catch_NPE_begin"] 407 - values: ["catch_NPE_mid"] 408 - values: ["catch_NPE_end"] 409 runner-options: [verifier-only, use-pa, verifier-config] 410 - values: ["catch_E_begin"] 411 - values: ["catch_E_mid"] 412 - values: ["catch_E_end"] 413 runner-options: [verifier-only, use-pa, verifier-config] 414 - values: ["outside"] 415 416 417 - file-name: "invalid_acc_value" 418 isa: 419 verification: 420 - acc_obj_or_null 421 runner-options: ['verifier-failure', 'verifier-config'] 422 tags: [verifier] 423 description: Check 'jeq.obj' instruction with invalid accumulator value 424 header-template: [] 425 code-template: | 426 .record R {} 427 .function void R.ctor(R a0) <ctor> { 428 return.void 429 } 430 .function i32 main() { 431 %s 432 *s 433 jeq.obj v1, ok 434 ldai 1 435 return 436 ok: 437 check-type: exit-positive 438 template-cases: 439 - values: 440 - | 441 # 442 initobj R.ctor 443 sta.obj v1 444 - values: 445 - mov.null v1 446 cases: 447 - values: 448 - ldai 0 449 - values: 450 - ldai 1 451 - values: 452 - ldai 0x7fffffff 453 - values: 454 - ldai 0xffffffff 455 - values: 456 - ldai 0x80000000 457 - values: 458 - ldai.64 0 459 - values: 460 - ldai.64 1 461 - values: 462 - ldai.64 0x7fffffffffffffff 463 - values: 464 - ldai.64 0xffffffffffffffff 465 - values: 466 - ldai.64 0x8000000000000000 467 - values: 468 - | 469 # 470 fldai 0x00000000 # Positive zero (+0.0) 471 - values: 472 - | 473 # 474 fldai 0x80000000 # Negative zero (-0.0) 475 - values: 476 - | 477 # 478 fldai 0x00000001 # Minimal positive value (1.4012985e-45) 479 - values: 480 - | 481 # 482 fldai 0x80000001 # Maximal negative value (-1.4012985e-45) 483 - values: 484 - | 485 # 486 fldai 0x7f7fffff # Maximal positive value (3.4028235e38) 487 - values: 488 - | 489 # 490 fldai 0xff7fffff # Minimal negative value (-3.4028235e38) 491 - values: 492 - | 493 # 494 fldai 0x7f800000 # Positive infinity 495 - values: 496 - | 497 # 498 fldai 0xff800000 # Negative infinity 499 - values: 500 - | 501 # 502 fldai 0x7fc00000 # NaN 503 - values: 504 - | 505 # 506 fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 507 - values: 508 - | 509 # 510 fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 511 - values: 512 - | 513 # 514 fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 515 - values: 516 - | 517 # 518 fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 519 - values: 520 - | 521 # 522 fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 523 - values: 524 - | 525 # 526 fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 527 - values: 528 - | 529 # 530 fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 531 - values: 532 - | 533 # 534 fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 535 - values: 536 - | 537 # 538 fldai.64 0x7ff8000000000000 # NaN 539 540 541 - file-name: "invalid_v_value" 542 isa: 543 verification: 544 - v1_obj_or_null 545 runner-options: ['verifier-failure', 'verifier-config'] 546 tags: [verifier] 547 description: Check 'jeq.obj' instruction with invalid v register value 548 header-template: [] 549 code-template: | 550 .record R {} 551 .function void R.ctor(R a0) <ctor> { 552 return.void 553 } 554 .function i32 main() { 555 *s 556 %s 557 jeq.obj v1, ok 558 ldai 1 559 return 560 ok: 561 check-type: exit-positive 562 template-cases: 563 - values: 564 - initobj R.ctor 565 - values: 566 - lda.null 567 cases: 568 - values: 569 - movi v1, 0 570 - values: 571 - movi v1, 1 572 - values: 573 - movi v1, 0x7fffffff 574 - values: 575 - movi v1, 0xffffffff 576 - values: 577 - movi v1, 0x80000000 578 - values: 579 - movi.64 v1, 0 580 - values: 581 - movi.64 v1, 1 582 - values: 583 - movi.64 v1, 0x7fffffffffffffff 584 - values: 585 - movi.64 v1, 0xffffffffffffffff 586 - values: 587 - movi.64 v1, 0x8000000000000000 588 - values: 589 - | 590 # 591 fmovi v1, 0x00000000 # Positive zero (+0.0) 592 - values: 593 - | 594 # 595 fmovi v1, 0x80000000 # Negative zero (-0.0) 596 - values: 597 - | 598 # 599 fmovi v1, 0x00000001 # Minimal positive value (1.4012985e-45) 600 - values: 601 - | 602 # 603 fmovi v1, 0x80000001 # Maximal negative value (-1.4012985e-45) 604 - values: 605 - | 606 # 607 fmovi v1, 0x7f7fffff # Maximal positive value (3.4028235e38) 608 - values: 609 - | 610 # 611 fmovi v1, 0xff7fffff # Minimal negative value (-3.4028235e38) 612 - values: 613 - | 614 # 615 fmovi v1, 0x7f800000 # Positive infinity 616 - values: 617 - | 618 # 619 fmovi v1, 0xff800000 # Negative infinity 620 - values: 621 - | 622 # 623 fmovi v1, 0x7fc00000 # NaN 624 - values: 625 - | 626 # 627 fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 628 - values: 629 - | 630 # 631 fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 632 - values: 633 - | 634 # 635 fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 636 - values: 637 - | 638 # 639 fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 640 - values: 641 - | 642 # 643 fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 644 - values: 645 - | 646 # 647 fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 648 - values: 649 - | 650 # 651 fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 652 - values: 653 - | 654 # 655 fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 656 - values: 657 - | 658 # 659 fmovi.64 v1, 0x7ff8000000000000 # NaN 660 661 662 - file-name: "invalid_both_acc_and_v_value" 663 isa: 664 verification: 665 - v1_obj_or_null 666 - acc_obj_or_null 667 runner-options: ['verifier-failure', 'verifier-config'] 668 tags: [verifier] 669 description: Check 'jeq.obj' instruction with invalid accumulator and v register value 670 header-template: [] 671 code-template: | 672 .record R {} 673 .function void R.ctor(R a0) <ctor> { 674 return.void 675 } 676 .function i32 main() { 677 *s 678 %s 679 jeq.obj v1, ok 680 ldai 1 681 return 682 ok: 683 check-type: exit-positive 684 template-cases: 685 - values: 686 - ldai 0 687 - values: 688 - ldai 1 689 - values: 690 - ldai 0x7fffffff 691 - values: 692 - ldai 0xffffffff 693 - values: 694 - ldai 0x80000000 695 - values: 696 - ldai.64 0 697 - values: 698 - ldai.64 1 699 - values: 700 - ldai.64 0x7fffffffffffffff 701 - values: 702 - ldai.64 0xffffffffffffffff 703 - values: 704 - ldai.64 0x8000000000000000 705 - values: 706 - | 707 # 708 fldai 0x00000000 # Positive zero (+0.0) 709 - values: 710 - | 711 # 712 fldai 0x80000000 # Negative zero (-0.0) 713 - values: 714 - | 715 # 716 fldai 0x00000001 # Minimal positive value (1.4012985e-45) 717 - values: 718 - | 719 # 720 fldai 0x80000001 # Maximal negative value (-1.4012985e-45) 721 - values: 722 - | 723 # 724 fldai 0x7f7fffff # Maximal positive value (3.4028235e38) 725 - values: 726 - | 727 # 728 fldai 0xff7fffff # Minimal negative value (-3.4028235e38) 729 - values: 730 - | 731 # 732 fldai 0x7f800000 # Positive infinity 733 - values: 734 - | 735 # 736 fldai 0xff800000 # Negative infinity 737 - values: 738 - | 739 # 740 fldai 0x7fc00000 # NaN 741 - values: 742 - | 743 # 744 fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 745 - values: 746 - | 747 # 748 fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 749 - values: 750 - | 751 # 752 fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 753 - values: 754 - | 755 # 756 fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 757 - values: 758 - | 759 # 760 fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 761 - values: 762 - | 763 # 764 fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 765 - values: 766 - | 767 # 768 fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 769 - values: 770 - | 771 # 772 fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 773 - values: 774 - | 775 # 776 fldai.64 0x7ff8000000000000 # NaN 777 cases: 778 - values: 779 - movi v1, 0 780 - values: 781 - movi v1, 1 782 - values: 783 - movi v1, 0x7fffffff 784 - values: 785 - movi v1, 0xffffffff 786 - values: 787 - movi v1, 0x80000000 788 - values: 789 - movi.64 v1, 0 790 - values: 791 - movi.64 v1, 1 792 - values: 793 - movi.64 v1, 0x7fffffffffffffff 794 - values: 795 - movi.64 v1, 0xffffffffffffffff 796 - values: 797 - movi.64 v1, 0x8000000000000000 798 - values: 799 - | 800 # 801 fmovi v1, 0x00000000 # Positive zero (+0.0) 802 - values: 803 - | 804 # 805 fmovi v1, 0x80000000 # Negative zero (-0.0) 806 - values: 807 - | 808 # 809 fmovi v1, 0x00000001 # Minimal positive value (1.4012985e-45) 810 - values: 811 - | 812 # 813 fmovi v1, 0x80000001 # Maximal negative value (-1.4012985e-45) 814 - values: 815 - | 816 # 817 fmovi v1, 0x7f7fffff # Maximal positive value (3.4028235e38) 818 - values: 819 - | 820 # 821 fmovi v1, 0xff7fffff # Minimal negative value (-3.4028235e38) 822 - values: 823 - | 824 # 825 fmovi v1, 0x7f800000 # Positive infinity 826 - values: 827 - | 828 # 829 fmovi v1, 0xff800000 # Negative infinity 830 - values: 831 - | 832 # 833 fmovi v1, 0x7fc00000 # NaN 834 - values: 835 - | 836 # 837 fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`) 838 - values: 839 - | 840 # 841 fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`) 842 - values: 843 - | 844 # 845 fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`) 846 - values: 847 - | 848 # 849 fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`) 850 - values: 851 - | 852 # 853 fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`) 854 - values: 855 - | 856 # 857 fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`) 858 - values: 859 - | 860 # 861 fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`) 862 - values: 863 - | 864 # 865 fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`) 866 - values: 867 - | 868 # 869 fmovi.64 v1, 0x7ff8000000000000 # NaN 870 871 872 - file-name: "valid_equal_values_p" 873 isa: 874 description: > 875 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if 876 object references in accumulator and source register compare as specified. Offset is sign extended to the size of 877 instruction address. 878 description: Check 'jeq.obj' instruction with valid equal values in PandaAssembly context. 879 header-template: [] 880 code-template: | 881 .record panda.String <external> 882 .record panda.Class <external> 883 .record panda.Object <external> 884 .record R {} 885 .function void R.ctor(R a0) <ctor> { 886 return.void 887 } 888 .function i32 main() { 889 %s 890 jeq.obj v1, ok 891 ldai 1 892 return 893 ok: 894 check-type: exit-positive 895 cases: 896 - values: 897 - | 898 # 899 mov.null v1 900 lda.null 901 - values: 902 - | 903 # 904 initobj R.ctor 905 sta.obj v1 906 - values: 907 - | 908 # 909 lda.str "test" 910 sta.obj v1 911 lda.str "test" 912 tags: [tsan] 913 - values: 914 - | 915 # 916 lda.type R 917 sta.obj v1 918 lda.type R 919 - values: 920 - | 921 # 922 movi v1, 10 923 newarr v1, v1, R[] 924 lda.obj v1 925 - values: 926 - | 927 # 928 movi v1, 10 929 newarr v1, v1, panda.String[] 930 lda.obj v1 931 - values: 932 - | 933 # 934 movi v1, 10 935 newarr v1, v1, panda.Class[] 936 lda.obj v1 937 - values: 938 - | 939 # 940 movi v1, 10 941 newarr v1, v1, panda.Object[][] 942 lda.obj v1 943 tags: [tsan] 944 945 946 - file-name: "valid_equal_values_j" 947 isa: 948 description: > 949 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if 950 object references in accumulator and source register compare as specified. Offset is sign extended to the size of 951 instruction address. 952 description: Check 'jeq.obj' instruction with valid equal values in PandaAssembly context. 953 runner-options: [use-pa] 954 header-template: [PandaAssembly] 955 code-template: | 956 .record panda.String <external> 957 .record panda.Class <external> 958 .record panda.Object <external> 959 .record R {} 960 .function void R.ctor(R a0) <ctor> { 961 return.void 962 } 963 .function i32 main() { 964 %s 965 jeq.obj v1, ok 966 ldai 1 967 return 968 ok: 969 check-type: exit-positive 970 cases: 971 - values: 972 - | 973 # 974 mov.null v1 975 lda.null 976 - values: 977 - | 978 # 979 initobj R.ctor 980 sta.obj v1 981 - values: 982 - | 983 # 984 lda.str "test" 985 sta.obj v1 986 lda.str "test" 987 - values: 988 - | 989 # 990 lda.type R 991 sta.obj v1 992 lda.type R 993 tags: [tsan] 994 - values: 995 - | 996 # 997 movi v1, 10 998 newarr v1, v1, R[] 999 lda.obj v1 1000 - values: 1001 - | 1002 # 1003 movi v1, 10 1004 newarr v1, v1, panda.String[] 1005 lda.obj v1 1006 - values: 1007 - | 1008 # 1009 movi v1, 10 1010 newarr v1, v1, panda.Class[] 1011 lda.obj v1 1012 tags: [tsan] 1013 - values: 1014 - | 1015 # 1016 movi v1, 10 1017 newarr v1, v1, panda.Object[][] 1018 lda.obj v1 1019 1020 1021 - file-name: "valid_not_equal_values_p" 1022 isa: 1023 description: > 1024 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if 1025 object references in accumulator and source register compare as specified. Offset is sign extended to the size of 1026 instruction address. 1027 description: Check 'jeq.obj' instruction with valid not equal values in PandaAssembly context. 1028 header-template: [] 1029 code-template: | 1030 .record panda.String <external> 1031 .record panda.Class <external> 1032 .record panda.Object <external> 1033 .record R {} 1034 .function void R.ctor(R a0) <ctor> { 1035 return.void 1036 } 1037 .function i32 main() { 1038 # set v1 register 1039 *s 1040 # set accumulator 1041 %s 1042 jeq.obj v1, eq 1043 ldai 0 1044 return 1045 eq: 1046 ldai 1 1047 return 1048 check-type: none 1049 template-cases: 1050 - values: 1051 - lda.null 1052 exclude: [nul] 1053 - values: 1054 - initobj R.ctor 1055 - values: 1056 - lda.str "test1" 1057 exclude: [str1] 1058 - values: 1059 - lda.str "test2" 1060 exclude: [str2] 1061 - values: 1062 - lda.type R 1063 exclude: [tr] 1064 - values: 1065 - lda.type panda.Object 1066 exclude: [to] 1067 - values: 1068 - | 1069 # 1070 movi v2, 10 1071 newarr v2, v2, R[] 1072 lda.obj v2 1073 - values: 1074 - | 1075 # 1076 movi v2, 10 1077 newarr v2, v2, R[][] 1078 lda.obj v2 1079 - values: 1080 - | 1081 # 1082 movi v2, 10 1083 newarr v2, v2, panda.String[][][] 1084 lda.obj v2 1085 cases: 1086 - values: 1087 - mov.null v1 1088 id: nul 1089 - values: 1090 - | 1091 # 1092 initobj R.ctor 1093 sta.obj v1 1094 - values: 1095 - | 1096 # 1097 lda.str "test1" 1098 sta.obj v1 1099 id: str1 1100 - values: 1101 - | 1102 # 1103 lda.str "test2" 1104 sta.obj v1 1105 id: str2 1106 - values: 1107 - | 1108 # 1109 lda.type R 1110 sta.obj v1 1111 id: tr 1112 - values: 1113 - | 1114 # 1115 lda.type panda.Object 1116 sta.obj v1 1117 id: to 1118 - values: 1119 - | 1120 # 1121 movi v2, 10 1122 newarr v1, v2, R[] 1123 - values: 1124 - | 1125 # 1126 movi v2, 10 1127 newarr v1, v2, R[][] 1128 - values: 1129 - | 1130 # 1131 movi v2, 10 1132 newarr v1, v2, panda.String[][][] 1133 1134 1135 - file-name: "valid_not_equal_values_j" 1136 isa: 1137 description: > 1138 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if 1139 object references in accumulator and source register compare as specified. Offset is sign extended to the size of 1140 instruction address. 1141 description: Check 'jeq.obj' instruction with valid not equal values in PandaAssembly context. 1142 runner-options: [use-pa] 1143 header-template: [] 1144 code-template: | 1145 .language PandaAssembly 1146 .record panda.String <external> 1147 .record panda.Class <external> 1148 .record panda.Object <external> 1149 .record R {} 1150 .function void R.ctor(R a0) <ctor> { 1151 return.void 1152 } 1153 .function i32 main() { 1154 # set v1 register 1155 *s 1156 # set accumulator 1157 %s 1158 jeq.obj v1, eq 1159 ldai 0 1160 return 1161 eq: 1162 ldai 1 1163 return 1164 check-type: none 1165 template-cases: 1166 - values: 1167 - lda.null 1168 exclude: [nul] 1169 - values: 1170 - initobj R.ctor 1171 - values: 1172 - lda.str "test1" 1173 exclude: [str1] 1174 - values: 1175 - lda.str "test2" 1176 exclude: [str2] 1177 - values: 1178 - lda.type R 1179 exclude: [tr] 1180 - values: 1181 - lda.type panda.Object 1182 exclude: [to] 1183 - values: 1184 - | 1185 # 1186 movi v2, 10 1187 newarr v2, v2, R[] 1188 lda.obj v2 1189 - values: 1190 - | 1191 # 1192 movi v2, 10 1193 newarr v2, v2, R[][] 1194 lda.obj v2 1195 - values: 1196 - | 1197 # 1198 movi v2, 10 1199 newarr v2, v2, panda.String[][][] 1200 lda.obj v2 1201 cases: 1202 - values: 1203 - mov.null v1 1204 id: nul 1205 - values: 1206 - | 1207 # 1208 initobj R.ctor 1209 sta.obj v1 1210 - values: 1211 - | 1212 # 1213 lda.str "test1" 1214 sta.obj v1 1215 id: str1 1216 - values: 1217 - | 1218 # 1219 lda.str "test2" 1220 sta.obj v1 1221 id: str2 1222 - values: 1223 - | 1224 # 1225 lda.type R 1226 sta.obj v1 1227 id: tr 1228 - values: 1229 - | 1230 # 1231 lda.type panda.Object 1232 sta.obj v1 1233 id: to 1234 - values: 1235 - | 1236 # 1237 movi v2, 10 1238 newarr v1, v2, R[] 1239 - values: 1240 - | 1241 # 1242 movi v2, 10 1243 newarr v1, v2, R[][] 1244 - values: 1245 - | 1246 # 1247 movi v2, 10 1248 newarr v1, v2, panda.String[][][] 1249 1250 1251 - file-name: "valid_offset_values" 1252 isa: 1253 description: > 1254 Transfer execution to an instruction at offset bytes from the beginning of the current instruction if 1255 object references in accumulator and source register compare as specified. Offset is sign extended to the size of 1256 instruction address. 1257 description: Check 'jeq.obj' instruction with valid offset values. 1258 header-template: [] 1259 code-template: | 1260 .record R {} 1261 .function void R.ctor(R a0) <ctor> { 1262 return.void 1263 } 1264 .function i32 main() { 1265 lda.null 1266 sta.obj v1 1267 %s 1268 ldai 1 # 2-byte instruction 1269 return # 1-byte instruction 1270 quit: 1271 check-type: exit-positive 1272 cases: 1273 - description: Same instruction jump, offset imm8, 0 bytes 1274 values: 1275 - | 1276 # 1277 initobj R.ctor 1278 lbl: 1279 jeq.obj v1, lbl 1280 ldai 0 1281 return 1282 tags: [tsan] 1283 - description: Max forward jump for imm8, 3 + 110 + 10 + 1 + 3 = 127 bytes 1284 values: 1285 - | 1286 # 1287 jeq.obj v1, quit # 3-byte instruction 1288 movi.64 v0, 0 ##*11 1289 ldai 1 # 2-byte instruction 1290 ldai 1 # 2-byte instruction 1291 ldai 1 # 2-byte instruction 1292 ldai 1 # 2-byte instruction 1293 ldai 1 # 2-byte instruction 1294 return # 1-byte instruction 1295 tags: [tsan] 1296 - description: Max backward jump for imm8, 3 + 120 + 2 + 2 + 1 = 128 bytes 1297 values: 1298 - | 1299 # 1300 jmp lbl2 1301 lbl1: 1302 jmp quit # 3-byte instruction 1303 movi.64 v0, 0 ##*12 1304 ldai 1 # 2-byte instruction 1305 ldai 1 # 2-byte instruction 1306 return # 1-byte instruction 1307 lbl2: 1308 jeq.obj v1, lbl1 1309 - description: Max forward jump for imm16, 32760 + 4 + 3 = 32767 bytes 1310 values: 1311 - | 1312 # 1313 jeq.obj v1, quit # 4-byte instruction 1314 movi.64 v0, 0 ##*3276 1315 - description: Beyond max forward jump for imm16, 40000 + 4 + 3 = 40007 bytes. Converted to jne.obj + jmp by compiler. 1316 values: 1317 - | 1318 # 1319 jeq.obj v1, quit # 4-byte instruction 1320 movi.64 v0, 0 ##*4000 1321 - description: Max backward jump for imm16, 5 + 32760 + 3 = 32768 bytes 1322 values: 1323 - | 1324 # 1325 jmp lbl2 1326 lbl1: 1327 jmp quit # 5-byte instruction 1328 movi.64 v0, 0 ##*3276 1329 lda.null ##*3 1330 lbl2: 1331 jeq.obj v1, lbl1 1332 - description: Beyond max backward jump for imm16, 5 + 40000 = 40005 bytes. Converted to jne.obj + jmp by compiler. 1333 values: 1334 - | 1335 # 1336 jmp lbl2 1337 lbl1: 1338 jmp quit # 5-byte instruction 1339 movi.64 v0, 0 ##*4000 1340 lbl2: 1341 jeq.obj v1, lbl1 1342 - description: Chain of forward jumps 1343 values: 1344 - | 1345 # 1346 jeq.obj v1, lbl1 1347 ldai 2 1348 return 1349 lbl1: 1350 jeq.obj v1, lbl2 1351 ldai 3 1352 return 1353 lbl2: 1354 jeq.obj v1, lbl3 1355 ldai 4 1356 return 1357 lbl3: 1358 jeq.obj v1, lbl4 1359 ldai 5 1360 return 1361 lbl4: 1362 jeq.obj v1, quit 1363 tags: [tsan] 1364 - description: Chain of backward jumps 1365 values: 1366 - | 1367 # 1368 jmp lbl1 1369 lbl6: 1370 jmp quit 1371 lbl5: 1372 jeq.obj v1, lbl6 1373 ldai 5 1374 return 1375 lbl4: 1376 jeq.obj v1, lbl5 1377 ldai 4 1378 return 1379 lbl3: 1380 jeq.obj v1, lbl4 1381 ldai 3 1382 return 1383 lbl2: 1384 jeq.obj v1, lbl3 1385 ldai 2 1386 return 1387 lbl1: 1388 jeq.obj v1, lbl2 1389 tags: [tsan] 1390