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: "movi.64"
17    isa:
18      title: Move immediate-to-register
19      description: >
20        Move integer immediate into a register. For short formats immediate is sign extended to operand size.
21      exceptions:
22        - x_none
23      verification:
24        - none
25    commands:
26      - file-name: "imm_64"
27        isa:
28          instructions:
29            - sig: movi.64 v:out:i64, imm:i64
30              acc: none
31              format: [op_v_8_imm_64]
32        code-template: |
33          #
34              ldai.64 %s
35              movi.64 v0, %s
36              cmp.64 v0
37        description: Check movi.64 with various values.
38        check-type: no-check
39        tags: ['tsan']
40        cases:
41          - values:
42              - 0
43              - 0
44          - values:
45              - 1
46              - 1
47          - values:
48              - -1
49              - -1
50          - values:
51              - 0xF
52              - 0xF
53          - values:
54              - -0xF
55              - -0xF
56          - values:
57              - 0x7F
58              - 0x7F
59          - values:
60              - -0x7F
61              - -0x7F
62          - values:
63              - 0xFF
64              - 0xFF
65          - values:
66              - -0xFF
67              - -0xFF
68          - values:
69              - 0x7FFF
70              - 0x7FFF
71          - values:
72              - -0x7FFF
73              - -0x7FFF
74          - values:
75              - 0xFFFF
76              - 0xFFFF
77          - values:
78              - -0xFFFF
79              - -0xFFFF
80          - values:
81              - 0x7FFFFFFF
82              - 0x7FFFFFFF
83          - values:
84              - -0x7FFFFFFF
85              - -0x7FFFFFFF
86          - values:
87              - 0xFFFFFFFF
88              - 0xFFFFFFFF
89          - values:
90              - -0xFFFFFFFF
91              - -0xFFFFFFFF
92          - values:
93              - 0x12345678
94              - 0x12345678
95          - values:
96              - -0x12345678
97              - -0x12345678
98          - values:
99              - 0xFEDCBA98
100              - 0xFEDCBA98
101          - values:
102              - -0xFEDCBA98
103              - -0xFEDCBA98
104          - values:
105              - 0x100000000
106              - 0x100000000
107          - values:
108              - -0x100000000
109              - -0x100000000
110          - values:
111              - 0x100000001
112              - 0x100000001
113          - values:
114              - -0x100000001
115              - -0x100000001
116          - values:
117              - 0xFEDCBA9876543210
118              - 0xFEDCBA9876543210
119          - values:
120              - -0xFEDCBA9876543210
121              - -0xFEDCBA9876543210
122
123
124      - file-name: "vd_8"
125        isa:
126          instructions:
127            - sig: movi.64 v:out:i64, imm:i64
128              acc: none
129              format: [op_v_8_imm_64]
130        check-type: no-check
131        code-template: |
132          #
133              ldai.64 1
134              movi.64 %s, 1
135              cmp.64 %s
136        description: Check mov.64 instruction with different register numbers (8 bit).
137        cases:
138          - values:
139              - v0
140              - v0
141          - values:
142              - v1
143              - v1
144          - values:
145              - v15
146              - v15
147          - values:
148              - v16
149              - v16
150          - values:
151              - v255
152              - v255
153
154
155      - file-name: "err"
156        isa:
157          instructions:
158            - sig: movi.64 v:out:i64, imm:i64
159              acc: none
160              format: [op_v_8_imm_64]
161        runner-options: [compile-failure]
162        check-type: exit-positive
163        header-template: []
164        code-template: |
165          .record E {}
166          .function i32 main() {
167              movi.64 %s
168        description: Check mov.64 instruction with syntax errors.
169        cases:
170          - values:
171              - v0, v0
172          - values:
173              - v0, "foo"
174          - values:
175              - v0, E
176          - values:
177              - v0, null
178          - values:
179              - v0, 0xAABBCCDDEEFFEEFF00
180          - values:
181              - a0, 1
182          - values:
183              - v256, 1
184            description: Check movi.64 instruction with out-of-range register number.
185          - values:
186              - v257, 1
187            description: Check movi.64 instruction with out-of-range register number.
188          - values:
189              - v65536, 1
190            description: Check movi.64 instruction with out-of-range register number.
191          - values:
192              - v32768, 1
193            description: Check movi.64 instruction with out-of-range register number.
194          - values:
195              - v1, 0.1
196            description: Check movi.64 with incorrect value (float value).
197          - values:
198              - v1, 1e1
199            description: Check movi.64 with incorrect value (float value).
200          - values:
201              - v0, e1
202            description: Check movi.64 with incorrect value.
203