• 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: []
15tests:
16  - file-name: fcmpg.64
17    isa:
18      title: Floating-point comparison
19      description: Perform specified floating point comparison between register and accumulator.
20      exceptions:
21        - x_none
22    commands:
23      - file-name: zero
24        isa:
25          instructions:
26            - sig: fcmpg.64 v:in:f64
27              acc: inout:f64->i32
28              format: [op_v_8]
29        tags: ['irtoc_ignore']
30        description: Check fcmpg.64 compares zero with other zero values.
31        code-template: |
32          #
33              fldai.64 %s
34              fmovi.64 v0, %s
35              fcmpg.64 v0
36        check-type: check-positive
37        cases:
38          - values:
39              - '0.0'
40              - '0.0'
41          - values:
42              - '-0.0'
43              - '-0.0'
44          - values:
45              - '-0.0'
46              - '0.0'
47          - values:
48              - '0.0'
49              - '-0.0'
50
51      - file-name: nan
52        isa:
53          instructions:
54            - sig: fcmpg.64 v:in:f64
55              acc: inout:f64->i32
56              format: [op_v_8]
57        description: Check fcmpg.64 compares NaN values.
58        tags: ['irtoc_ignore']
59        code-template: |
60          #   test - check binary representation and comparison of FP literals - NaN
61              fldai.64 0x7ff8000000000000
62              fmovi.64 v0, %s
63              fcmpg.64 v0
64        check-type: check-acc-1
65        cases:
66          - values:
67              - '0x7ff8000000000000'
68          - values:
69              - '0x7ff8000000000001'
70          - values:
71              - '0x7ff8000000000010'
72          - values:
73              - '0x7fffffffffffffff'
74          - values:
75              - '0xFFFFFFFFFFFFFFFF'
76          - values:
77              - '0x7ff8123456789012'
78          - values:
79              # +Inf
80              - '0x7ff0000000000000'
81            description: Check fcmpg.64 compares NaN with +Inf
82          - values:
83              # -Inf
84              - '0xfff0000000000000'
85            description: Check fcmpg.64 compares NaN with -Inf
86
87      - file-name: nan_numbers_1
88        isa:
89          instructions:
90            - sig: fcmpg.64 v:in:f64
91              acc: inout:f64->i32
92              format: [op_v_8]
93        description: Check fcmpg.64 compares NaN with various values.
94        tags: ['irtoc_ignore']
95        code-template: |
96          #   test - check comparison of NaN with values
97              fldai.64 0x7ff8000000000000 # One of valid NaN values
98              fmovi.64 v0, %s
99              fcmpg.64 v0
100        check-type: check-acc-1
101        cases:
102          - values:
103              - '4e300'
104          - values:
105              - '0.0'
106          - values:
107              - '-1.0e20'
108
109      - file-name: numbers_2
110        isa:
111          instructions:
112            - sig: fcmpg.64 v:in:f64
113              acc: inout:f64->i32
114              format: [op_v_8]
115        code-template: |
116          #   test - check comparison of values
117              fldai.64 %s
118              fmovi.64 v0, %s
119              movi v1, %s
120              fcmpg.64 v0
121              jne v1, set_failure
122              ldai 0
123              return
124          set_failure:
125              ldai 1
126              return
127        check-type: none
128        description: Check fcmpg.64 compares various values.
129        tags: ['tsan', 'irtoc_ignore']
130        cases:
131          - values:
132              - '1.0'
133              - '0.0'
134              - '1'
135          - values:
136              - '12345678.9098765'
137              - '12345678.9098764'
138              - '1'
139          - values:
140              - '12345678.9098765'
141              - '-12345678.9098765'
142              - '1'
143          - values:
144              - '-1.0'
145              - '0.0'
146              - '-1'
147          - values:
148              - '-12345678.9098765'
149              - '0.0'
150              - '-1'
151          - values:
152              - '-12345678.9098765'
153              - '12345678.9098765'
154              - '-1'
155          - values:
156              - '-12345678.9098765'
157              - '12345678.9098765'
158              - '-1'
159
160      - file-name: pinf
161        isa:
162          instructions:
163            - sig: fcmpg.64 v:in:f64
164              acc: inout:f64->i32
165              format: [op_v_8]
166        tags: ['irtoc_ignore']
167        description: Check fcmpg.64 compares positive Inf with various values.
168        code-template: |
169          #   test - check comparison of values
170              # +Inf
171              fldai.64 0x7ff0000000000000
172              fmovi.64 v0, %s
173              fcmpg.64 v0
174        check-type: check-acc-1
175        cases:
176          - values:
177              - '1.0'
178          - values:
179              - '12345678.9098765'
180          - values:
181              - '-12345678.9098765'
182          - values:
183              - '-1.0'
184          - values:
185              - '4e300'
186          - values:
187              - '-4e300'
188
189      - file-name: ninf
190        isa:
191          instructions:
192            - sig: fcmpg.64 v:in:f64
193              acc: inout:f64->i32
194              format: [op_v_8]
195        description: Check fcmpg.64 compares negative Inf with various values.
196        tags: ['irtoc_ignore']
197        code-template: |
198          #   test - check comparison of values
199              # -Inf
200              fldai.64 0xfff0000000000000
201              fmovi.64 v0, %s
202              fcmpg.64 v0
203        check-type: check-acc-minus-1
204        cases:
205          - values:
206              - '1.0'
207          - values:
208              - '12345678.9098765'
209          - values:
210              - '-12345678.9098765'
211          - values:
212              - '-1.0'
213          - values:
214              - '4e300'
215          - values:
216              - '-4e300'
217
218      - file-name: inf
219        isa:
220          instructions:
221            - sig: fcmpg.64 v:in:f64
222              acc: inout:f64->i32
223              format: [op_v_8]
224        tags: ['irtoc_ignore']
225        code-template: |
226          #   test - check comparison of values
227              fldai.64 %s
228              # +Inf
229              fmovi.64 v0, %s
230              movi v1, %s
231              fcmpg.64 v0
232              jne v1, set_failure
233              ldai 0
234              return
235          set_failure:
236              ldai 1
237              return
238        check-type: none
239        cases:
240          - values:
241              # -Inf
242              - '0xfff0000000000000'
243              - '0x7ff0000000000000'
244              - '-1'
245          - values:
246              - '0x7ff0000000000000'
247              # -Inf
248              - '0xfff0000000000000'
249              - '+1'
250
251      - file-name: incorrect_register
252        isa:
253          instructions:
254            - sig: fcmpg.64 v:in:f64
255              acc: inout:f64->i32
256              format: [op_v_8]
257        runner-options: [compile-failure]
258        description: Check fcmpg.64 with incorrect register numbers.
259        code-template: |
260          #
261              fcmpg.64 %s
262        check-type: exit-positive
263        cases:
264          - values: [v256]
265          - values: [a0]
266          - values: [0]
267          - values: ['1.1']
268          - values: [1.1]
269
270      - file-name: applicable_register
271        isa:
272          instructions:
273            - sig: fcmpg.64 v:in:f64
274              acc: inout:f64->i32
275              format: [op_v_8]
276        runner-options: [compile-only]
277        description: Check fcmpg.64 with correct register numbers.
278        code-template: |
279          #
280              fldai.64 0.0
281          %s
282        check-type: exit-positive
283        cases:
284          - values:
285            - '#{[*0..255].map do |i| "    fmovi.64 v#{i}, 0\n    fcmpg.64 v#{i}\n" end .join}'
286
287      - file-name: type
288        isa:
289          verification:
290            - v1_type
291            - acc_type
292        tags: ['verifier']
293        runner-options: ['verifier-failure', 'verifier-config']
294        header-template: []
295        code-template: |
296          #
297          .record A {}
298          .record B {}
299          .record panda.String <external>
300          .record panda.Object <external>
301          .function i32 main() {
302              %s
303              *s
304              fcmpg.64 v0
305              ldai 0
306        check-type: no-check
307        description: Check 'fcmpg.64' with incorrect register type.
308        template-cases:
309          - values:
310              - movi v0, 0
311          - values:
312              - fmovi v0, 0
313            bugid: ['6094']
314          - values:
315              - movi.64 v0, 0
316          - values:
317              - fmovi.64 v0, 0
318            exclude: [val]
319          - values:
320              - |
321                #
322                    lda.type B
323                    sta.obj v0
324          - values:
325              - |
326                #
327                    lda.type B[]
328                    sta.obj v0
329          - values:
330              - |
331                #
332                    lda.type panda.String
333                    sta.obj v0
334          - values:
335              - |
336                #
337                    lda.str "string"
338                    sta.obj v0
339          - values:
340              - |
341                #
342                    movi v0, 10
343                    newarr v0, v0, i32[]
344          - values:
345              - mov.null v0
346        cases:
347          - values:
348              - ldai 0
349          - values:
350              - fldai 0
351            bugid: ['6094']
352          - values:
353              - ldai.64 0
354          - values:
355              - fldai.64 0
356            id: val
357          - values:
358              - |
359                #
360                    lda.type A
361          - values:
362              - |
363                #
364                    lda.type A[]
365          - values:
366              - |
367                #
368                    lda.type panda.String
369          - values:
370              - |
371                #
372                    lda.str "string"
373          - values:
374              - |
375                #
376                    movi v1, 10
377                    newarr v1, v1, f64[]
378                    lda.obj v1
379          - values:
380              - lda.null
381
382      - file-name: uninitialized_regs
383        isa:
384          instructions:
385            - sig: fcmpg.64 v:in:f64
386              acc: inout:f64->i32
387              format: [op_v_8]
388        description: Check 'fcmpg.64' with uninitialized registers.
389        tags: ['verifier']
390        runner-options: ['verifier-failure', 'verifier-config']
391        header-template: []
392        code-template: |
393          #
394          .function i32 main() {
395              %s
396              *s
397              fcmpg.64 %s
398        check-type: exit-positive
399        template-cases:
400          - values:
401              - ''
402              - v0
403          - values:
404              - fmovi.64 v0, 0
405              - v0
406            exclude: [init]
407          - values:
408              - ''
409              - v7
410          - values:
411              - ''
412              - v15
413          - values:
414              - 'fmovi.64 v15, 0'
415              - v15
416            exclude: [init]
417          - values:
418              - ''
419              - v128
420          - values:
421              - 'fmovi.64 v128, 0'
422              - v128
423            exclude: [init]
424          - values:
425              - ''
426              - v255
427          - values:
428              - 'fmovi.64 v255, 0'
429              - v255
430            exclude: [init]
431        cases:
432          - values:
433              - ''
434          - values:
435              - fldai.64 0
436            id: init
437