• 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: "not"
17    isa:
18      title: Unary
19      description: >
20        Perform specified operation on accumulator
21      exceptions:
22      - x_none
23
24    commands:
25      - file-name: "op_none"
26        isa:
27          instructions:
28            - sig: not
29              acc: inout:i32
30              prefix: bit
31              format: [pref_op_none]
32        code-template: |
33            #
34                ldai %s
35                not
36                movi v0, %s
37                jne v0, set_failure
38                ldai 0
39                jmp fall_through
40            set_failure:
41                ldai 1
42            fall_through:
43        description: Check `not` with various values.
44        tags: ['tsan']
45        cases:
46          - values: ["0", "0xFFFFFFFF"]
47          - values: ["1", "0xFFFFFFFE"]
48          - values: ["-1", "0x0"]
49          - values: ["0xF", "0xFFFFFFF0"]
50          - values: ["-0xF", "0xE"]
51          - values: ["0x7F", "0xFFFFFF80"]
52          - values: ["-0x7F", "0x7E"]
53          - values: ["0x80", "0xFFFFFF7F"]
54          - values: ["-0x80", "0x7F"]
55          - values: ["0xFF", "0xFFFFFF00"]
56          - values: ["-0xFF", "0xFE"]
57          - values: ["0xFFF", "0xFFFFF000"]
58          - values: ["-0xFFF", "0xFFE"]
59          - values: ["0xFFFF", "0xFFFF0000"]
60          - values: ["-0xFFFF", "0xFFFE"]
61          - values: ["0xFFFFF", "0xFFF00000"]
62          - values: ["-0xFFFFF", "0xFFFFE"]
63          - values: ["0xFFFFFF", "0xFF000000"]
64          - values: ["-0xFFFFFF", "0xFFFFFE"]
65          - values: ["0xFFFFFFF", "0xF0000000"]
66          - values: ["-0xFFFFFFF", "0xFFFFFFE"]
67          - values: ["0x7FFFFFFF", "0x80000000"]
68          - values: ["-0x7FFFFFFF", "0x7FFFFFFE"]
69          - values: ["0x80000000", "0x7FFFFFFF"]
70          - values: ["-0x80000000", "0x7FFFFFFF"]
71          - values: ["0xFFFFFFFF", "0x0"]
72          - values: ["-0xFFFFFFFF", "0xFFFFFFFE"]
73
74      - file-name: "vals"
75        isa:
76          instructions:
77            - sig: not
78              acc: inout:i32
79              prefix: bit
80              format: [pref_op_none]
81        code-template: |
82          #
83              ldai %s
84              not
85              movi v0, %s
86              jne v0, set_failure
87              ldai 0
88              jmp fall_through
89          set_failure:
90              ldai 1
91          fall_through:
92        description: Check `not` with various values.
93        cases:
94          - values: ["0x3F1E2404", "0xC0E1DBFB"]
95          - values: ["0x8E119A05", "0x71EE65FA"]
96          - values: ["0x8408A74", "0xF7BF758B"]
97          - values: ["0xEF517B96", "0x10AE8469"]
98          - values: ["0x3D39D8B1", "0xC2C6274E"]
99          - values: ["0x80AD01AA", "0x7F52FE55"]
100          - values: ["0xB563F333", "0x4A9C0CCC"]
101          - values: ["0xEBB8A558", "0x14475AA7"]
102          - values: ["0x8C648714", "0x739B78EB"]
103          - values: ["0xFDC5CD51", "0x23A32AE"]
104          - values: ["0x2D459E9E", "0xD2BA6161"]
105          - values: ["0x33D4670E", "0xCC2B98F1"]
106          - values: ["0x798A4886", "0x8675B779"]
107          - values: ["0xF49E5BB9", "0xB61A446"]
108          - values: ["0x540A6EEF", "0xABF59110"]
109          - values: ["0x4C0CA0DD", "0xB3F35F22"]
110          - values: ["0x4FD745F", "0xFB028BA0"]
111          - values: ["0xCFC655A7", "0x3039AA58"]
112          - values: ["0x4F8D850D", "0xB0727AF2"]
113          - values: ["0x2F71A383", "0xD08E5C7C"]
114
115      - file-name: type
116        bugid: ["964", "966"]
117        tags: ["verifier"]
118        isa:
119          instructions:
120            - sig: not
121              acc: inout:i32
122              prefix: bit
123              format: [pref_op_none]
124          verification:
125            - acc_type
126        runner-options: ['verifier-failure', 'verifier-debug-config']
127        header-template: []
128        code-template: |
129            .record T {}
130            .record panda.String <external>
131            .record panda.Object <external>
132            #
133            .function i32 main() {
134                %s
135                not
136        check-type: exit-positive
137        description: Check `not` with incorrect accumulator type.
138        cases:
139          - values:
140            - fldai.64 1.0
141          - values:
142            - lda.type T
143          - values:
144            - lda.type T[]
145          - values:
146            - lda.type panda.Object
147          - values:
148            - lda.type panda.String
149          - values:
150            - lda.str "x"
151          - values:
152            - |
153              newobj v0, T
154              lda.obj v0
155          - values:
156            - lda.null
157          - values:
158            - |
159              #
160                  movi v0, 10
161                  newarr v0, v0, i32[]
162                  lda.obj v0
163
164      - file-name: uninitialized_regs
165        bugid: ["2787"]
166        tags: ["verifier"]
167        isa:
168          instructions:
169            - sig: not
170              acc: inout:i32
171              prefix: bit
172              format: [pref_op_none]
173        description: Check 'not' with uninitialized accumulator.
174        runner-options: ['verifier-failure', 'verifier-debug-config']
175        header-template: []
176        code-template: |
177          #
178          .function i32 main() {
179              # acc is undefined
180              not
181        check-type: exit-positive
182