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