• 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: "i32tof64"
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: i32tof64
28              acc: inout:i32->f64
29              prefix: cast
30              format: [pref_op_none]
31        code-template: |
32          #
33              ldai %s
34              i32tof64
35              fmovi.64 v0, %s
36              fcmpg.64 v0
37        description: Check i32tof64 with various values.
38        tags: ['tsan']
39        cases:
40          - values:
41              - "0"
42              - "0.0"
43          - values:
44              - "1"
45              - "1.0"
46          - values:
47              - "-1"
48              - "-1.0"
49          - values:
50              - "0x7fffffff"
51              - "2.147483647e9"
52          - values:
53              - "-0x7fffffff"
54              - "-2.147483647e9"
55          - values:
56              - "0x80000000"
57              - "-2.147483648e9"
58          - values:
59              - "-0x80000000"
60              - "-2.147483648e9"
61          - values:
62              - "0xFFFFFFFF"
63              - "-1"
64          - values:
65              - "-0xFFFFFFFF"
66              - "1"
67          - values:
68              - "-2147483648"
69              - "-2.147483648e9"
70
71      - file-name: "type"
72        isa:
73          instructions:
74            - sig: i32tof64
75              acc: inout:i32->f64
76              prefix: cast
77              format: [pref_op_none]
78          verification:
79              - acc_type
80        bugid: ["964", "1653"]
81        tags: ["verifier"]
82        description: |
83          Check `i32tof64` with incorrect accumulator type.
84          Load different values (objects, strings, types, 64-bit floating point values, 64-bit integer values) and invokes `i32tof64`.
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-debug-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                i32tof64
96        check-type: exit-positive
97        cases:
98            - values:
99                - ldai.64 0
100            - values:
101                - fldai.64 0
102            - values:
103                - lda.type B
104            - values:
105                - lda.type B[]
106            - values:
107                - lda.type panda.String
108            - values:
109                - lda.str "string"
110            - values:
111                - lda.type panda.Object
112            - values:
113                - |
114                  #
115                      movi v0, 10
116                      newarr v0, v0, i32[]
117                      lda.obj v0
118            - values:
119                - lda.null
120
121      - file-name: uninitialized_regs
122        isa:
123          instructions:
124            - sig: i32tof64
125              acc: inout:i32->f64
126              prefix: cast
127              format: [pref_op_none]
128        description: Check i32tof64 with uninitialized accumulator.
129        tags: ['verifier']
130        runner-options: ['verifier-failure', 'verifier-debug-config']
131        header-template: []
132        code-template: |
133            #
134            .function i32 main() {
135                i32tof64
136        check-type: exit-positive
137