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: "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-debug-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 instructions: 378 - sig: and2 v:in:i32 379 acc: inout:i32 380 prefix: bit 381 format: [pref_op_v_8] 382 verification: 383 - acc_type 384 - v1_type 385 runner-options: ['verifier-failure', 'verifier-debug-config'] 386 header-template: [] 387 code-template: | 388 # 389 .record A {} 390 .record B {} 391 .record panda.String <external> 392 .record panda.Object <external> 393 .function i32 main() { 394 %s 395 *s 396 and2 v0 397 ldai 0 398 check-type: no-check 399 description: Check and2 with incorrect register and accumulator type. 400 template-cases: 401 - values: 402 - ldai.64 0 403 - values: 404 - fldai.64 0 405 - values: 406 - | 407 # 408 lda.type B 409 - values: 410 - | 411 # 412 lda.type B[] 413 - values: 414 - | 415 # 416 lda.type panda.String 417 - values: 418 - | 419 # 420 lda.type panda.Object 421 - values: 422 - | 423 # 424 movi v0, 10 425 newarr v0, v0, i32[] 426 lda.obj v0 427 - values: 428 - lda.null 429 - values: 430 - ldai 0 431 exclude: [val] 432 cases: 433 - values: 434 - movi.64 v1, 0 435 - values: 436 - fmovi.64 v1, 0 437 - values: 438 - | 439 # 440 lda.type A 441 sta.obj v1 442 - values: 443 - | 444 # 445 lda.type A[] 446 sta.obj v1 447 448 - values: 449 - | 450 # 451 lda.type panda.String 452 sta.obj v1 453 - values: 454 - | 455 # 456 lda.type panda.Object 457 sta.obj v1 458 - values: 459 - | 460 # 461 movi v1, 10 462 newarr v1, v1, f64[] 463 - values: 464 - mov.null v1 465 - values: 466 - movi v1, 0 467 id: val 468 469 - file-name: uninitialized_regs 470 bugid: ['2260'] 471 isa: 472 instructions: 473 - sig: and2 v:in:i32 474 acc: inout:i32 475 prefix: bit 476 format: [pref_op_v_8] 477 description: Check and2 with uninitialized registers. 478 tags: ['verifier'] 479 runner-options: ['verifier-failure', 'verifier-debug-config'] 480 header-template: [] 481 code-template: | 482 # 483 .function i32 main() { 484 %s 485 *s 486 and2 *s 487 ldai 0 488 check-type: no-check 489 template-cases: 490 - values: 491 - '' 492 - values: 493 - ldai 0 494 exclude: [init] 495 496 cases: 497 - values: 498 - '' 499 - v0 500 - values: 501 - movi v1, 0 502 - v1 503 id: init 504 - values: 505 - '' 506 - v8 507 - values: 508 - '' 509 - v15 510 - values: 511 - movi v15, 0 512 - v15 513 id: init 514