• 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
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-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-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-config']
308          - values: ["mid"]
309            runner-options: ['verifier-only', 'verifier-config']
310          - values: ["end"]
311            runner-options: ['verifier-only', 'verifier-config']
312          - values: ["quit"]
313            runner-options: ['verifier-only', 'verifier-config']
314          - values: ["catch_E1_begin"]
315          - values: ["catch_E1_mid"]
316          - values: ["catch_E1_end"]
317            runner-options: ['verifier-only', 'verifier-config']
318          - values: ["catch_E2_begin"]
319          - values: ["catch_E2_mid"]
320          - values: ["catch_E2_end"]
321            runner-options: ['verifier-only', 'verifier-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-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 0x00000000 # Positive zero (+0.0)
402          - values:
403            - |
404              #
405                  fldai 0x80000000 # Negative zero (-0.0)
406          - values:
407            - |
408              #
409                  fldai 0x00000001 # Minimal positive value (1.4012985e-45)
410          - values:
411            - |
412              #
413                  fldai 0x80000001 # Maximal negative value (-1.4012985e-45)
414          - values:
415            - |
416              #
417                  fldai 0x7f7fffff # Maximal positive value (3.4028235e38)
418          - values:
419            - |
420              #
421                  fldai 0xff7fffff # Minimal negative value (-3.4028235e38)
422          - values:
423            - |
424              #
425                  fldai 0x7f800000 # Positive infinity
426          - values:
427            - |
428              #
429                  fldai 0xff800000 # Negative infinity
430          - values:
431            - |
432              #
433                  fldai 0x7fc00000 # NaN
434          - values:
435            - |
436              #
437                  fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
438          - values:
439            - |
440              #
441                  fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
442          - values:
443            - |
444              #
445                  fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
446          - values:
447            - |
448              #
449                  fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
450          - values:
451            - |
452              #
453                  fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
454          - values:
455            - |
456              #
457                  fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
458          - values:
459            - |
460              #
461                  fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
462          - values:
463            - |
464              #
465                  fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
466          - values:
467            - |
468              #
469                  fldai.64 0x7ff8000000000000 # NaN
470
471
472      - file-name: "invalid_v_value"
473        isa:
474          verification:
475            - v1_type
476        runner-options: ['verifier-failure', 'verifier-config']
477        tags: [verifier]
478        description: Check 'jeq' instruction with invalid v register value
479        header-template: []
480        code-template: |
481            .record panda.Object <external>
482            .record panda.String <external>
483            .record panda.Class <external>
484            .record R {}
485            .function void R.ctor(R a0) <ctor> {
486                return.void
487            }
488            .function i32 main() {
489                %s
490                ldai 1
491                jeq v1, ok
492                ldai 1
493                return
494            ok:
495        check-type: exit-positive
496        cases:
497          - values:
498            - mov.null v1
499          - values:
500            - |
501              #
502                  initobj R.ctor
503                  sta.obj v1
504          - values:
505            - |
506              #
507                  lda.str "test"
508                  sta.obj v1
509          - values:
510            - |
511              #
512                  lda.type panda.Object
513                  sta.obj v1
514          - values:
515            - |
516              #
517                  movi v0, 10
518                  newarr v1, v0, i32[]
519                  lda.obj v1
520          - values:
521            - |
522              #
523                  movi v0, 10
524                  newarr v1, v0, f64[]
525                  lda.obj v1
526          - values:
527            - |
528              #
529                  movi v0, 10
530                  newarr v1, v0, R[]
531                  lda.obj v1
532          - values:
533            - |
534              #
535                  movi v0, 10
536                  newarr v1, v0, panda.Class[][]
537                  lda.obj v1
538          - values:
539            - |
540              #
541                  movi v0, 10
542                  newarr v1, v0, panda.String[]
543                  lda.obj v1
544          - values:
545            - movi.64 v1, 0
546          - values:
547            - movi.64 v1, 1
548          - values:
549            - movi.64 v1, 0x7fffffffffffffff
550          - values:
551            - movi.64 v1, 0xffffffffffffffff
552          - values:
553            - movi.64 v1, 0x8000000000000000
554          - values:
555            - |
556              #
557                  fmovi v1, 0x00000000 # Positive zero (+0.0)
558          - values:
559            - |
560              #
561                  fmovi v1, 0x80000000 # Negative zero (-0.0)
562          - values:
563            - |
564              #
565                  fmovi v1, 0x00000001 # Minimal positive value (1.4012985e-45)
566          - values:
567            - |
568              #
569                  fmovi v1, 0x80000001 # Maximal negative value (-1.4012985e-45)
570          - values:
571            - |
572              #
573                  fmovi v1, 0x7f7fffff # Maximal positive value (3.4028235e38)
574          - values:
575            - |
576              #
577                  fmovi v1, 0xff7fffff # Minimal negative value (-3.4028235e38)
578          - values:
579            - |
580              #
581                  fmovi v1, 0x7f800000 # Positive infinity
582          - values:
583            - |
584              #
585                  fmovi v1, 0xff800000 # Negative infinity
586          - values:
587            - |
588              #
589                  fmovi v1, 0x7fc00000 # NaN
590          - values:
591            - |
592              #
593                  fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
594          - values:
595            - |
596              #
597                  fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
598          - values:
599            - |
600              #
601                  fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
602          - values:
603            - |
604              #
605                  fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
606          - values:
607            - |
608              #
609                  fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
610          - values:
611            - |
612              #
613                  fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
614          - values:
615            - |
616              #
617                  fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
618          - values:
619            - |
620              #
621                  fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
622          - values:
623            - |
624              #
625                  fmovi.64 v1, 0x7ff8000000000000 # NaN
626
627
628      - file-name: "invalid_both_acc_and_v_value"
629        isa:
630          verification:
631            - v1_type
632            - acc_type
633        runner-options: ['verifier-failure', 'verifier-config']
634        tags: [verifier]
635        description: Check 'jeq' instruction with invalid accumulator and v register value
636        header-template: []
637        code-template: |
638            .record panda.Object <external>
639            .record panda.String <external>
640            .record panda.Class <external>
641            .record R {}
642            .function void R.ctor(R a0) <ctor> {
643                return.void
644            }
645            .function i32 main() {
646                *s
647                %s
648                jeq v1, ok
649                ldai 1
650                return
651            ok:
652        check-type: exit-positive
653        template-cases:
654          - values:
655            - lda.null
656          - values:
657            - initobj R.ctor
658          - values:
659            - lda.str "test"
660          - values:
661            - lda.type panda.Object
662          - values:
663            - |
664              #
665                  movi v0, 10
666                  newarr v0, v0, i32[]
667                  lda.obj v0
668          - values:
669            - |
670              #
671                  movi v0, 10
672                  newarr v0, v0, f64[]
673                  lda.obj v0
674          - values:
675            - |
676              #
677                  movi v0, 10
678                  newarr v0, v0, R[]
679                  lda.obj v0
680          - values:
681            - |
682              #
683                  movi v0, 10
684                  newarr v0, v0, panda.Class[][]
685                  lda.obj v0
686          - values:
687            - |
688              #
689                  movi v0, 10
690                  newarr v0, v0, panda.String[]
691                  lda.obj v0
692          - values:
693            - ldai.64 0
694          - values:
695            - ldai.64 1
696          - values:
697            - ldai.64 0x7fffffffffffffff
698          - values:
699            - ldai.64 0xffffffffffffffff
700          - values:
701            - ldai.64 0x8000000000000000
702          - values:
703            - |
704              #
705                  fldai 0x00000000 # Positive zero (+0.0)
706          - values:
707            - |
708              #
709                  fldai 0x80000000 # Negative zero (-0.0)
710          - values:
711            - |
712              #
713                  fldai 0x00000001 # Minimal positive value (1.4012985e-45)
714          - values:
715            - |
716              #
717                  fldai 0x80000001 # Maximal negative value (-1.4012985e-45)
718          - values:
719            - |
720              #
721                  fldai 0x7f7fffff # Maximal positive value (3.4028235e38)
722          - values:
723            - |
724              #
725                  fldai 0xff7fffff # Minimal negative value (-3.4028235e38)
726          - values:
727            - |
728              #
729                  fldai 0x7f800000 # Positive infinity
730          - values:
731            - |
732              #
733                  fldai 0xff800000 # Negative infinity
734          - values:
735            - |
736              #
737                  fldai 0x7fc00000 # NaN
738          - values:
739            - |
740              #
741                  fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
742          - values:
743            - |
744              #
745                  fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
746          - values:
747            - |
748              #
749                  fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
750          - values:
751            - |
752              #
753                  fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
754          - values:
755            - |
756              #
757                  fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
758          - values:
759            - |
760              #
761                  fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
762          - values:
763            - |
764              #
765                  fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
766          - values:
767            - |
768              #
769                  fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
770          - values:
771            - |
772              #
773                  fldai.64 0x7ff8000000000000 # NaN
774        cases:
775          - values:
776            - mov.null v1
777          - values:
778            - |
779              #
780                  initobj R.ctor
781                  sta.obj v1
782          - values:
783            - |
784              #
785                  lda.str "test"
786                  sta.obj v1
787          - values:
788            - |
789              #
790                  lda.type panda.Object
791                  sta.obj v1
792          - values:
793            - |
794              #
795                  movi v0, 10
796                  newarr v1, v0, i32[]
797                  lda.obj v1
798          - values:
799            - |
800              #
801                  movi v0, 10
802                  newarr v1, v0, f64[]
803                  lda.obj v1
804          - values:
805            - |
806              #
807                  movi v0, 10
808                  newarr v1, v0, R[]
809                  lda.obj v1
810          - values:
811            - |
812              #
813                  movi v0, 10
814                  newarr v1, v0, panda.Class[][]
815                  lda.obj v1
816          - values:
817            - |
818              #
819                  movi v0, 10
820                  newarr v1, v0, panda.String[]
821                  lda.obj v1
822          - values:
823            - movi.64 v1, 0
824          - values:
825            - movi.64 v1, 1
826          - values:
827            - movi.64 v1, 0x7fffffffffffffff
828          - values:
829            - movi.64 v1, 0xffffffffffffffff
830          - values:
831            - movi.64 v1, 0x8000000000000000
832          - values:
833            - |
834              #
835                  fmovi v1, 0x00000000 # Positive zero (+0.0)
836          - values:
837            - |
838              #
839                  fmovi v1, 0x80000000 # Negative zero (-0.0)
840          - values:
841            - |
842              #
843                  fmovi v1, 0x00000001 # Minimal positive value (1.4012985e-45)
844          - values:
845            - |
846              #
847                  fmovi v1, 0x80000001 # Maximal negative value (-1.4012985e-45)
848          - values:
849            - |
850              #
851                  fmovi v1, 0x7f7fffff # Maximal positive value (3.4028235e38)
852          - values:
853            - |
854              #
855                  fmovi v1, 0xff7fffff # Minimal negative value (-3.4028235e38)
856          - values:
857            - |
858              #
859                  fmovi v1, 0x7f800000 # Positive infinity
860          - values:
861            - |
862              #
863                  fmovi v1, 0xff800000 # Negative infinity
864          - values:
865            - |
866              #
867                  fmovi v1, 0x7fc00000 # NaN
868          - values:
869            - |
870              #
871                  fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
872          - values:
873            - |
874              #
875                  fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
876          - values:
877            - |
878              #
879                  fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
880          - values:
881            - |
882              #
883                  fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
884          - values:
885            - |
886              #
887                  fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
888          - values:
889            - |
890              #
891                  fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
892          - values:
893            - |
894              #
895                  fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
896          - values:
897            - |
898              #
899                  fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
900          - values:
901            - |
902              #
903                  fmovi.64 v1, 0x7ff8000000000000 # NaN
904
905
906      - file-name: "valid_values"
907        isa:
908          description: >
909            Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed
910            32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of
911            instruction address.
912        description: Check 'jeq' instruction with valid values in registers.
913        header-template: []
914        code-template: |
915            .function i32 main() {
916                ldai %s
917                movi v1, %s
918                jeq v1, lbl
919                ldai %s
920                return
921            lbl:
922                ldai %s
923        check-type: no-check
924        cases:
925          - values: [-2147483648, -2147483648, 1, 0]
926          - values: [-2147483648, -1, 0, 1]
927          - values: [-2147483648, 0, 0, 1]
928          - values: [-2147483648, 1, 0, 1]
929          - values: [-2147483648, 2147483647, 0, 1]
930
931          - values: [-1, -2147483648, 0, 1]
932          - values: [-1, -1, 1, 0]
933          - values: [-1, 0, 0, 1]
934          - values: [-1, 1, 0, 1]
935          - values: [-1, 2147483647, 0, 1]
936
937          - values: [0, -2147483648, 0, 1]
938          - values: [0, -1, 0, 1]
939          - values: [0, 0, 1, 0]
940          - values: [0, 1, 0, 1]
941          - values: [0, 2147483647, 0, 1]
942
943          - values: [1, -2147483648, 0, 1]
944          - values: [1, -1, 0, 1]
945          - values: [1, 0, 0, 1]
946          - values: [1, 1, 1, 0]
947          - values: [1, 2147483647, 0, 1]
948
949          - values: [2147483647, -2147483648, 0, 1]
950          - values: [2147483647, -1, 0, 1]
951          - values: [2147483647, 0, 0, 1]
952          - values: [2147483647, 1, 0, 1]
953          - values: [2147483647, 2147483647, 1, 0]
954
955
956      - file-name: "valid_offset_values"
957        isa:
958          description: >
959            Transfer execution to an instruction at offset bytes from the beginning of the current instruction if signed
960            32-bit integers in accumulator and register compare as specified. Offset is sign extended to the size of
961            instruction address.
962        description: Check 'jeq' instruction with valid offset values.
963        header-template: []
964        code-template: |
965            .function i32 main() {
966                ldai 2
967                movi v1, 2
968                %s
969                ldai 1      # 2-byte instruction
970                return      # 1-byte instruction
971            quit:
972        check-type: exit-positive
973        cases:
974          - description: Same instruction jump, offset imm8, 0 bytes
975            values:
976              - |
977                #
978                    ldai 0
979                lbl:
980                    jeq v1, lbl
981                    ldai 0
982                    return
983            tags: [tsan]
984            bugid: ['3828']
985          - description: Max forward jump for imm8, 3 + 120 + 1 + 3 = 127 bytes
986            values:
987              - |
988                #
989                    jeq v1, quit      # 3-byte instruction
990                    movi.64 v0, 0 ##*12
991                    neg               # 1-byte instruction
992            tags: [tsan]
993          - description: Max backward jump for imm8, 3 + 120 + 2 + 2 + 1 = 128 bytes
994            values:
995              - |
996                #
997                    jmp lbl2
998                lbl1:
999                    jmp quit      # 3-byte instruction
1000                    movi.64 v0, 0 ##*12
1001                    ldai 1        # 2-byte instruction
1002                    ldai 1        # 2-byte instruction
1003                    return        # 1-byte instruction
1004                lbl2:
1005                    jeq v1, lbl1
1006          - description: Max forward jump for imm16, 32760 + 4 + 3 = 32767 bytes
1007            values:
1008              - |
1009                #
1010                    jeq v1, quit      # 4-byte instruction
1011                    movi.64 v0, 0 ##*3276
1012          - description: Beyond max forward jump for imm16, 40000 + 4 + 3 = 40007 bytes. Converted to jeq + jmp by compiler.
1013            values:
1014              - |
1015                #
1016                    jeq v1, quit      # 4-byte instruction
1017                    movi.64 v0, 0 ##*4000
1018          - description: Max backward jump for imm16, 5 + 32760 + 3 = 32768 bytes
1019            values:
1020              - |
1021                #
1022                    jmp lbl2
1023                lbl1:
1024                    jmp quit              # 5-byte instruction
1025                    movi.64 v0, 0 ##*3276
1026                    ldai 1
1027                    return
1028                lbl2:
1029                    jeq v1, lbl1
1030          - description: Beyond max backward jump for imm16, 5 + 40000 = 40005 bytes. Converted to jeq + jmp by compiler.
1031            values:
1032              - |
1033                #
1034                    jmp lbl2
1035                lbl1:
1036                    jmp quit              # 5-byte instruction
1037                    movi.64 v0, 0 ##*4000
1038                    ldai 1
1039                    return
1040                lbl2:
1041                    jeq v1, lbl1
1042          - description: Chain of forward jumps
1043            values:
1044              - |
1045                #
1046                    jeq v1, lbl1
1047                    ldai 2
1048                    return
1049                lbl1:
1050                    jeq v1, lbl2
1051                    ldai 3
1052                    return
1053                lbl2:
1054                    jeq v1, lbl3
1055                    ldai 4
1056                    return
1057                lbl3:
1058                    jeq v1, lbl4
1059                    ldai 5
1060                    return
1061                lbl4:
1062                    jeq v1, quit
1063            tags: [tsan]
1064          - description: Chain of backward jumps
1065            values:
1066              - |
1067                #
1068                    jmp lbl1
1069                lbl6:
1070                    jmp quit
1071                lbl5:
1072                    jeq v1, lbl6
1073                    ldai 5
1074                    return
1075                lbl4:
1076                    jeq v1, lbl5
1077                    ldai 4
1078                    return
1079                lbl3:
1080                    jeq v1, lbl4
1081                    ldai 3
1082                    return
1083                lbl2:
1084                    jeq v1, lbl3
1085                    ldai 2
1086                    return
1087                lbl1:
1088                    jeq v1, lbl2
1089            tags: [tsan]
1090