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