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