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: 'sta.64' 17 isa: 18 title: Store accumulator 19 description: Moves accumulator content into a register. 20 exceptions: 21 - x_none 22 commands: 23 - file-name: 'op_vd_8' 24 description: Check sta.64 moves accumulator content into a register. 25 isa: 26 instructions: 27 - sig: sta.64 v:out:b64 28 acc: in:b64 29 format: [op_v_8] 30 code-template: | 31 # 32 %s 33 ldai 0 34 return 35 err: 36 ldai 1 37 return 38 check-type: none 39 tags: ['tsan'] 40 cases: 41 - values: 42 - "#{[ 43 '0', 44 '1', 45 '0xF', 46 '0xFF', 47 '0xFFF', 48 '0xFFFF', 49 '0xFFFFF', 50 '0xFFFFFF', 51 '0xFFFFFFF', 52 '0xFFFFFFFF', 53 '0xFFFFFFFFF', 54 '0xFFFFFFFFFF', 55 '0xFFFFFFFFFFF', 56 '0xFFFFFFFFFFFF', 57 '0xFFFFFFFFFFFFF', 58 '0xFFFFFFFFFFFFFF', 59 '0xFFFFFFFFFFFFFFF', 60 '0xFFFFFFFFFFFFFFFF', 61 '0x7F', 62 '0x7FF', 63 '0x7FFF', 64 '0x7FFFF', 65 '0x7FFFFF', 66 '0x7FFFFFF', 67 '0x7FFFFFFF', 68 '0x7FFFFFFFF', 69 '0x7FFFFFFFFF', 70 '0x7FFFFFFFFFF', 71 '0x7FFFFFFFFFFF', 72 '0x7FFFFFFFFFFFF', 73 '0x7FFFFFFFFFFFFF', 74 '0x7FFFFFFFFFFFFFF', 75 '0x7FFFFFFFFFFFFFFF', 76 '-1', 77 '-0xF', 78 '-0xFF', 79 '-0xFFF', 80 '-0xFFFF', 81 '-0xFFFFF', 82 '-0xFFFFFF', 83 '-0xFFFFFFF', 84 '-0xFFFFFFFF', 85 '-0xFFFFFFFFF', 86 '-0xFFFFFFFFFF', 87 '-0xFFFFFFFFFFF', 88 '-0xFFFFFFFFFFFF', 89 '-0xFFFFFFFFFFFFF', 90 '-0xFFFFFFFFFFFFFF', 91 '-0xFFFFFFFFFFFFFFF', 92 '-0xFFFFFFFFFFFFFFFF', 93 '-0x7F', 94 '-0x7FF', 95 '-0x7FFF', 96 '-0x7FFFF', 97 '-0x7FFFFF', 98 '-0x7FFFFFF', 99 '-0x7FFFFFFF', 100 '-0x7FFFFFFFF', 101 '-0x7FFFFFFFFF', 102 '-0x7FFFFFFFFFF', 103 '-0x7FFFFFFFFFFF', 104 '-0x7FFFFFFFFFFFF', 105 '-0x7FFFFFFFFFFFFF', 106 '-0x7FFFFFFFFFFFFFF', 107 '-0x7FFFFFFFFFFFFFFF' 108 ].map do |s| \" ldai.64 #{s}\\n sta.64 v0\\n cmp.64 v0\\n jnez err\\n\" end .join}" 109 110 - file-name: 'reg' 111 description: Check sta.64 with various register numbers. 112 isa: 113 instructions: 114 - sig: sta.64 v:out:b64 115 acc: in:b64 116 format: [op_v_8] 117 code-template: | 118 # 119 ldai.64 0xDEADBEEFBADC0FFE 120 sta.64 %s 121 cmp.64 %s 122 check-type: check-positive 123 cases: 124 - values: [v0, v0] 125 - values: [v1, v1] 126 - values: [v7, v7] 127 - values: [v8, v8] 128 - values: [v15, v15] 129 - values: [v16, v16] 130 - values: [v127, v127] 131 - values: [v128, v128] 132 - values: [v255, v255] 133 - values: [v256, v255] 134 runner-options: [compile-failure] 135 description: Check sta.64 with incorrect register numbers. 136 - values: [a0, v255] 137 runner-options: [compile-failure] 138 description: Check sta.64 with incorrect register numbers. 139 - values: [0, v255] 140 runner-options: [compile-failure] 141 description: Check sta.64 with incorrect register numbers. 142 143 - file-name: 'type' 144 description: Check 'sta.64' with incorrect accumulator type. Register type is not checked. 145 isa: 146 verification: 147 - acc_type 148 tags: ['verifier'] 149 runner-options: ['verifier-failure', 'verifier-config'] 150 header-template: [] 151 code-template: | 152 # 153 .record A {} 154 .record B {} 155 .record panda.String <external> 156 .record panda.Object <external> 157 .function i32 main() { 158 ##- v1 initialization with different types 159 %s 160 ##- Accumulator initialization with incorrect types 161 *s 162 sta.64 v1 163 check-type: exit-positive 164 cases: 165 - values: 166 - ldai 0 167 - values: 168 - fldai 0 169 bugid: ['6094'] 170 - values: 171 - | 172 # 173 lda.type B 174 - values: 175 - | 176 # 177 lda.type B[] 178 - values: 179 - | 180 # 181 lda.type panda.String 182 - values: 183 - | 184 # 185 lda.str "string" 186 - values: 187 - | 188 # 189 movi v0, 10 190 newarr v0, v0, i32[] 191 lda.obj v0 192 - values: 193 - lda.null 194 template-cases: 195 - values: 196 - movi v1, 0 197 - values: 198 - fmovi v1, 0 199 - values: 200 - movi.64 v1, 0 201 - values: 202 - fmovi.64 v1, 0 203 - values: 204 - | 205 # 206 lda.type A 207 sta.obj v1 208 - values: 209 - | 210 # 211 lda.type A[] 212 sta.obj v1 213 214 - values: 215 - | 216 # 217 lda.type panda.String 218 sta.obj v1 219 - values: 220 - | 221 # 222 lda.str "string" 223 sta.obj v1 224 - values: 225 - | 226 # 227 movi v1, 10 228 newarr v1, v1, f64[] 229 - values: 230 - mov.null v1 231 232 - file-name: uninitialized_regs 233 description: Check 'sta.64' with uninitialized accumulator. Destination register is not checked. 234 isa: 235 instructions: 236 - sig: sta.64 v:out:b64 237 acc: in:b64 238 format: [op_v_8] 239 tags: ['verifier'] 240 runner-options: ['verifier-failure', 'verifier-config'] 241 header-template: [] 242 code-template: | 243 # 244 .function i32 main() { 245 %s 246 sta.64 %s 247 check-type: exit-positive 248 cases: 249 - values: 250 - '' 251 - v0 252 - values: 253 - movi v0, 0 254 - v0 255 - values: 256 - '' 257 - v15 258 - values: 259 - 'movi.64 v15, 0' 260 - v15 261 - values: 262 - '' 263 - v128 264 - values: 265 - 'fmovi.64 v128, 0' 266 - v128 267 - values: 268 - '' 269 - v255 270 - values: 271 - 'mov.null v255' 272 - v255 273 274 - file-name: 'err' 275 description: Check sta.64 with incorrect value. 276 isa: 277 instructions: 278 - sig: sta.64 v:out:b64 279 acc: in:b64 280 format: [op_v_8] 281 runner-options: [compile-failure] 282 code-template: | 283 # Check sta.64 with wrong arguments 284 %s 285 check-type: exit-positive 286 cases: 287 - values: 288 - sta.64 1 289 - values: 290 - sta.64 1.1 291 - values: 292 - sta.64 a0 293 - values: 294 - sta.64 "" 295