• 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: "ashr2"
17    isa:
18      title: Two address binary operation on accumulator
19      description: >
20        Perform specified binary operation on accumulator and register and store result into accumulator
21      exceptions:
22        - x_none
23    commands:
24      - file-name: "op_vs_8_zero"
25        isa:
26          instructions:
27            - sig: ashr2 v:in:i32
28              acc: inout:i32
29              prefix: bit
30              format: [pref_op_v_8]
31        code-template: |
32          #
33              ldai 0
34              movi v0, %s
35              mov v1, v0
36              ashr2 v0
37              movi v0, 0
38              jne v0, set_failure
39              ldai 0
40              jmp fall_through
41          set_failure:
42              ldai 1
43          fall_through:
44        description: Check ashr2 with 0 and various values.
45        cases:
46          - values:
47              - "0"
48          - values:
49              - "1"
50          - values:
51              - "-1"
52            bugid: ['1387']
53            tags: ["clang_release_sanitizer_jit"]
54          - values:
55              - "0x7FFFFFFF"
56            bugid: ['1387']
57            tags: ["clang_release_sanitizer_jit"]
58          - values:
59              - "0x80000000"
60            bugid: ['1387']
61            tags: ["clang_release_sanitizer_jit"]
62          - values:
63              - "-0x7FFFFFFF"
64            bugid: ['1387']
65            tags: ["clang_release_sanitizer_jit"]
66          - values:
67              - "-0x80000000"
68            bugid: ['1387']
69            tags: ["clang_release_sanitizer_jit"]
70          - values:
71              - "0xFFFFFFFF"
72            bugid: ['1387']
73            tags: ["clang_release_sanitizer_jit"]
74          - values:
75              - "-0xFFFFFFFF"
76
77      - file-name: "op_vs_8_pone"
78        isa:
79          instructions:
80            - sig: ashr2 v:in:i32
81              acc: inout:i32
82              prefix: bit
83              format: [pref_op_v_8]
84        code-template: |
85          #
86              ldai 1
87              movi v0, %s
88              ashr2 v0
89              movi v0, %s
90              jne v0, set_failure
91              ldai 0
92              jmp fall_through
93          set_failure:
94              ldai 1
95          fall_through:
96        description: Check ashr2 with +1 and various values.
97        cases:
98          - values:
99              - "0"
100              - "1"
101          - values:
102              - "1"
103              - "0"
104          - values:
105              - "-1"
106              - "0"
107            bugid: ['1387']
108            tags: ["clang_release_sanitizer_jit"]
109          - values:
110              - "0x7FFFFFFF"
111              - "0"
112            bugid: ['1387']
113            tags: ["clang_release_sanitizer_jit"]
114          - values:
115              - "0x80000000"
116              - "1"
117            bugid: ['1387']
118            tags: ["clang_release_sanitizer_jit"]
119          - values:
120              - "-0x7FFFFFFF"
121              - "0"
122            bugid: ['1387']
123            tags: ["clang_release_sanitizer_jit"]
124          - values:
125              - "-0x80000000"
126              - "1"
127            bugid: ['1387']
128            tags: ["clang_release_sanitizer_jit"]
129          - values:
130              - "0xFFFFFFFF"
131              - "0"
132            bugid: ['1387']
133            tags: ["clang_release_sanitizer_jit"]
134          - values:
135              - "-0xFFFFFFFF"
136              - "0"
137      - file-name: "op_vs_8_none"
138        isa:
139          instructions:
140            - sig: ashr2 v:in:i32
141              acc: inout:i32
142              prefix: bit
143              format: [pref_op_v_8]
144        code-template: |
145          #
146              ldai -1
147              movi v0, %s
148              ashr2 v0
149              movi v0, 0xFFFFFFFF
150              jne v0, set_failure
151              ldai 0
152              jmp fall_through
153          set_failure:
154              ldai 1
155          fall_through:
156        description: Check ashr2 with -1 and various values.
157        cases:
158          - values:
159              - "0"
160          - values:
161              - "1"
162          - values:
163              - "-1"
164            bugid: ['1387']
165            tags: ["clang_release_sanitizer_jit"]
166          - values:
167              - "0x7FFFFFFF"
168            bugid: ['1387']
169            tags: ["clang_release_sanitizer_jit"]
170          - values:
171              - "0x80000000"
172            bugid: ['1387']
173            tags: ["clang_release_sanitizer_jit"]
174          - values:
175              - "-0x7FFFFFFF"
176            bugid: ['1387']
177            tags: ["clang_release_sanitizer_jit"]
178          - values:
179              - "-0x80000000"
180            bugid: ['1387']
181            tags: ["clang_release_sanitizer_jit"]
182          - values:
183              - "0xFFFFFFFF"
184            bugid: ['1387']
185            tags: ["clang_release_sanitizer_jit"]
186          - values:
187              - "-0xFFFFFFFF"
188
189      - file-name: "op_vs_8_pmax"
190        isa:
191          instructions:
192            - sig: ashr2 v:in:i32
193              acc: inout:i32
194              prefix: bit
195              format: [pref_op_v_8]
196        code-template: |
197          #
198              ldai 0x7FFFFFFF
199              movi v0, %s
200              ashr2 v0
201              movi v0, %s
202              jne v0, set_failure
203              ldai 0
204              jmp fall_through
205          set_failure:
206              ldai 1
207          fall_through:
208        description: Check ashr2 with +max and various values.
209        cases:
210          - values:
211              - "0"
212              - "0x7FFFFFFF"
213          - values:
214              - "1"
215              - "0x3FFFFFFF"
216          - values:
217              - "-1"
218              - "0x0"
219            bugid: ['1387']
220            tags: ["clang_release_sanitizer_jit"]
221          - values:
222              - "0x7FFFFFFF"
223              - "0x0"
224            bugid: ['1387']
225            tags: ["clang_release_sanitizer_jit"]
226          - values:
227              - "0x80000000"
228              - "0x7FFFFFFF"
229            bugid: ['1387']
230            tags: ["clang_release_sanitizer_jit"]
231          - values:
232              - "-0x7FFFFFFF"
233              - "0x3FFFFFFF"
234            bugid: ['1387']
235            tags: ["clang_release_sanitizer_jit"]
236          - values:
237              - "-0x80000000"
238              - "0x7FFFFFFF"
239            bugid: ['1387']
240            tags: ["clang_release_sanitizer_jit"]
241          - values:
242              - "0xFFFFFFFF"
243              - "0x0"
244            bugid: ['1387']
245            tags: ["clang_release_sanitizer_jit"]
246          - values:
247              - "-0xFFFFFFFF"
248              - "0x3FFFFFFF"
249
250      - file-name: "op_vs_8_nmax"
251        isa:
252          instructions:
253            - sig: ashr2 v:in:i32
254              acc: inout:i32
255              prefix: bit
256              format: [pref_op_v_8]
257        code-template: |
258          #
259              ldai -0x80000000
260              movi v0, %s
261              ashr2 v0
262              movi v0, %s
263              jne v0, set_failure
264              ldai 0
265              jmp fall_through
266          set_failure:
267              ldai 1
268          fall_through:
269        description: Check ashr2 with -max and various values.
270        cases:
271          - values:
272              - "0"
273              - "0x80000000"
274          - values:
275              - "1"
276              - "0xC0000000"
277          - values:
278              - "-1"
279              - "0xFFFFFFFF"
280            bugid: ['1387']
281            tags: ["clang_release_sanitizer_jit"]
282          - values:
283              - "0x7FFFFFFF"
284              - "0xFFFFFFFF"
285            bugid: ['1387']
286            tags: ["clang_release_sanitizer_jit"]
287          - values:
288              - "0x80000000"
289              - "0x80000000"
290            bugid: ['1387']
291            tags: ["clang_release_sanitizer_jit"]
292          - values:
293              - "-0x7FFFFFFF"
294              - "0xC0000000"
295            bugid: ['1387']
296            tags: ["clang_release_sanitizer_jit"]
297          - values:
298              - "-0x80000000"
299              - "0x80000000"
300            bugid: ['1387']
301            tags: ["clang_release_sanitizer_jit"]
302          - values:
303              - "0xFFFFFFFF"
304              - "0xFFFFFFFF"
305            bugid: ['1387']
306            tags: ["clang_release_sanitizer_jit"]
307          - values:
308              - "-0xFFFFFFFF"
309              - "0xC0000000"
310
311      - file-name: "vals"
312        bugid: ['1387']
313        tags: ["clang_release_sanitizer_jit", tsan]
314        isa:
315          instructions:
316            - sig: ashr2 v:in:i32
317              acc: inout:i32
318              prefix: bit
319              format: [pref_op_v_8]
320        code-template: |
321          #
322              ldai %s
323              movi v0, %s
324              ashr2 v0
325              movi v0, %s
326              jne v0, set_failure
327              ldai 0
328              jmp fall_through
329          set_failure:
330              ldai 1
331          fall_through:
332        description: Check ashr2 with various values.
333        cases:
334          - values:
335              - "0xF7C3C59C"
336              - "0xBA9A9721"
337              - "0xFBE1E2CE"
338          - values:
339              - "0xC85A6FD0"
340              - "0xD6D79891"
341              - "0xFFFFE42D"
342          - values:
343              - "0x64A99B3C"
344              - "0x97FC66F9"
345              - "0x32"
346          - values:
347              - "0x7A92E59B"
348              - "0xD35D56A5"
349              - "0x3D4972C"
350          - values:
351              - "0x2B3E86A6"
352              - "0x634FFBF2"
353              - "0xACF"
354          - values:
355              - "0x6FA6AD46"
356              - "0x5F6A3A54"
357              - "0x6FA"
358          - values:
359              - "0xD3AC1EFA"
360              - "0x9551EEBF"
361              - "0xFFFFFFFF"
362          - values:
363              - "0x4DC08172"
364              - "0xA29C9583"
365              - "0x9B8102E"
366          - values:
367              - "0x9A768F76"
368              - "0x5AF13C53"
369              - "0xFFFFF34E"
370          - values:
371              - "0x71C01EC4"
372              - "0xC8FF2ECF"
373              - "0xE380"
374
375      - file-name: "vals_mod32_1"
376        isa:
377          instructions:
378            - sig: ashr2 v:in:i32
379              acc: inout:i32
380              prefix: bit
381              format: [pref_op_v_8]
382        bugid: ['1324']
383        tags: ['verifier']
384        runner-options: ['verifier-failure', 'verifier-debug-config']
385        code-template: |
386          #
387              ldai.64 %s
388              movi.64 v0, %s
389              ashr2 v0
390              movi.64 v0, %s
391              cmp.64 v0
392        description: Check ashr2 with incorrect accumulator and register types.
393        cases:
394          - values:
395              - "0x17FFFFFFF"
396              - "0x1"
397              - "0x000000003FFFFFFF"
398          - values:
399              - "0x77777777FFFFFFFF"
400              - "0x1111111180000000"
401              - "0xFFFFFFFFFFFFFFFF"
402          - values:
403              - "0x180000000"
404              - "0x180000000"
405              - "0xFFFFFFFF80000000"
406
407      - file-name: "regs"
408        isa:
409          instructions:
410            - sig: ashr2 v:in:i32
411              acc: inout:i32
412              prefix: bit
413              format: [pref_op_v_8]
414        runner-options: ['compile-only']
415        code-template: |
416          #
417              ashr2 %s
418        check-type: none
419        description: Check ashr2 with various register numbers.
420        cases:
421          - values:
422              - "v255"
423          - values:
424              - "v256"
425            runner-options: ['compile-failure']
426
427      - file-name: "type"
428        bugid: ["964", "966"]
429        tags: ["verifier"]
430        isa:
431          instructions:
432            - sig: ashr2 v:in:i32
433              acc: inout:i32
434              prefix: bit
435              format: [pref_op_v_8]
436          verification:
437            - acc_type
438            - v1_type
439        runner-options: ['verifier-failure', 'verifier-debug-config']
440        code-template: |
441          #
442              %s
443              %s
444              ashr2 v0
445              ldai 0
446        check-type: no-check
447        description: Check ashr2 with incorrect accumulator and register types.
448        cases:
449          - values:
450              - "lda.null"
451              - "movi v0, 0"
452          - values:
453              - "ldai 0 "
454              - "mov.null v0"
455          - values:
456              - "lda.null"
457              - "mov.null v0"
458