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: "and2" 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: and2 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 and2 v0 36 movi v0, 0 37 jne v0, set_failure 38 ldai 0 39 jmp fall_through 40 set_failure: 41 ldai 1 42 fall_through: 43 description: Check 'and2' with 0 and various values. 44 cases: 45 - values: 46 - "0" 47 - values: 48 - "1" 49 - values: 50 - "-1" 51 - values: 52 - "0x7FFFFFFF" 53 - values: 54 - "0x80000000" 55 - values: 56 - "-0x7FFFFFFF" 57 - values: 58 - "-0x80000000" 59 - values: 60 - "0xFFFFFFFF" 61 - values: 62 - "-0xFFFFFFFF" 63 64 - file-name: "op_vs_8_pone" 65 isa: 66 instructions: 67 - sig: and2 v:in:i32 68 acc: inout:i32 69 prefix: bit 70 format: [pref_op_v_8] 71 code-template: | 72 # 73 ldai 1 74 movi v0, %s 75 and2 v0 76 movi v0, %s 77 jne v0, set_failure 78 ldai 0 79 jmp fall_through 80 set_failure: 81 ldai 1 82 fall_through: 83 description: Check 'and2' with +1 and various values. 84 cases: 85 - values: 86 - "0" 87 - "0" 88 - values: 89 - "1" 90 - "1" 91 - values: 92 - "-1" 93 - "1" 94 - values: 95 - "0x7FFFFFFF" 96 - "1" 97 - values: 98 - "0x80000000" 99 - "0" 100 - values: 101 - "-0x7FFFFFFF" 102 - "1" 103 - values: 104 - "-0x80000000" 105 - "0" 106 - values: 107 - "0xFFFFFFFF" 108 - "1" 109 - values: 110 - "-0xFFFFFFFF" 111 - "1" 112 - file-name: "op_vs_8_none" 113 isa: 114 instructions: 115 - sig: and2 v:in:i32 116 acc: inout:i32 117 prefix: bit 118 format: [pref_op_v_8] 119 code-template: | 120 # 121 ldai -1 122 movi v0, %s 123 and2 v0 124 movi v0, %s 125 jne v0, set_failure 126 ldai 0 127 jmp fall_through 128 set_failure: 129 ldai 1 130 fall_through: 131 description: Check 'and2' with -1 and various values. 132 cases: 133 - values: 134 - "0" 135 - "0" 136 - values: 137 - "1" 138 - "1" 139 - values: 140 - "-1" 141 - "-1" 142 - values: 143 - "0x7FFFFFFF" 144 - "0x7FFFFFFF" 145 - values: 146 - "0x80000000" 147 - "0x80000000" 148 - values: 149 - "-0x7FFFFFFF" 150 - "-0x7FFFFFFF" 151 - values: 152 - "-0x80000000" 153 - "-0x80000000" 154 - values: 155 - "0xFFFFFFFF" 156 - "0xFFFFFFFF" 157 - values: 158 - "-0xFFFFFFFF" 159 - "-0xFFFFFFFF" 160 - file-name: "op_vs_8_pmax" 161 isa: 162 instructions: 163 - sig: and2 v:in:i32 164 acc: inout:i32 165 prefix: bit 166 format: [pref_op_v_8] 167 code-template: | 168 # 169 ldai 0x7FFFFFFF 170 movi v0, %s 171 and2 v0 172 movi v0, %s 173 jne v0, set_failure 174 ldai 0 175 jmp fall_through 176 set_failure: 177 ldai 1 178 fall_through: 179 description: Check 'and2' with +max and various values. 180 cases: 181 - values: 182 - "0" 183 - "0" 184 - values: 185 - "1" 186 - "1" 187 - values: 188 - "-1" 189 - "0x7FFFFFFF" 190 - values: 191 - "0x7FFFFFFF" 192 - "0x7FFFFFFF" 193 - values: 194 - "0x80000000" 195 - "0" 196 - values: 197 - "-0x7FFFFFFF" 198 - "1" 199 - values: 200 - "-0x80000000" 201 - "0" 202 - values: 203 - "0xFFFFFFFF" 204 - "0x7FFFFFFF" 205 - values: 206 - "-0xFFFFFFFF" 207 - "1" 208 209 - file-name: "op_vs_8_nmax" 210 isa: 211 instructions: 212 - sig: and2 v:in:i32 213 acc: inout:i32 214 prefix: bit 215 format: [pref_op_v_8] 216 code-template: | 217 # 218 ldai -0x80000000 219 movi v0, %s 220 and2 v0 221 movi v0, %s 222 jne v0, set_failure 223 ldai 0 224 jmp fall_through 225 set_failure: 226 ldai 1 227 fall_through: 228 description: Check 'and2' with -max and various values. 229 cases: 230 - values: 231 - "0" 232 - "0" 233 - values: 234 - "1" 235 - "0" 236 - values: 237 - "-1" 238 - "0x80000000" 239 - values: 240 - "0x7FFFFFFF" 241 - "0" 242 - values: 243 - "0x80000000" 244 - "0x80000000" 245 - values: 246 - "-0x7FFFFFFF" 247 - "0x80000000" 248 - values: 249 - "-0x80000000" 250 - "0x80000000" 251 - values: 252 - "0xFFFFFFFF" 253 - "0x80000000" 254 - values: 255 - "-0xFFFFFFFF" 256 - "0" 257 258 - file-name: "vals" 259 isa: 260 instructions: 261 - sig: and2 v:in:i32 262 acc: inout:i32 263 prefix: bit 264 format: [pref_op_v_8] 265 code-template: | 266 # 267 ldai %s 268 movi v0, %s 269 and2 v0 270 movi v0, %s 271 jne v0, set_failure 272 ldai 0 273 jmp fall_through 274 set_failure: 275 ldai 1 276 fall_through: 277 description: Check 'and2' with various values. 278 tags: ['tsan'] 279 cases: 280 - values: 281 - "0xA51B315E" 282 - "0x87C8F582" 283 - "0x85083102" 284 - values: 285 - "0x38A75ED8" 286 - "0x7D32F542" 287 - "0x38225440" 288 - values: 289 - "0xBE9510AB" 290 - "0x43500AD6" 291 - "0x2100082" 292 - values: 293 - "0x6B3EBCF0" 294 - "0xDE8EC51C" 295 - "0x4A0E8410" 296 - values: 297 - "0xD0A1860" 298 - "0x5EB6DAA" 299 - "0x50A0820" 300 - values: 301 - "0xD9B646CB" 302 - "0xF6F2454C" 303 - "0xD0B24448" 304 - values: 305 - "0xB3BC65C4" 306 - "0xE8F33B3E" 307 - "0xA0B02104" 308 - values: 309 - "0xD9962D72" 310 - "0xC661F3D4" 311 - "0xC0002150" 312 - values: 313 - "0xC39C6250" 314 - "0x97BB08D2" 315 - "0x83980050" 316 - values: 317 - "0xECFD3116" 318 - "0x59D1C953" 319 - "0x48D10112" 320 321 - file-name: "vals_mod32_1" 322 bugid: ['1324'] 323 tags: ['verifier'] 324 runner-options: ['verifier-failure', 'verifier-config'] 325 isa: 326 instructions: 327 - sig: and2 v:in:i32 328 acc: inout:i32 329 prefix: bit 330 format: [pref_op_v_8] 331 code-template: | 332 # 333 ldai.64 %s 334 movi.64 v0, %s 335 and2 v0 336 movi.64 v0, %s 337 cmp.64 v0 338 description: Check 'and' with incorrect type of registers. 339 cases: 340 - values: 341 - "0x17FFFFFFF" 342 - "0x17FFFFFFF" 343 - "0x7FFFFFFF" 344 - values: 345 - "0x77777777FFFFFFFF" 346 - "0x1111111180000000" 347 - "0xFFFFFFFF80000000" 348 - values: 349 - "0x180000000" 350 - "0x180000000" 351 - "0xFFFFFFFF80000000" 352 353 - file-name: "regs" 354 isa: 355 instructions: 356 - sig: and2 v:in:i32 357 acc: inout:i32 358 prefix: bit 359 format: [pref_op_v_8] 360 runner-options: ['compile-only'] 361 code-template: | 362 # 363 and2 %s 364 check-type: none 365 description: Check 'and' with various register numbers. 366 cases: 367 - values: 368 - "v255" 369 - values: 370 - "v256" 371 runner-options: ['compile-failure'] 372 373 - file-name: "type" 374 bugid: ["964", "966"] 375 tags: [verifier] 376 isa: 377 verification: 378 - acc_type 379 - v1_type 380 runner-options: ['verifier-failure', 'verifier-config'] 381 header-template: [] 382 code-template: | 383 .record T {} 384 .function i32 main() { 385 %s 386 *s 387 and2 v0 388 check-type: exit-positive 389 description: Check 'and2' with incorrect accumulator and/or register types. 390 cases: 391 - values: 392 - ldai 0 393 id: acc_ok 394 - values: 395 - ldai.64 0 396 - values: 397 - fldai 0 398 bugid: ['7315'] 399 - values: 400 - fldai.64 0 401 - values: 402 - lda.null 403 - values: 404 - | 405 # 406 movi v1, 0 407 newarr v1, v1, i32[] 408 lda.obj v1 409 - values: 410 - lda.str "0" 411 - values: 412 - lda.type T 413 - values: 414 - | 415 # 416 newobj v1, T 417 lda.obj v1 418 template-cases: 419 - values: 420 - movi v0, 0 421 exclude: [acc_ok] 422 - values: 423 - movi.64 v0, 0 424 - values: 425 - fmovi v0, 0 426 bugid: ['7315'] 427 - values: 428 - fmovi.64 v0, 0 429 - values: 430 - mov.null v0 431 - values: 432 - | 433 # 434 movi v0, 0 435 newarr v0, v0, i32[] 436 - values: 437 - | 438 # 439 lda.str "0" 440 sta.obj v0 441 - values: 442 - | 443 # 444 lda.type T 445 sta.obj v0 446 - values: 447 - newobj v0, T 448 449 450 - file-name: uninitialized_regs 451 bugid: ['2260'] 452 isa: 453 instructions: 454 - sig: and2 v:in:i32 455 acc: inout:i32 456 prefix: bit 457 format: [pref_op_v_8] 458 description: Check 'and2' with uninitialized registers. 459 tags: ['verifier'] 460 runner-options: ['verifier-failure', 'verifier-config'] 461 code-template: | 462 # 463 %s 464 *s 465 and2 *s 466 check-type: exit-positive 467 template-cases: 468 - values: 469 - '' 470 - values: 471 - ldai 0 472 exclude: [init] 473 474 cases: 475 - values: 476 - '' 477 - v0 478 - values: 479 - movi v1, 0 480 - v1 481 id: init 482 - values: 483 - '' 484 - v8 485 - values: 486 - '' 487 - v15 488 - values: 489 - movi v15, 0 490 - v15 491 id: init 492