• 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: "u32tof32"
17    isa:
18      title: Conversions between integer and floating point types
19      description: >
20        Perform specified primitive type conversion of accumulator.
21      exceptions:
22        - x_none
23    commands:
24      - file-name: "op_none"
25        isa:
26          instructions:
27            - sig: u32tof32
28              acc: inout:u32->f32
29              prefix: cast
30              format: [pref_op_none]
31        code-template: |
32          #
33              ldai %s
34              u32tof32
35              fmovi v0, %s
36              fcmpg v0
37        tags: ['tsan', 'irtoc_ignore']
38        description: Check u32tof32 with various values.
39        cases:
40          - values:
41              - "0"
42              - "0.0"
43          - values:
44              - "1"
45              - "1.0"
46          - values:
47              - "-1"
48              - "4294967295"
49          - values:
50              - "0x7fffffff"
51              - "2.14748365e9"
52          - values:
53              - "-0x7fffffff"
54              - "2.14748365e9"
55          - values:
56              - "0x80000000"
57              - "2.14748365e9"
58          - values:
59              - "-0x80000000"
60              - "2.14748365e9"
61          - values:
62              - "0xFFFFFFFF"
63              - "4294967295"
64          - values:
65              - "-0xFFFFFFFF"
66              - "1"
67          - values:
68              - "-2147483648"
69              - "2.147483648e9"
70
71      - file-name: "type"
72        isa:
73          instructions:
74            - sig: u32tof32
75              acc: inout:u32->f32
76              prefix: cast
77              format: [pref_op_none]
78          verification:
79              - acc_type
80        bugid: ["964", "1653"]
81        tags: ["verifier"]
82        description: |
83          Check `u32tof32` with incorrect accumulator type.
84          Load different values (objects, strings, types, 64-bit floating point values, 64-bit integer values) and invokes `u32tof32`.
85          Return 0 to indicate that negative test failed, because this line is unreachable and code will not be executed after verification error.
86        runner-options: ['verifier-failure', 'verifier-config']
87        header-template: []
88        code-template: |
89            #
90            .record B {}
91            .record panda.String <external>
92            .record panda.Object <external>
93            .function i32 main() {
94                %s
95                u32tof32
96        check-type: exit-positive
97        cases:
98            - values:
99                - ldai.64 0
100            - values:
101                - fldai 0
102            - values:
103                - fldai.64 0
104            - values:
105                - lda.type B
106            - values:
107                - lda.type B[]
108            - values:
109                - lda.type panda.String
110            - values:
111                - lda.str "string"
112            - values:
113                - lda.type panda.Object
114            - values:
115                - |
116                  #
117                      movi v0, 10
118                      newarr v0, v0, i32[]
119                      lda.obj v0
120            - values:
121                - lda.null
122
123      - file-name: uninitialized_regs
124        isa:
125          instructions:
126            - sig: u32tof32
127              acc: inout:u32->f32
128              prefix: cast
129              format: [pref_op_none]
130        description: Check 'u32tof64' with uninitialized accumulator.
131        tags: ['verifier']
132        runner-options: ['verifier-failure', 'verifier-config']
133        code-template: |
134            #
135                u32tof32
136        check-type: exit-positive
137