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: "sub2" 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: sub2 v:in:i32 28 acc: inout:i32 29 format: [op_v_8] 30 code-template: | 31 # 32 ldai 0 33 movi v0, %s 34 sub2 v0 35 movi v0, %s 36 jne v0, set_failure 37 ldai 0 38 jmp fall_through 39 set_failure: 40 ldai 1 41 fall_through: 42 description: Check sub2 with zero and various values. 43 cases: 44 - values: 45 - "0" 46 - "0" 47 - values: 48 - "1" 49 - "0xffffffff" 50 - values: 51 - "-1" 52 - "1" 53 - values: 54 - "0x7fffffff" 55 - "0x80000001" 56 - values: 57 - "-0x7fffffff" 58 - "0x7fffffff" 59 - values: 60 - "0x80000000" 61 - "0x80000000" 62 tags: ["clang_release_sanitizer"] 63 bugid: ['966'] 64 - values: 65 - "-0x80000000" 66 - "0x80000000" 67 tags: ["clang_release_sanitizer"] 68 bugid: ['966'] 69 - values: 70 - "0xFFFFFFFF" 71 - "1" 72 - values: 73 - "-0xFFFFFFFF" 74 - "0xFFFFFFFF" 75 76 - file-name: "op_vs_8_pone" 77 isa: 78 instructions: 79 - sig: sub2 v:in:i32 80 acc: inout:i32 81 format: [op_v_8] 82 code-template: | 83 # 84 ldai 1 85 movi v0, %s 86 sub2 v0 87 movi v0, %s 88 jne v0, set_failure 89 ldai 0 90 jmp fall_through 91 set_failure: 92 ldai 1 93 fall_through: 94 description: Check sub2 with +1 and various values. 95 cases: 96 - values: 97 - "0" 98 - "1" 99 - values: 100 - "1" 101 - "0" 102 - values: 103 - "-1" 104 - "2" 105 - values: 106 - "0x7FFFFFFF" 107 - "0x80000002" 108 - values: 109 - "-0x7FFFFFFF" 110 - "0x80000000" 111 tags: ["clang_release_sanitizer"] 112 bugid: ['966'] 113 - values: 114 - "0x80000000" 115 - "0x80000001" 116 tags: ["clang_release_sanitizer"] 117 bugid: ['966'] 118 - values: 119 - "-0x80000000" 120 - "0x80000001" 121 tags: ["clang_release_sanitizer"] 122 bugid: ['966'] 123 - values: 124 - "0xFFFFFFFF" 125 - "2" 126 - values: 127 - "-0xFFFFFFFF" 128 - "0" 129 - file-name: "op_vs_8_none" 130 isa: 131 instructions: 132 - sig: sub2 v:in:i32 133 acc: inout:i32 134 format: [op_v_8] 135 code-template: | 136 # 137 ldai -1 138 movi v0, %s 139 sub2 v0 140 movi v0, %s 141 jne v0, set_failure 142 ldai 0 143 jmp fall_through 144 set_failure: 145 ldai 1 146 fall_through: 147 description: Check sub2 with -1 and various values. 148 cases: 149 - values: 150 - "0" 151 - "-1" 152 - values: 153 - "1" 154 - "-2" 155 - values: 156 - "-1" 157 - "0" 158 - values: 159 - "0x7FFFFFFF" 160 - "0x80000000" 161 - values: 162 - "-0x7FFFFFFF" 163 - "0x7FFFFFFE" 164 - values: 165 - "0x80000000" 166 - "0x7FFFFFFF" 167 - values: 168 - "-0x80000000" 169 - "0x7FFFFFFF" 170 - values: 171 - "0xFFFFFFFF" 172 - "0" 173 - values: 174 - "-0xFFFFFFFF" 175 - "0xFFFFFFFE" 176 - file-name: "op_vs_8_pmax" 177 isa: 178 instructions: 179 - sig: sub2 v:in:i32 180 acc: inout:i32 181 format: [op_v_8] 182 code-template: | 183 # 184 ldai 0x7FFFFFFF 185 movi v0, %s 186 sub2 v0 187 movi v0, %s 188 jne v0, set_failure 189 ldai 0 190 jmp fall_through 191 set_failure: 192 ldai 1 193 fall_through: 194 description: Check sub2 with +max and various values. 195 cases: 196 - values: 197 - "0" 198 - "0x7fffffff" 199 - values: 200 - "1" 201 - "0x7ffffffe" 202 - values: 203 - "-1" 204 - "0x80000000" 205 tags: ["clang_release_sanitizer"] 206 bugid: ['966'] 207 - values: 208 - "0x7fffffff" 209 - "0" 210 - values: 211 - "-0x7fffffff" 212 - "0xfffffffe" 213 tags: ["clang_release_sanitizer"] 214 bugid: ['966'] 215 - values: 216 - "0x80000000" 217 - "0xffffffff" 218 tags: ["clang_release_sanitizer"] 219 bugid: ['966'] 220 - values: 221 - "-0x80000000" 222 - "0xffffffff" 223 tags: ["clang_release_sanitizer"] 224 bugid: ['966'] 225 - values: 226 - "0xffffffff" 227 - "0x80000000" 228 tags: ["clang_release_sanitizer"] 229 bugid: ['966'] 230 - values: 231 - "-0xffffffff" 232 - "0x7ffffffe" 233 234 - file-name: "op_vs_8_nmax" 235 isa: 236 instructions: 237 - sig: sub2 v:in:i32 238 acc: inout:i32 239 format: [op_v_8] 240 code-template: | 241 # 242 ldai -0x80000000 243 movi v0, %s 244 sub2 v0 245 movi v0, %s 246 jne v0, set_failure 247 ldai 0 248 jmp fall_through 249 set_failure: 250 ldai 1 251 fall_through: 252 description: Check sub2 with -max and various values. 253 cases: 254 - values: 255 - "0" 256 - "0x80000000" 257 - values: 258 - "1" 259 - "0x7fffffff" 260 tags: ["clang_release_sanitizer"] 261 bugid: ['966'] 262 - values: 263 - "-1" 264 - "0x80000001" 265 - values: 266 - "0x7fffffff" 267 - "1" 268 tags: ["clang_release_sanitizer"] 269 bugid: ['966'] 270 - values: 271 - "-0x7fffffff" 272 - "0xffffffff" 273 - values: 274 - "0x80000000" 275 - "0" 276 - values: 277 - "-0x80000000" 278 - "0" 279 - values: 280 - "0xffffffff" 281 - "0x80000001" 282 - values: 283 - "-0xffffffff" 284 - "0x7fffffff" 285 tags: ["clang_release_sanitizer"] 286 bugid: ['966'] 287 288 - file-name: "vals" 289 isa: 290 instructions: 291 - sig: sub2 v:in:i32 292 acc: inout:i32 293 format: [op_v_8] 294 code-template: | 295 # 296 ldai %s 297 movi v0, %s 298 sub2 v0 299 movi v0, %s 300 jne v0, set_failure 301 ldai 0 302 jmp fall_through 303 set_failure: 304 ldai 1 305 fall_through: 306 description: Check sub2 with various values. 307 tags: ['tsan'] 308 cases: 309 - values: 310 - "0x41c75e07" 311 - "0x42e816eb" 312 - "0xfedf471c" 313 - values: 314 - "0x45624f8b" 315 - "0xfc29cfb6" 316 - "0x49387fd5" 317 - values: 318 - "0x5811aa60" 319 - "0xf22cf148" 320 - "0x65e4b918" 321 - values: 322 - "0x5aac44d7" 323 - "0xbe450a68" 324 - "0x9c673a6f" 325 tags: ["clang_release_sanitizer"] 326 bugid: ['966'] 327 - values: 328 - "0xa9a2ee6d" 329 - "0x6e000ede" 330 - "0x3ba2df8f" 331 tags: ["clang_release_sanitizer"] 332 bugid: ['966'] 333 - values: 334 - "0xd9ec934b" 335 - "0xe4a6266a" 336 - "0xf5466ce1" 337 - values: 338 - "0xc5c7ee89" 339 - "0x600e6f58" 340 - "0x65b97f31" 341 tags: ["clang_release_sanitizer"] 342 bugid: ['966'] 343 - values: 344 - "0x76016f79" 345 - "0x589dee2d" 346 - "0x1d63814c" 347 - values: 348 - "0xec966b67" 349 - "0xf366e464" 350 - "0xf92f8703" 351 - values: 352 - "0x82250785" 353 - "0xac94f78" 354 - "0x775bb80d" 355 tags: ["clang_release_sanitizer"] 356 bugid: ['966'] 357 358 - file-name: "vals_mod32_1" 359 bugid: ['1324', '2072'] 360 tags: ['verifier'] 361 runner-options: ['verifier-failure', 'verifier-debug-config'] 362 isa: 363 instructions: 364 - sig: sub2 v:in:i32 365 acc: inout:i32 366 format: [op_v_8] 367 code-template: | 368 # 369 ldai %s 370 movi v0, %s 371 sub2 v0 372 movi.64 v0, %s 373 cmp.64 v0 374 description: Check sub2 with incorrect accumulator and register types. 375 cases: 376 - values: 377 - "0" 378 - "0x80000000" 379 - "0xFFFFFFFF80000000" 380 tags: ["clang_release_sanitizer"] 381 bugid: ['966'] 382 - values: 383 - "0x80000000" 384 - "1" 385 - "0x7FFFFFFF" 386 tags: ["clang_release_sanitizer"] 387 bugid: ['966'] 388 - values: 389 - "0x80000000" 390 - "-0x80000000" 391 - "0" 392 393 - file-name: "vals_mod32_2" 394 bugid: ['1324'] 395 tags: ['verifier'] 396 runner-options: ['verifier-failure', 'verifier-debug-config'] 397 isa: 398 instructions: 399 - sig: sub2 v:in:i32 400 acc: inout:i32 401 format: [op_v_8] 402 code-template: | 403 # 404 ldai.64 %s 405 movi.64 v0, %s 406 sub2 v0 407 movi.64 v0, %s 408 cmp.64 v0 409 description: Check sub2 with incorrect accumulator and register types. 410 cases: 411 - values: 412 - "0" 413 - "0x180000000" 414 - "0xFFFFFFFF80000000" 415 tags: ["clang_release_sanitizer"] 416 bugid: ['966'] 417 - values: 418 - "0x1234567680000000" 419 - "1" 420 - "0x7FFFFFFF" 421 tags: ["clang_release_sanitizer"] 422 bugid: ['966'] 423 - values: 424 - "0x7654321080000000" 425 - "-0x1234567680000000" 426 - "0" 427 428 - file-name: "regs" 429 isa: 430 instructions: 431 - sig: sub2 v:in:i32 432 acc: inout:i32 433 format: [op_v_8] 434 runner-options: ['compile-only'] 435 code-template: | 436 # 437 sub2 %s 438 check-type: none 439 description: Check sub2 with various register numbers. 440 cases: 441 - values: 442 - "v255" 443 - values: 444 - "v256" 445 runner-options: ['compile-failure'] 446 447 - file-name: "type" 448 tags: ["verifier"] 449 bugid: ['966', '964'] 450 isa: 451 instructions: 452 - sig: sub2 v:in:i32 453 acc: inout:i32 454 format: [op_v_8] 455 verification: 456 - acc_type 457 - v1_type 458 runner-options: ['verifier-failure', 'verifier-debug-config'] 459 code-template: | 460 # 461 %s 462 %s 463 sub2 v0 464 ldai 0 465 check-type: no-check 466 description: Check sub2 with incorrect accumulator and register types. 467 cases: 468 - values: 469 - "lda.null" 470 - "movi v0, 0" 471 - values: 472 - "ldai 0 " 473 - "mov.null v0" 474 - values: 475 - "lda.null" 476 - "mov.null v0" 477