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