• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14definitions: []
15tests:
16  - file-name: "fmod2.64"
17    isa:
18      title: Two address floating-point binary operation on accumulator
19      description: >
20        Perform specified floating-point binary operation on accumulator and register and store result into accumulator.
21        The results of instructions correspond IEEE-754 arithmetic rules.
22      exceptions:
23        - x_none
24    commands:
25      - file-name: "op_vs_8_nan"
26        isa:
27          instructions:
28            - sig: fmod2.64 v:in:f64
29              acc: inout:f64
30              format: [op_v_8]
31          description: Any operation with NaN results to NaN value.
32        check-type: check-acc-nan
33        code-template: |
34          #
35              fldai.64 %s
36              fmovi.64 v0, *s
37              fmod2.64 v0
38        description: >
39          Check fmod2.64 results in NaN when acc or v0 is NaN
40        template-cases:
41          - values:
42              # NaN
43              - "0x7ff8000000000000"
44          - values:
45              # NaN representation
46              - "0xFFFFFFFFFFFFFFFF"
47          - values:
48              - "0"
49            exclude: [hasval]
50          - values:
51              # Negative zero
52              # -0.0d
53              - "0x8000000000000000"
54            exclude: [hasval]
55          - values:
56              - "1"
57            exclude: [hasval]
58          - values:
59              - "-1"
60            exclude: [hasval]
61          - values:
62              # +Inf
63              - "0x7ff0000000000000"
64            exclude: [hasval]
65          - values:
66              # -Inf
67              - "0xfff0000000000000"
68            exclude: [hasval]
69          - values:
70            # +max
71            - "0x7fefffffffffffff"
72            exclude: [hasval]
73          - values:
74            # -max
75            - "0xffefffffffffffff"
76            exclude: [hasval]
77          - values:
78            # +min
79            - "0x0000000000000001"
80            exclude: [hasval]
81          - values:
82            # -min
83            - "0x8000000000000001"
84            exclude: [hasval]
85          - values:
86              - "3.14159265358979323846"
87            exclude: [hasval]
88          - values:
89              - "1234567890987654321"
90            exclude: [hasval]
91        cases:
92          - values:
93              # NaN
94              - "0x7ff8000000000000"
95          - values:
96              # NaN
97              - "0xFFFFFFFFFFFFFFFF"
98          - values:
99              - "0"
100            id: hasval
101            tags: [aot-fail]
102            bugid: ['3846']
103          - values:
104              # Negative zero
105              # -0.0d
106              - "0x8000000000000000"
107            id: hasval
108            tags: [aot-fail]
109            bugid: ['3846']
110          - values:
111              - "1"
112            id: hasval
113          - values:
114              - "-1"
115            id: hasval
116          - values:
117              # +Inf
118              - "0x7ff0000000000000"
119            id: hasval
120          - values:
121              # -Inf
122              - "0xfff0000000000000"
123            id: hasval
124          - values:
125              # +max
126              - "0x7fefffffffffffff"
127            id: hasval
128          - values:
129              # -max
130              - "0xffefffffffffffff"
131            id: hasval
132          - values:
133              # +min
134              - "0x0000000000000001"
135            id: hasval
136          - values:
137              # -min
138              - "0x8000000000000001"
139            id: hasval
140          - values:
141              - "3.14159265358979323846"
142            id: hasval
143          - values:
144              - "1234567890987654321"
145            id: hasval
146
147      - file-name: "op_vs_8_pinf"
148        isa:
149          instructions:
150            - sig: fmod2.64 v:in:f64
151              acc: inout:f64
152              format: [op_v_8]
153        check-type: check-acc-nan
154        code-template: |
155            #
156                fldai.64 0x7ff0000000000000 # +Inf
157                fmovi.64 v0, %s
158            # Mod of +Inf and value
159                fmod2.64 v0
160        description: Check fmod2.64 with positive Inf and various values (NaN, Inf, min, max, numbers).
161        cases:
162          - values:
163              # NaN
164              - "0x7ff8000000000000"
165          - values:
166              # NaN
167              - "0xFFFFFFFFFFFFFFFF"
168          - values:
169              - "0"
170            tags: [aot-fail]
171            bugid: ['3846']
172          - values:
173              # -0.0
174              - "0x8000000000000000"
175            tags: [aot-fail]
176            bugid: ['3846']
177          - values:
178              - "1"
179          - values:
180             - "-1"
181          - values:
182              # +Inf
183              - "0x7ff0000000000000"
184          - values:
185              # -Inf
186              - "0xfff0000000000000"
187          - values:
188              # +max
189              - "0x7fefffffffffffff"
190          - values:
191              # -max
192              - "0xffefffffffffffff"
193          - values:
194              # +min
195              - "0x0000000000000001"
196          - values:
197              # -min
198              - "0x8000000000000001"
199          - values:
200              - "3.14159265358979323846"
201          - values:
202              - "1234567890987654321"
203
204      - file-name: "op_vs_8_ninf"
205        isa:
206          instructions:
207            - sig: fmod2.64 v:in:f64
208              acc: inout:f64
209              format: [op_v_8]
210        check-type: check-acc-nan
211
212        code-template: |
213            #
214                fldai.64 0xfff0000000000000 # -Inf
215                fmovi.64 v0, %s
216            # Mod of -Inf and value
217                fmod2.64 v0
218        description: Check fmod2.64 with negative Inf and various values (NaN, Inf, min, max, numbers).
219        cases:
220            - values:
221                # NaN
222                - "0x7ff8000000000000"
223            - values:
224                # NaN
225                - "0xFFFFFFFFFFFFFFFF"
226            - values:
227                - "0"
228              tags: [aot-fail]
229              bugid: ['3846']
230            - values:
231                # -0.0d
232                - "0x8000000000000000"
233              tags: [aot-fail]
234              bugid: ['3846']
235            - values:
236                - "1"
237            - values:
238                - "-1"
239            - values:
240                # +Inf
241                - "0x7ff0000000000000"
242            - values:
243                # -Inf
244                - "0xfff0000000000000"
245            - values:
246                # +max
247                - "0x7fefffffffffffff"
248            - values:
249                # -max
250                - "0xffefffffffffffff"
251            - values:
252                # +min
253                - "0x0000000000000001"
254            - values:
255                # -min
256                - "0x8000000000000001"
257            - values:
258                - "3.14159265358979323846"
259            - values:
260                - "1234567890987654321"
261
262      - file-name: "op_vs_8_inf_nan"
263        isa:
264          instructions:
265            - sig: fmod2.64 v:in:f64
266              acc: inout:f64
267              format: [op_v_8]
268          description: >
269            Division is NaN if Infinity is divided by Infinity.
270        check-type: check-acc-nan
271        code-template: |
272            #
273                fldai.64 %s
274                fmovi.64 v0, *s
275            # Modulo of Inf by Inf
276                fmod2.64 v0
277        description: >
278          Check fmod2.64 of Inf by Inf is NaN. (Case of Modulo)
279        template-cases:
280          - values: ["0x7ff0000000000000"]
281          - values: ["0xfff0000000000000"]
282        cases:
283          - values: ["0x7ff0000000000000"]
284          - values: ["0xfff0000000000000"]
285
286      - file-name: "op_vs_8_pzero"
287        isa:
288          instructions:
289            - sig: fmod2.64 v:in:f64
290              acc: inout:f64
291              format: [op_v_8]
292        check-type: check-positive
293        code-template: |
294            #
295                fldai.64 0.0 #
296                fmovi.64 v0, %s
297            # Mod of +0.0 and value
298                fmod2.64 v0
299                fmovi.64 v1, %s
300                fcmpg.64 v1
301        description: Check fmod2.64 with +0 and various values (NaN, Inf, min, max, numbers).
302        cases:
303            - values:
304                # +Inf
305                - "0x7ff0000000000000"
306                - "0"
307            - values:
308                # -Inf
309                - "0xfff0000000000000"
310                - "0"
311            - values:
312                # 1d
313                - "1"
314                - "0"
315            - values:
316                - "-1"
317                # -0.0
318                - "0x8000000000000000"
319
320            - values:
321                # +max
322                - "0x7fefffffffffffff"
323                - "0"
324            - values:
325                # -max
326                - "0xffefffffffffffff"
327                # -0.0
328                - "0x8000000000000000"
329            - values:
330                # +min
331                - "0x0000000000000001"
332                - "0"
333            - values:
334                # -min
335                - "0x8000000000000001"
336                # -0.0
337                - "0x8000000000000000"
338            - values:
339                # Some FP value, 3.14159265358979323846
340                - "3.14159265358979323846"
341                - "0"
342
343      - file-name: "op_vs_8_nzero"
344        isa:
345          instructions:
346            - sig: fmod2.64 v:in:f64
347              acc: inout:f64
348              format: [op_v_8]
349        check-type: check-positive
350        code-template: |
351            #
352                fldai.64 -0.0 #
353                fmovi.64 v0, %s
354            # Mod of -0.0 and value
355                fmod2.64 v0
356                fmovi.64 v1, %s
357                fcmpg.64 v1
358        description: Check fmod2.64 with -0 and various values (NaN, Inf, min, max, numbers).
359        cases:
360          - values:
361              # +Inf
362              - "0x7ff0000000000000"
363              - "0"
364          - values:
365              # -Inf
366              - "0xfff0000000000000"
367              - "0"
368          - values:
369              - "1"
370              # -0.0d
371              - "0x8000000000000000"
372          - values:
373              - "-1"
374              - "0"
375          - values:
376              # +max
377              - "0x7fefffffffffffff"
378              # -0.0d
379              - "0x8000000000000000"
380          - values:
381              # -max
382              - "0xffefffffffffffff"
383              - "0"
384          - values:
385              # +min
386              - "0x0000000000000001"
387              # -0.0d
388              - "0x8000000000000000"
389          - values:
390              # -min
391              - "0x8000000000000001"
392              - "0"
393          - values:
394              - "3.14159265358979323846"
395              # -0.0d
396              - "0x8000000000000000"
397          - values:
398              # Some FP value,
399              - "-3.14159265358979323846"
400              - "0"
401
402      - file-name: "op_vs_8_pone"
403        isa:
404          instructions:
405            - sig: fmod2.64 v:in:f64
406              acc: inout:f64
407              format: [op_v_8]
408        check-type: check-positive
409        code-template: |
410            #
411                fldai.64 1.0 #
412                fmovi.64 v0, %s
413            # Mod of 1.0 and value
414                fmod2.64 v0
415                fmovi.64 v1, %s
416                fcmpg.64 v1
417        description: Check fmod2.64 with +1 and various values (NaN, Inf, min, max, numbers).
418        cases:
419          - values:
420              - "1"
421              - "0"
422          - values:
423              - "-1"
424              - "0"
425          - values:
426              # +Inf
427              - "0x7ff0000000000000"
428              - "1"
429          - values:
430              # -Inf
431              - "0xfff0000000000000"
432              - "1"
433          - values:
434              # +max
435              - "0x7fefffffffffffff"
436              - "1"
437          - values:
438              # -max
439              - "0xffefffffffffffff"
440              - "1"
441          - values:
442              # +min
443              - "0x0000000000000001"
444              - "0"
445          - values:
446              # -min
447              - "0x8000000000000001"
448              - "0"
449          - values:
450              # Some FP value,
451              - "3.14159265358979323846"
452              - "1"
453          - values:
454              - "-3.14159265358979323846"
455              - "1"
456          - values:
457              - "1234567890.987654321"
458              - "1"
459
460      - file-name: "op_vs_8_none"
461        isa:
462          instructions:
463            - sig: fmod2.64 v:in:f64
464              acc: inout:f64
465              format: [op_v_8]
466        check-type: check-positive
467        code-template: |
468            #
469                fldai.64 -1.0 #
470                fmovi.64 v0, %s
471            # Mod of -1.0 and value
472                fmod2.64 v0
473                fmovi.64 v1, %s
474                fcmpg.64 v1
475        description: Check fmod2.64 with -1 and various values (NaN, Inf, min, max, numbers).
476        cases:
477          - values:
478              - "1"
479              - "-0.0"
480          - values:
481              - "-1"
482              - "-0.0"
483          - values:
484              # +Inf
485              - "0x7ff0000000000000"
486              - "-1"
487          - values:
488              # -Inf
489              - "0xFFF0000000000000"
490              - "-1"
491          - values:
492              # +max
493              - "0x7fefffffffffffff"
494              - "-1"
495          - values:
496              # -max
497              - "0xffefffffffffffff"
498              - "-1"
499          - values:
500              # +min
501              - "0x0000000000000001"
502              - "-0.0"
503          - values:
504              # -min
505              - "0x8000000000000001"
506              - "-0.0"
507          - values:
508              # Some FP value,
509              - "3.14159265358979323846"
510              - "-1"
511          - values:
512              - "-3.14159265358979323846"
513              - "-1"
514          - values:
515              - "1234567890.987654321"
516              - "-1"
517
518      - file-name: "op_vs_8"
519        isa:
520          instructions:
521            - sig: fmod2.64 v:in:f64
522              acc: inout:f64
523              format: [op_v_8]
524        check-type: check-positive
525        code-template: |
526            #
527                fldai.64 %s #
528                fmovi.64 v0, %s
529            # Mod of -1.0 and value
530                fmod2.64 v0
531                fmovi.64 v1, %s
532                fcmpg.64 v1
533        description: Check fmod2.64 with various values.
534        cases:
535            - values:
536                - "1.0"
537                - "-1.0"
538                - "0.0"
539            - values:
540                - "1.0"
541                - "1.0"
542                - "0.0"
543            - values:
544                - "-1.0"
545                - "1.0"
546                - "0.0"
547            - values:
548                - "1.0e100"
549                - "1.0e100"
550                - "0.0"
551            - values:
552                - "1.0e100"
553                - "-1.0e100"
554                - "-0.0"
555            - values:
556                - "1.0e+100"
557                - "1.0e-100"
558                - "9.885752855515831e-101"
559            - values:
560                - "-1.0e100"
561                - "1.0e100"
562                - "-0.0"
563            - values:
564                - "-1.0e-100"
565                - "1.0e-100"
566                - "-0.0"
567            - values:
568                - "-1.0e+100"
569                - "-1.0e-100"
570                - "-9.885752855515831e-101"
571            - values:
572                - "3.14159265358979323846"
573                - "-3.14159265358979323846"
574                - "0.0"
575            - values:
576                - "3.14159265358979323846e100"
577                - "-3.14159265358979323846e100"
578                - "-0.0"
579
580      - file-name: "op_vs_8_max"
581        isa:
582          instructions:
583            - sig: fmod2.64 v:in:f64
584              acc: inout:f64
585              format: [op_v_8]
586        check-type: check-positive
587        code-template: |
588            #
589                fldai.64 %s
590                fmovi.64 v0, %s
591            # Mod of two values
592                fmod2.64 v0
593                fmovi.64 v1, 0
594                fcmpg.64 v1
595        description: Check fmod2.64 with various maximal values.
596        cases:
597          - values:
598              # +max
599              - "0x7fefffffffffffff"
600              # +max
601              - "0x7fefffffffffffff"
602          - values:
603              # -max
604              - "0xffefffffffffffff"
605              - "0xffefffffffffffff"
606          - values:
607              # +max
608              - "0x7fefffffffffffff"
609              # -max
610              - "0xffefffffffffffff"
611          - values:
612              # +max
613              - "0x7fefffffffffffff"
614              - "1"
615          - values:
616              # +max
617              - "0x7fefffffffffffff"
618              - "-1"
619          - values:
620              # -max
621              - "0xffefffffffffffff"
622              - "1"
623          - values:
624              # -max
625              - "0xffefffffffffffff"
626              - "-1"
627
628      - file-name: "op_vs_8_zeroes_nan"
629        isa:
630          instructions:
631            - sig: fmod2.64 v:in:f64
632              acc: inout:f64
633              format: [op_v_8]
634        check-type: check-acc-nan
635        code-template: |
636            #
637                fldai.64 %s #
638                fmovi.64 v0, %s
639            # Mod of -1.0 and value
640                fmod2.64 v0
641        description: Check fmod2.64 with zeroes.
642        tags: [aot-fail]
643        bugid: ['3846']
644        cases:
645            - values:
646                - "0.0"
647                - "0.0"
648            - values:
649                - "0.0"
650                - "-0.0"
651            - values:
652                - "-0.0"
653                - "0.0"
654            - values:
655                - "-0.0"
656                - "-0.0"
657
658      - file-name: "incorrect_reg"
659        isa:
660          instructions:
661            - sig: fmod2.64 v:in:f64
662              acc: inout:f64
663              format: [op_v_8]
664        check-type: none
665        runner-options: [compile-failure]
666        description: Check fmod2.64 with incorrect register numbers.
667        code-template: |
668          #
669              fmod2.64 %s
670        cases:
671          - values: [v256]
672          - values: [v65535]
673          - values: [a0]
674          - values: [a255]
675          - values: [null]
676          - values: [0]
677          - values: [1.1]
678          - values: ['2.2']
679
680      - file-name: "reg_number"
681        isa:
682          instructions:
683            - sig: fmod2.64 v:in:f64
684              acc: inout:f64
685              format: [op_v_8]
686        check-type: none
687        runner-options: [compile-only]
688        description: Check fmod2.64 with correct register numbers.
689        code-template: |
690          #
691              fmod2.64 %s
692        cases:
693          - values: [v0]
694          - values: [v16]
695          - values: [v128]
696          - values: [v255]
697
698      - file-name: "calc"
699        isa:
700          instructions:
701            - sig: fmod2.64 v:in:f64
702              acc: inout:f64
703              format: [op_v_8]
704        check-type: check-positive
705        code-template: |
706            #
707                fldai.64 %s #
708                fmovi.64 v0, %s
709                fmod2.64 v0
710                fmovi.64 v1, %s
711                fcmpg.64 v1
712        description: Check fmod2.64 with various values.
713        tags: ['tsan']
714        cases:
715          - values:
716              - "0.12018311893073663"
717              - "-0.025131139878436515"
718              - "0.019658559416990573"
719          - values:
720              - "0.22440258667093504"
721              - "0.29473667141886917"
722              - "0.22440258667093504"
723          - values:
724              - "0.3033862126622541"
725              - "-0.3756010672721948"
726              - "0.3033862126622541"
727          - values:
728              - "0.2936997127243267"
729              - "-0.1764426330424449"
730              - "0.11725707968188182"
731          - values:
732              - "-0.09956939773023954"
733              - "-0.3877892950497467"
734              - "-0.09956939773023954"
735          - values:
736              - "0.3314930901944054"
737              - "-0.13506203672501027"
738              - "0.061369016744384886"
739          - values:
740              - "0.12451977351331212"
741              - "-0.39010722580021084"
742              - "0.12451977351331212"
743          - values:
744              - "0.22556927027597906"
745              - "-0.3969391565251753"
746              - "0.22556927027597906"
747          - values:
748              - "-0.35731514337836257"
749              - "0.3968803690491226"
750              - "-0.35731514337836257"
751          - values:
752              - "0.16934379656892917"
753              - "0.40037033331415206"
754              - "0.16934379656892917"
755          - values:
756              - "2.764634450793475e-72"
757              - "2.0593829964602962e61"
758              - "2.764634450793475e-72"
759          - values:
760              - "4.290222845632546e-94"
761              - "-5.310600113825947e93"
762              - "4.290222845632546e-94"
763          - values:
764              - "2.814056900722342e-31"
765              - "2.4791336743619776e78"
766              - "2.814056900722342e-31"
767          - values:
768              - "-4.372802884913136e-54"
769              - "-1.61600705349081e30"
770              - "-4.372802884913136e-54"
771          - values:
772              - "-1.4731713675366709e13"
773              - "-3.3542106259826996e91"
774              - "-1.4731713675366709e13"
775          - values:
776              - "-1.88388347188423"
777              - "-1.999969914515257e-71"
778              - "-1.833137632695426e-71"
779          - values:
780              - "3.938475013167094e-93"
781              - "1.7543416973210034e72"
782              - "3.938475013167094e-93"
783          - values:
784              - "2.2405919845682808e21"
785              - "-3.4260926065796194e48"
786              - "2.2405919845682808e21"
787          - values:
788              - "-6.920653318603553e47"
789              - "-1.3028837314073981e-65"
790              - "-1.200852789951636e-65"
791          - values:
792              - "-4.407583571028892e-90"
793              - "-0.0031674185526174184"
794              - "-4.407583571028892e-90"
795
796      - file-name: "type"
797        isa:
798            instructions:
799              - sig: fmod2.64 v:in:f64
800                acc: inout:f64
801                format: [op_v_8]
802            verification:
803              - acc_type
804              - v1_type
805        tags: ['verifier']
806        runner-options: ['verifier-failure', 'verifier-debug-config']
807        header-template: []
808        code-template: |
809          #
810          .record A {}
811          .record B {}
812          .record panda.String <external>
813          .record panda.Object <external>
814          .function i32 main() {
815              %s
816              *s
817              fmod2.64 v0
818        check-type: exit-positive
819        description: Check 'fmod2.64' with incorrect register and accumulator type.
820        template-cases:
821          - values:
822              - movi v0, 0
823          - values:
824              - movi.64 v0, 0
825          - values:
826              - fmovi.64 v0, 0
827            exclude: [val]
828          - values:
829              - |
830                #
831                    lda.type B
832                    sta.obj v0
833          - values:
834              - |
835                #
836                    lda.type B[]
837                    sta.obj v0
838          - values:
839              - |
840                #
841                    lda.type panda.String
842                    sta.obj v0
843          - values:
844              - |
845                #
846                    lda.str "string"
847                    sta.obj v0
848          - values:
849              - |
850                #
851                    movi v0, 10
852                    newarr v0, v0, i32[]
853          - values:
854              - mov.null v0
855
856        cases:
857          - values:
858              - ldai 0
859          - values:
860              - ldai.64 0
861          - values:
862              - fldai.64 0
863            id: val
864          - values:
865              - |
866                #
867                    lda.type A
868          - values:
869              - |
870                #
871                    lda.type A[]
872          - values:
873              - |
874                #
875                    lda.type panda.String
876          - values:
877              - |
878                #
879                    lda.str "string"
880          - values:
881              - |
882                #
883                    movi v1, 10
884                    newarr v1, v1, f64[]
885                    lda.obj v1
886          - values:
887              - lda.null
888
889      - file-name: uninitialized_regs
890        isa:
891          instructions:
892            - sig: fmod2.64 v:in:f64
893              acc: inout:f64
894              format: [op_v_8]
895        description: Check 'fmod2.64' with uninitialized register and accumulator.
896        tags: ['verifier']
897        runner-options: ['verifier-failure', 'verifier-debug-config']
898        header-template: []
899        code-template: |
900            #
901            .function i32 main() {
902                %s
903                *s
904                fmod2.64 %s
905        check-type: exit-positive
906        template-cases:
907          - values:
908              - ''
909              - v0
910          - values:
911              - fmovi.64 v0, 0
912              - v0
913            exclude: [init]
914          - values:
915              - ''
916              - v7
917          - values:
918              - ''
919              - v15
920          - values:
921              - fmovi.64 v15, 0
922              - v15
923            exclude: [init]
924          - values:
925              - ''
926              - v128
927          - values:
928              - fmovi.64 v128, 0
929              - v128
930            exclude: [init]
931          - values:
932              - ''
933              - v255
934          - values:
935              - fmovi.64 v255, 0
936              - v255
937            exclude: [init]
938        cases:
939          - values:
940              - ''
941          - values:
942              - fldai.64 0
943            id: init
944