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: "mov.64" 17 isa: 18 title: Move register-to-register 19 description: Move values between registers. 20 exceptions: 21 - x_none 22 commands: 23 - file-name: "op_vs_4_vs_4" 24 isa: 25 instructions: 26 - sig: mov.64 v1:out:b64, v2:in:b64 27 acc: none 28 format: [op_v1_4_v2_4, op_v1_16_v2_16] 29 code-template: | 30 # 31 movi.64 %s, 0x123456789 32 mov.64 %s, %s 33 ldai.64 0x123456789 34 cmp.64 %s 35 description: Check mov.64 instruction with different register numbers (4 bit). 36 cases: 37 - values: [v0, v0, v0, v0] 38 - values: [v0, v1, v0, v1] 39 - values: [v0, v2, v0, v2] 40 - values: [v0, v4, v0, v4] 41 - values: [v0, v7, v0, v7] 42 - values: [v1, v1, v1, v1] 43 - values: [v1, v2, v1, v2] 44 - values: [v1, v4, v1, v4] 45 - values: [v1, v7, v1, v7] 46 - values: [v2, v2, v2, v2] 47 - values: [v2, v4, v2, v4] 48 - values: [v2, v7, v2, v7] 49 - values: [v4, v4, v4, v4] 50 - values: [v4, v7, v4, v7] 51 - values: [v7, v7, v7, v7] 52 53 - file-name: "op_vs_8_vs_8" 54 isa: 55 instructions: 56 - sig: mov.64 v1:out:b64, v2:in:b64 57 acc: none 58 format: [op_v1_4_v2_4, op_v1_16_v2_16] 59 code-template: | 60 # 61 movi.64 %s, 0x123456789 62 mov.64 %s, %s 63 ldai.64 0x123456789 64 cmp.64 %s 65 description: Check mov.64 instruction with different register numbers (8 bit) 66 cases: 67 - values: [v0, v8, v0, v8] 68 - values: [v0, v64, v0, v64] 69 - values: [v0, v128, v0, v128] 70 - values: [v0, v255, v0, v255] 71 - values: [v8, v0, v8, v0] 72 - values: [v64, v0, v64, v0] 73 - values: [v128, v0, v128, v0] 74 - values: [v255, v0, v255, v0] 75 - values: [v8, v8, v8, v8] 76 - values: [v8, v64, v8, v64] 77 - values: [v8, v128, v8, v128] 78 - values: [v8, v255, v8, v255] 79 - values: [v64, v64, v64, v64] 80 - values: [v64, v128, v64, v128] 81 - values: [v64, v255, v64, v255] 82 - values: [v128, v128, v128, v128] 83 - values: [v128, v255, v128, v255] 84 - values: [v255, v255, v255, v255] 85 86 - file-name: "op_vs_16_vs_16" 87 isa: 88 instructions: 89 - sig: mov.64 v1:out:b64, v2:in:b64 90 acc: none 91 format: [op_v1_4_v2_4, op_v1_16_v2_16] 92 code-template: | 93 # 94 movi.64 v0, 0x123456789 95 mov.64 %s, v0 96 mov.64 %s, %s 97 mov.64 v1, %s 98 ldai.64 0x123456789 99 cmp.64 v1 100 description: Check mov.64 instruction with different register numbers (16 bit) 101 cases: 102 - values: [v256, v256, v256, v256] 103 - values: [v256, v1024, v256, v1024] 104 - values: [v256, v32768, v256, v32768] 105 - values: [v256, v65535, v256, v65535] 106 - values: [v1024, v1024, v1024, v1024] 107 - values: [v1024, v32768, v1024, v32768] 108 - values: [v1024, v65535, v1024, v65535] 109 - values: [v32768, v32768, v32768, v32768] 110 - values: [v32768, v65535, v32768, v65535] 111 - values: [v65535, v65535, v65535, v65535] 112 113 - file-name: "err" 114 isa: 115 instructions: 116 - sig: mov.64 v1:out:b64, v2:in:b64 117 acc: none 118 format: [op_v1_4_v2_4, op_v1_16_v2_16] 119 code-template: | 120 # 121 mov.64 %s, %s 122 check-type: none 123 runner-options: [compile-failure] 124 description: Test erroneous code with mov.64 instruction. 125 cases: 126 - values: [v0, v65536] 127 description: Check when register number is out of range. 128 - values: [v65536, v65536] 129 description: Check when register number is out of range. 130 - values: [v65536, v0] 131 description: Check when register number is out of range. 132 - values: [v65536, a0] 133 description: Check when register number is out of range and incorrect register name. 134 - values: [a0, v65536] 135 description: Check when register number is out of range and incorrect register name. 136 - values: [a0, a0] 137 description: Check when register number is out of range and incorrect register name. 138 - values: [1, v65536] 139 description: Check with incorrect destination and register number out of range. 140 141 - file-name: "type_1" 142 isa: 143 instructions: 144 - sig: mov.64 v1:out:b64, v2:in:b64 145 acc: none 146 format: [op_v1_4_v2_4, op_v1_16_v2_16] 147 code-template: | 148 # 149 %s 150 mov.64 v1, v0 151 %s 152 %s 153 description: | 154 Check mov.64 with different type of source register - i32 (failure) values, 155 f64 values, Object (failure). 156 cases: 157 # 32 bit v using mov.64 158 - values: 159 - "movi v0, 0" 160 - "ldai 0" 161 - | 162 # 163 jne v1, exit_failure 164 ldai 0 165 return 166 exit_failure: 167 ldai 1 168 return 169 bugid: ['1324', '2089'] 170 tags: ['verifier'] 171 runner-options: ['verifier-failure', 'verifier-debug-config'] 172 description: There are two places where bytecode is incorrect - mov.64 and jne/cmp 173 - values: ["movi v0, 0", "ldai 0", "cmp.64 v1"] 174 bugid: ['1324', '2089'] 175 tags: ['verifier'] 176 runner-options: ['verifier-failure', 'verifier-debug-config'] 177 description: There are two places where bytecode is incorrect - mov.64 and cmp.64 178 - values: 179 - "movi v0, 0x12345678" 180 - "ldai 0x12345678" 181 - | 182 # 183 jne v1, exit_failure 184 ldai 0 185 return 186 exit_failure: 187 ldai 1 188 return 189 bugid: ['1324', '2089'] 190 tags: ['verifier'] 191 runner-options: ['verifier-failure', 'verifier-debug-config'] 192 - values: ["movi v0, 0x12345678", "ldai 0x12345678", "cmp.64 v1"] 193 bugid: ['1324', '2089'] 194 tags: ['verifier'] 195 runner-options: ['verifier-failure', 'verifier-debug-config'] 196 197 - values: ["fmovi.64 v0, 0x1234567890abcdef", "fldai.64 0x1234567890abcdef", "fcmpg.64 v1"] 198 - values: ["fmovi.64 v0, 0", "fldai.64 0", "fcmpg.64 v1"] 199 - values: ["fmovi.64 v0, 12345.6789", "fldai.64 12345.6789", "fcmpg.64 v1"] 200 - values: ["fmovi.64 v0, 0x1", "fldai.64 0x1", "fcmpg.64 v1"] 201 202 - values: 203 - mov.null v0 204 - lda.null 205 - | 206 jne.obj v1, return_ne_num 207 ldai 0 208 return 209 return_ne_num: 210 ldai 1 211 return 212 tags: ['verifier'] 213 runner-options: ['verifier-failure', 'verifier-debug-config'] 214 bugid: ['1324'] 215 216 - file-name: "vals_int_pos" 217 isa: 218 instructions: 219 - sig: mov.64 v1:out:b64, v2:in:b64 220 acc: none 221 format: [op_v1_4_v2_4, op_v1_16_v2_16] 222 code-template: | 223 # 224 movi.64 v0, %s 225 mov.64 v1, v0 226 lda.64 v0 227 cmp.64 v1 228 description: Check mov.64 instruction moves values from register to register. 229 cases: 230 - values: ['0'] 231 - values: ['1'] 232 - values: ['0x80'] 233 - values: ['0xff'] 234 - values: ['0x8000'] 235 - values: ['0xffff'] 236 - values: ['0x80000000'] 237 - values: ['0xffffffff'] 238 - values: ['0x8000000000'] 239 - values: ['0xffffffffff'] 240 - values: ['0x800000000000'] 241 - values: ['0xffffffffffff'] 242 - values: ['0x80000000000000'] 243 - values: ['0xffffffffffffff'] 244 - values: ['0x8000000000000000'] 245 - values: ['0xffffffffffffffff'] 246 - values: ['0x12345678'] 247 - values: ['0x87654321'] 248 - values: ['0x1234567890ABCDEF'] 249 - values: ['0xFEDCBA0987654321'] 250 251 - file-name: "vals_neg" 252 isa: 253 instructions: 254 - sig: mov.64 v1:out:b64, v2:in:b64 255 acc: none 256 format: [op_v1_4_v2_4, op_v1_16_v2_16] 257 code-template: | 258 # 259 movi.64 v0, %s 260 mov.64 v1, v0 261 lda.64 v0 262 cmp.64 v1 263 description: Check mov.64 instruction moves values from register to register. 264 tags: ['tsan'] 265 cases: 266 - values: ['-1'] 267 - values: ['-0x80'] 268 - values: ['-0xff'] 269 - values: ['-0x8000'] 270 - values: ['-0xffff'] 271 - values: ['-0x80000000'] 272 - values: ['-0xffffffff'] 273 - values: ['-0x8000000000'] 274 - values: ['-0xffffffffff'] 275 - values: ['-0x800000000000'] 276 - values: ['-0xffffffffffff'] 277 - values: ['-0x80000000000000'] 278 - values: ['-0xffffffffffffff'] 279 - values: ['-0x8000000000000000'] 280 - values: ['-0xffffffffffffffff'] 281 - values: ['-0x12345678'] 282 - values: ['-0x87654321'] 283 - values: ['-0x1234567890ABCDEF'] 284 - values: ['-0xFEDCBA0987654321'] 285 286 - file-name: "vals_fp" 287 isa: 288 instructions: 289 - sig: mov.64 v1:out:b64, v2:in:b64 290 acc: none 291 format: [op_v1_4_v2_4, op_v1_16_v2_16] 292 code-template: | 293 # 294 fmovi.64 v0, %s 295 mov.64 v1, v0 296 lda.64 v0 297 fcmpg.64 v1 298 description: Check mov.64 instruction moves values from register to register (FP values). 299 cases: 300 - values: ['0'] 301 - values: ['1'] 302 - values: ['0.00000000000000000000000001'] 303 - case-template: | 304 # 305 fmovi.64 v0, 0x7ff8000000000000 306 mov.64 v1, v0 307 lda.64 v1 308 description: "Test NaN value." 309 case-check-type: check-acc-nan 310 - case-template: | 311 # 312 fmovi.64 v0, 0xFFFFFFFFFFFFFFFF 313 mov.64 v1, v0 314 lda.64 v1 315 description: "Test NaN value." 316 case-check-type: check-acc-nan 317 - values: ['0x0'] 318 - values: ['0x8000000000000000'] 319 description: "Test -0.0." 320 - values: ['0x7ff0000000000000'] 321 description: "Test +Inf." 322 - values: ['0xfff0000000000000'] 323 description: "Test -Inf." 324 - values: ['0x7fefffffffffffff'] 325 description: "Test +max." 326 - values: ['0xffefffffffffffff'] 327 description: "Test -max." 328 - values: ['3.14159265358979323846'] 329 - values: ['-3.14159265358979323846'] 330 - values: ['3.14159265358979323846e200'] 331 - values: ['-3.14159265358979323846e200'] 332 333 - file-name: "type" 334 tags: ['verifier'] 335 isa: 336 instructions: 337 - sig: mov.64 v1:out:b64, v2:in:b64 338 acc: none 339 format: [op_v1_4_v2_4, op_v1_16_v2_16] 340 verification: 341 - v2_type 342 runner-options: ['verifier-failure', 'verifier-debug-config'] 343 header-template: [] 344 code-template: | 345 # 346 .record A {} 347 .record B {} 348 .record panda.String <external> 349 .record panda.Object <external> 350 .function i32 main() { 351 %s 352 *s 353 mov.64 v0, v1 354 ldai 0 355 check-type: no-check 356 description: Check mov.64 with incorrect source register type. Destination type is not checked. 357 template-cases: 358 359 - values: 360 - | 361 # 362 lda.type B 363 sta.obj v0 364 - values: 365 - | 366 # 367 lda.type B[] 368 sta.obj v0 369 - values: 370 - | 371 # 372 lda.type panda.String 373 sta.obj v0 374 - values: 375 - | 376 # 377 lda.type panda.Object 378 sta.obj v0 379 - values: 380 - | 381 # 382 movi v0, 10 383 newarr v0, v0, i32[] 384 - values: 385 - mov.null v0 386 - values: 387 - movi v0, 0 388 - values: 389 - movi.64 v0, 0 390 - values: 391 - fmovi.64 v0, 0 392 cases: 393 - values: 394 - | 395 # 396 lda.type A 397 sta.obj v1 398 - values: 399 - | 400 # 401 lda.type A[] 402 sta.obj v1 403 - values: 404 - | 405 # 406 lda.type panda.String 407 sta.obj v1 408 - values: 409 - | 410 # 411 lda.str "some string" 412 sta.obj v1 413 - values: 414 - | 415 # 416 lda.type panda.Object 417 sta.obj v1 418 - values: 419 - | 420 # 421 movi v1, 10 422 newarr v1, v1, f64[] 423 - values: 424 - mov.null v1 425 - values: 426 - movi v1, 0 427 428 - file-name: uninitialized_regs 429 isa: 430 instructions: 431 - sig: mov.64 v1:out:b64, v2:in:b64 432 acc: none 433 format: [op_v1_4_v2_4, op_v1_16_v2_16] 434 description: Check mov.64 with uninitialized registers. 435 tags: ['verifier'] 436 runner-options: ['verifier-failure', 'verifier-debug-config'] 437 header-template: [] 438 code-template: | 439 # 440 .function i32 main() { 441 %s 442 *s 443 mov.64 %s, *s 444 ldai 0 445 check-type: no-check 446 template-cases: 447 - values: ['', 'v0'] 448 - values: ['', 'v256'] 449 - values: ['', 'v65535'] 450 - values: 451 - movi v2, 0 452 - v2 453 - values: 454 - | 455 # 456 mov.null v1 457 mov.obj v65534, v1 458 - v65534 459 - values: 460 - | 461 # 462 mov.null v1 463 mov.obj v257, v1 464 - v257 465 cases: 466 - values: 467 - '' 468 - v0 469 - values: 470 - '' 471 - v8 472 - values: 473 - '' 474 - v15 475 - values: 476 - '' 477 - v256 478 - values: 479 - '' 480 - v65535 481