• 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
14---
15definitions: []
16tests:
17  - file-name: ashri
18    isa:
19      title: Two address binary operation with immediate on accumulator
20      description: >
21        Perform specified binary operation on accumulator and immediate and store result into accumulator.
22        Immediate is sign extended to operand size.
23      exceptions:
24        - x_none
25    commands:
26      - file-name: op_imm_8_zero
27        isa:
28          instructions:
29            - sig: ashri imm:i32
30              acc: inout:i32
31              format: [op_imm_8]
32        code-template: |
33          #
34              ldai 0
35              ashri %s
36              movi v0, 0
37              jne v0, set_failure
38              ldai 0
39              return
40          set_failure:
41              ldai 1
42              return
43        check-type: none
44        description: Check `ashri` with zero and various values.
45        cases:
46          - values: ["0"]
47          - values: ["1"]
48          - values: ["-1"]
49          - values: ["0xF"]
50          - values: ["-0xF"]
51          - values: ["0x7F"]
52          - values: ["-0x7F"]
53          - values: ["0x80"]
54          - values: ["-0x80"]
55          - values: ["0xFF"]
56          - values: ["-0xFF"]
57
58
59      - file-name: op_imm_8_pone
60        isa:
61          instructions:
62            - sig: ashri imm:i32
63              acc: inout:i32
64              format: [op_imm_8]
65        code-template: |
66          #
67              ldai 1
68              ashri %s
69              movi v0, %s
70              jne v0, set_failure
71              ldai 0
72              return
73          set_failure:
74              ldai 1
75              return
76        check-type: none
77        description: Check `ashri` with +1 and various values.
78        cases:
79          - values: ["0", "0x1"]
80          - values: ["1", "0x0"]
81          - values: ["-1", "0x0"]
82          - values: ["0xF", "0x0"]
83          - values: ["-0xF", "0x0"]
84          - values: ["0x7F", "0x0"]
85          - values: ["-0x7F", "0x0"]
86          - values: ["0x80", "0x1"]
87          - values: ["-0x80", "0x1"]
88          - values: ["0xFF", "0x0"]
89          - values: ["-0xFF", "0x0"]
90
91
92      - file-name: op_imm_8_none
93        isa:
94          instructions:
95            - sig: ashri imm:i32
96              acc: inout:i32
97              format: [op_imm_8]
98        code-template: |
99          #
100              ldai -1
101              ashri %s
102              movi v0, 0xFFFFFFFF
103              jne v0, set_failure
104              ldai 0
105              return
106          set_failure:
107              ldai 1
108              return
109        check-type: none
110        description: Check `ashri` with -1 and various values.
111        cases:
112          - values: ["0"]
113          - values: ["1"]
114          - values: ["-1"]
115          - values: ["0xF"]
116          - values: ["-0xF"]
117          - values: ["0x7F"]
118          - values: ["-0x7F"]
119          - values: ["0x80"]
120          - values: ["-0x80"]
121          - values: ["0xFF"]
122          - values: ["-0xFF"]
123
124
125      - file-name: op_imm_8_pmax
126        isa:
127          instructions:
128            - sig: ashri imm:i32
129              acc: inout:i32
130              format: [op_imm_8]
131        code-template: |
132          #
133              ldai 0x7FFFFFFF
134              ashri %s
135              movi v0, %s
136              jne v0, set_failure
137              ldai 0
138              return
139          set_failure:
140              ldai 1
141              return
142        check-type: none
143        description: Check `ashri` with +max and various values.
144        cases:
145          - values: ["0", "0x7FFFFFFF"]
146          - values: ["1", "0x3FFFFFFF"]
147          - values: ["-1", "0x0"]
148          - values: ["0xF", "0xFFFF"]
149          - values: ["-0xF", "0x3FFF"]
150          - values: ["0x7F", "0x0"]
151          - values: ["-0x7F", "0x3FFFFFFF"]
152          - values: ["0x80", "0x7FFFFFFF"]
153          - values: ["-0x80", "0x7FFFFFFF"]
154          - values: ["0xFF", "0x0"]
155          - values: ["-0xFF", "0x3FFFFFFF"]
156
157
158      - file-name: op_imm_8_nmax
159        isa:
160          instructions:
161            - sig: ashri imm:i32
162              acc: inout:i32
163              format: [op_imm_8]
164        code-template: |
165          #
166              ldai -0x80000000
167              ashri %s
168              movi v0, %s
169              jne v0, set_failure
170              ldai 0
171              return
172          set_failure:
173              ldai 1
174              return
175        check-type: none
176        description: Check `ashri` with -max and various values.
177        cases:
178          - values: ["0", "0x80000000"]
179          - values: ["1", "0xC0000000"]
180          - values: ["-1", "0xFFFFFFFF"]
181          - values: ["0xF", "0xFFFF0000"]
182          - values: ["-0xF", "0xFFFFC000"]
183          - values: ["0x7F", "0xFFFFFFFF"]
184          - values: ["-0x7F", "0xC0000000"]
185          - values: ["0x80", "0x80000000"]
186          - values: ["-0x80", "0x80000000"]
187          - values: ["0xFF", "0xFFFFFFFF"]
188          - values: ["-0xFF", "0xC0000000"]
189
190
191      - file-name: vals
192        isa:
193          instructions:
194            - sig: ashri imm:i32
195              acc: inout:i32
196              format: [op_imm_8]
197        code-template: |
198          #
199              ldai %s
200              ashri %s
201              movi v0, %s
202              jne v0, set_failure
203              ldai 0
204              return
205          set_failure:
206              ldai 1
207              return
208        check-type: none
209        description: Check `ashri` with various values.
210        tags: ['tsan']
211        cases:
212          - values: ["0x47BC623", "0xF0", "0x47B"]
213          - values: ["0x98FF55FA", "0x37", "0xFFFFFF31"]
214          - values: ["0x4BFD9885", "0x74", "0x4BF"]
215          - values: ["0xB2FC1EB6", "0x01", "0xD97E0F5B"]
216          - values: ["0x7E2C4D16", "0xC6", "0x1F8B134"]
217          - values: ["0xDEE4E62E", "0x01", "0xEF727317"]
218          - values: ["0x1BE3708A", "0x8D", "0xDF1B"]
219          - values: ["0x15C646C2", "0x2F", "0x2B8C"]
220          - values: ["0xC86F8B23", "0xDF", "0xFFFFFFFF"]
221          - values: ["0x978A9490", "0xE9", "0xFFCBC54A"]
222
223
224      - file-name: type
225        isa:
226          verification:
227            - acc_type
228        tags: ['verifier']
229        runner-options: ['verifier-failure', 'verifier-config']
230        header-template: []
231        code-template: |
232          #
233          .record panda.Object <external>
234          .function i32 main() {
235              %s
236              ashri 0
237        check-type: exit-positive
238        description: Check 'ashri' with incorrect acc type.
239        cases:
240          - values: [ldai.64 0]
241          - values: [fldai 0]
242            bugid: ['7315']
243          - values: [fldai.64 0]
244          - values: [lda.null]
245          - values: [lda.type panda.Object]
246          - values: ['lda.type i32[]']
247          - values: [lda.str ""]
248          - values:
249            - |
250              #
251                  newobj v0, panda.Object
252                  lda.obj v0
253          - values:
254            - |
255              #
256                  movi v0, 10
257                  newarr v0, v0, i32[]
258                  lda.obj v0
259
260
261      - file-name: uninitialized_acc
262        isa:
263          instructions:
264            - sig: ashri imm:i32
265              acc: inout:i32
266              format: [op_imm_8]
267        description: Check 'ashri' with uninitialized accumulator.
268        tags: ['verifier']
269        runner-options: ['verifier-failure', 'verifier-config']
270        code-template: |
271            #
272                ashri 0
273        check-type: exit-positive
274