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