Source file src/cmd/internal/obj/arm64/encoding_gen.go
1 // Code generated by 'instgen -o=$GOROOT # from go install golang.org/x/arch/arm64/instgen@latest'. 2 3 package arm64 4 5 const ( 6 enc_NIL component = iota 7 enc_tszh_tszl 8 enc_M 9 enc_PNd 10 enc_Pd 11 enc_Pdm 12 enc_Pdn 13 enc_Pg 14 enc_Pm 15 enc_Pn 16 enc_Pv 17 enc_Vd 18 enc_Za 19 enc_Zd 20 enc_Zda 21 enc_Zdn 22 enc_Zk 23 enc_Zm 24 enc_Zn 25 enc_size 26 enc_size0 27 enc_sz 28 ) 29 30 // encodeArngBCheck is the implementation of the following encoding logic: 31 // Check this is a B arrangement 32 func encodeArngBCheck(v uint32) (uint32, bool) { 33 if v == ARNG_B { 34 return 0, true 35 } 36 return 0, false 37 } 38 39 // encodeArngDCheck is the implementation of the following encoding logic: 40 // Check this is a D arrangement 41 func encodeArngDCheck(v uint32) (uint32, bool) { 42 if v == ARNG_D { 43 return 0, true 44 } 45 return 0, false 46 } 47 48 // encodeArngHCheck is the implementation of the following encoding logic: 49 // Check this is a H arrangement 50 func encodeArngHCheck(v uint32) (uint32, bool) { 51 if v == ARNG_H { 52 return 0, true 53 } 54 return 0, false 55 } 56 57 // encodeArngQCheck is the implementation of the following encoding logic: 58 // Check this is a Q arrangement 59 func encodeArngQCheck(v uint32) (uint32, bool) { 60 if v == ARNG_Q { 61 return 0, true 62 } 63 return 0, false 64 } 65 66 // encodeArngSCheck is the implementation of the following encoding logic: 67 // Check this is a S arrangement 68 func encodeArngSCheck(v uint32) (uint32, bool) { 69 if v == ARNG_S { 70 return 0, true 71 } 72 return 0, false 73 } 74 75 // encodeMergePredCheck is the implementation of the following encoding logic: 76 // Check this is a merging predication 77 func encodeMergePredCheck(v uint32) (uint32, bool) { 78 if v == PRED_M { 79 return 0, true 80 } 81 return 0, false 82 } 83 84 // encodeZeroPredCheck is the implementation of the following encoding logic: 85 // Check this is a zeroing predication 86 func encodeZeroPredCheck(v uint32) (uint32, bool) { 87 if v == PRED_Z { 88 return 0, true 89 } 90 return 0, false 91 } 92 93 // encodeSzByteHalfword is the implementation of the following encoding logic: 94 // For the "Byte and halfword" variant: is the size specifier, 95 // sz <T> 96 // 0 B 97 // 1 H 98 // bit range mappings: 99 // sz: [22:23) 100 func encodeSzByteHalfword(v uint32) (uint32, bool) { 101 switch v { 102 case ARNG_B: 103 return 0, true 104 case ARNG_H: 105 return 1 << 22, true 106 } 107 return 0, false 108 } 109 110 // encodeSizeByteMergeZero is the implementation of the following encoding logic: 111 // For the "Byte, merging" and "Byte, zeroing" variants: is the size specifier, 112 // size <T> 113 // 00 RESERVED 114 // 01 H 115 // 10 S 116 // 11 D 117 // bit range mappings: 118 // size: [22:24) 119 func encodeSizeByteMergeZero(v uint32) (uint32, bool) { 120 switch v { 121 case ARNG_H: 122 return 1 << 22, true 123 case ARNG_S: 124 return 2 << 22, true 125 case ARNG_D: 126 return 3 << 22, true 127 } 128 return 0, false 129 } 130 131 // encodeSize0HalfwordMergeZero is the implementation of the following encoding logic: 132 // For the "Halfword, merging" and "Halfword, zeroing" variants: is the size specifier, 133 // size[0] <T> 134 // 0 S 135 // 1 D 136 // bit range mappings: 137 // size: [22:23) 138 func encodeSize0HalfwordMergeZero(v uint32) (uint32, bool) { 139 switch v { 140 case ARNG_S: 141 return 0, true 142 case ARNG_D: 143 return 1 << 22, true 144 } 145 return 0, false 146 } 147 148 // encodeSzWordDoubleword is the implementation of the following encoding logic: 149 // For the "Word and doubleword" variant: is the size specifier, 150 // sz <T> 151 // 0 S 152 // 1 D 153 // bit range mappings: 154 // sz: [22:23) 155 func encodeSzWordDoubleword(v uint32) (uint32, bool) { 156 switch v { 157 case ARNG_S: 158 return 0, true 159 case ARNG_D: 160 return 1 << 22, true 161 } 162 return 0, false 163 } 164 165 // encodeSize16B8H4S2D is the implementation of the following encoding logic: 166 // Is an arrangement specifier, 167 // size <T> 168 // 00 16B 169 // 01 8H 170 // 10 4S 171 // 11 2D 172 // bit range mappings: 173 // size: [22:24) 174 func encodeSize16B8H4S2D(v uint32) (uint32, bool) { 175 switch v { 176 case ARNG_16B: 177 return 0, true 178 case ARNG_8H: 179 return 1 << 22, true 180 case ARNG_4S: 181 return 2 << 22, true 182 case ARNG_2D: 183 return 3 << 22, true 184 } 185 return 0, false 186 } 187 188 // encodeSize8H4S2D is the implementation of the following encoding logic: 189 // Is an arrangement specifier, 190 // size <T> 191 // 00 RESERVED 192 // 01 8H 193 // 10 4S 194 // 11 2D 195 // bit range mappings: 196 // size: [22:24) 197 func encodeSize8H4S2D(v uint32) (uint32, bool) { 198 switch v { 199 case ARNG_8H: 200 return 1 << 22, true 201 case ARNG_4S: 202 return 2 << 22, true 203 case ARNG_2D: 204 return 3 << 22, true 205 } 206 return 0, false 207 } 208 209 // encodeVd is the implementation of the following encoding logic: 210 // Is the name of the destination SIMD&FP register, encoded in the "Vd" field. 211 // bit range mappings: 212 // Vd: [0:5) 213 func encodeVd(v uint32) (uint32, bool) { 214 return v, true 215 } 216 217 // encodePNd is the implementation of the following encoding logic: 218 // Is the name of the destination scalable predicate register PN8-PN15, with predicate-as-counter encoding, encoded in the "PNd" field. 219 // bit range mappings: 220 // PNd: [0:3) 221 func encodePNd(v uint32) (uint32, bool) { 222 if v >= 24 && v <= 31 { 223 // PN registers starts from 16. 224 return v - 24, true 225 } 226 return 0, false 227 } 228 229 // encodePd is the implementation of the following encoding logic: 230 // Is the name of the destination scalable predicate register, encoded in the "Pd" field. 231 // bit range mappings: 232 // Pd: [0:4) 233 func encodePd(v uint32) (uint32, bool) { 234 return v, true 235 } 236 237 // encodeZd is the implementation of the following encoding logic: 238 // Is the name of the destination scalable vector register, encoded in the "Zd" field. 239 // bit range mappings: 240 // Zd: [0:5) 241 func encodeZd(v uint32) (uint32, bool) { 242 return v, true 243 } 244 245 // encodePdnDest is the implementation of the following encoding logic: 246 // Is the name of the first source and destination scalable predicate register, encoded in the "Pdn" field. 247 // bit range mappings: 248 // Pdn: [0:4) 249 func encodePdnDest(v uint32) (uint32, bool) { 250 return v, true 251 } 252 253 // encodeZdnDest is the implementation of the following encoding logic: 254 // Is the name of the first source and destination scalable vector register, encoded in the "Zdn" field. 255 // bit range mappings: 256 // Zdn: [0:5) 257 func encodeZdnDest(v uint32) (uint32, bool) { 258 return v, true 259 } 260 261 // encodePn59 is the implementation of the following encoding logic: 262 // Is the name of the first source scalable predicate register, encoded in the "Pn" field. 263 // bit range mappings: 264 // Pn: [5:9) 265 func encodePn59(v uint32) (uint32, bool) { 266 return v << 5, true 267 } 268 269 // encodeZn510 is the implementation of the following encoding logic: 270 // Is the name of the first source scalable vector register, encoded in the "Zn" field. 271 // bit range mappings: 272 // Zn: [5:10) 273 func encodeZn510(v uint32) (uint32, bool) { 274 return v << 5, true 275 } 276 277 // encodePg1013 is the implementation of the following encoding logic: 278 // Is the name of the governing scalable predicate register P0-P7, encoded in the "Pg" field. 279 // bit range mappings: 280 // Pg: [10:13) 281 func encodePg1013(v uint32) (uint32, bool) { 282 if v <= 7 { 283 return v << 10, true 284 } 285 return 0, false 286 } 287 288 // encodePg1014 is the implementation of the following encoding logic: 289 // Is the name of the governing scalable predicate register, encoded in the "Pg" field. 290 // bit range mappings: 291 // Pg: [10:14) 292 func encodePg1014(v uint32) (uint32, bool) { 293 return v << 10, true 294 } 295 296 // encodePg59 is the implementation of the following encoding logic: 297 // Is the name of the governing scalable predicate register, encoded in the "Pg" field. 298 // bit range mappings: 299 // Pg: [5:9) 300 func encodePg59(v uint32) (uint32, bool) { 301 return v << 5, true 302 } 303 304 // encodePdmDest is the implementation of the following encoding logic: 305 // Is the name of the second source and destination scalable predicate register, encoded in the "Pdm" field. 306 // bit range mappings: 307 // Pdm: [0:4) 308 func encodePdmDest(v uint32) (uint32, bool) { 309 return v, true 310 } 311 312 // encodeZdaDest is the implementation of the following encoding logic: 313 // Is the name of the second source and destination scalable vector register, encoded in the "Zda" field. 314 // bit range mappings: 315 // Zda: [0:5) 316 func encodeZdaDest(v uint32) (uint32, bool) { 317 return v, true 318 } 319 320 // encodePm1620 is the implementation of the following encoding logic: 321 // Is the name of the second source scalable predicate register, encoded in the "Pm" field. 322 // bit range mappings: 323 // Pm: [16:20) 324 func encodePm1620(v uint32) (uint32, bool) { 325 return v << 16, true 326 } 327 328 // encodeZm1621 is the implementation of the following encoding logic: 329 // Is the name of the second source scalable vector register, encoded in the "Zm" field. 330 // bit range mappings: 331 // Zm: [16:21) 332 func encodeZm1621(v uint32) (uint32, bool) { 333 return v << 16, true 334 } 335 336 // encodeZm510 is the implementation of the following encoding logic: 337 // Is the name of the second source scalable vector register, encoded in the "Zm" field. 338 // bit range mappings: 339 // Zm: [5:10) 340 func encodeZm510(v uint32) (uint32, bool) { 341 return v << 5, true 342 } 343 344 // encodePdnSrcDst is the implementation of the following encoding logic: 345 // Is the name of the source and destination scalable predicate register, encoded in the "Pdn" field. 346 // bit range mappings: 347 // Pdn: [0:4) 348 func encodePdnSrcDst(v uint32) (uint32, bool) { 349 return v, true 350 } 351 352 // encodeZdnSrcDst is the implementation of the following encoding logic: 353 // Is the name of the source and destination scalable vector register, encoded in the "Zdn" field. 354 // bit range mappings: 355 // Zdn: [0:5) 356 func encodeZdnSrcDst(v uint32) (uint32, bool) { 357 return v, true 358 } 359 360 // encodePm59v1 is the implementation of the following encoding logic: 361 // Is the name of the source scalable predicate register, encoded in the "Pm" field. 362 // bit range mappings: 363 // Pm: [5:9) 364 func encodePm59v1(v uint32) (uint32, bool) { 365 return v << 5, true 366 } 367 368 // encodePn59v2 is the implementation of the following encoding logic: 369 // Is the name of the source scalable predicate register, encoded in the "Pn" field. 370 // bit range mappings: 371 // Pn: [5:9) 372 func encodePn59v2(v uint32) (uint32, bool) { 373 return v << 5, true 374 } 375 376 // encodeZn510Src is the implementation of the following encoding logic: 377 // Is the name of the source scalable vector register, encoded in the "Zn" field. 378 // bit range mappings: 379 // Zn: [5:10) 380 func encodeZn510Src(v uint32) (uint32, bool) { 381 return v << 5, true 382 } 383 384 // encodeZda3RdSrcDst is the implementation of the following encoding logic: 385 // Is the name of the third source and destination scalable vector register, encoded in the "Zda" field. 386 // bit range mappings: 387 // Zda: [0:5) 388 func encodeZda3RdSrcDst(v uint32) (uint32, bool) { 389 return v, true 390 } 391 392 // encodeZa16213Rd is the implementation of the following encoding logic: 393 // Is the name of the third source scalable vector register, encoded in the "Za" field. 394 // bit range mappings: 395 // Za: [16:21) 396 func encodeZa16213Rd(v uint32) (uint32, bool) { 397 return v << 16, true 398 } 399 400 // encodeZa5103Rd is the implementation of the following encoding logic: 401 // Is the name of the third source scalable vector register, encoded in the "Za" field. 402 // bit range mappings: 403 // Za: [5:10) 404 func encodeZa5103Rd(v uint32) (uint32, bool) { 405 return v << 5, true 406 } 407 408 // encodeZk5103Rd is the implementation of the following encoding logic: 409 // Is the name of the third source scalable vector register, encoded in the "Zk" field. 410 // bit range mappings: 411 // Zk: [5:10) 412 func encodeZk5103Rd(v uint32) (uint32, bool) { 413 return v << 5, true 414 } 415 416 // encodePv1013 is the implementation of the following encoding logic: 417 // Is the name of the vector select predicate register P0-P7, encoded in the "Pv" field. 418 // bit range mappings: 419 // Pv: [10:13) 420 func encodePv1013(v uint32) (uint32, bool) { 421 return v << 10, true 422 } 423 424 // encodePv1014 is the implementation of the following encoding logic: 425 // Is the name of the vector select predicate register, encoded in the "Pv" field. 426 // bit range mappings: 427 // Pv: [10:14) 428 func encodePv1014(v uint32) (uint32, bool) { 429 return v << 10, true 430 } 431 432 // encodePv59 is the implementation of the following encoding logic: 433 // Is the name of the vector select predicate register, encoded in the "Pv" field. 434 // bit range mappings: 435 // Pv: [5:9) 436 func encodePv59(v uint32) (uint32, bool) { 437 return v << 5, true 438 } 439 440 // encodePredQualM1617 is the implementation of the following encoding logic: 441 // Is the predication qualifier, 442 // M <ZM> 443 // 0 Z 444 // 1 M 445 // bit range mappings: 446 // M: [16:17) 447 func encodePredQualM1617(v uint32) (uint32, bool) { 448 switch v { 449 case PRED_Z: 450 return 0, true 451 case PRED_M: 452 return 1 << 16, true 453 } 454 return 0, false 455 } 456 457 // encodePredQualM45 is the implementation of the following encoding logic: 458 // Is the predication qualifier, 459 // M <ZM> 460 // 0 Z 461 // 1 M 462 // bit range mappings: 463 // M: [4:5) 464 func encodePredQualM45(v uint32) (uint32, bool) { 465 switch v { 466 case PRED_Z: 467 return 0, true 468 case PRED_M: 469 return 1 << 4, true 470 } 471 return 0, false 472 } 473 474 // encodeSizeBHSD2224 is the implementation of the following encoding logic: 475 // Is the size specifier, 476 // size <T> 477 // 00 B 478 // 01 H 479 // 10 S 480 // 11 D 481 // bit range mappings: 482 // size: [22:24) 483 func encodeSizeBHSD2224(v uint32) (uint32, bool) { 484 switch v { 485 case ARNG_B: 486 return 0 << 22, true 487 case ARNG_H: 488 return 1 << 22, true 489 case ARNG_S: 490 return 2 << 22, true 491 case ARNG_D: 492 return 3 << 22, true 493 } 494 return 0, false 495 } 496 497 // encodeSizeBHS2224 is the implementation of the following encoding logic: 498 // Is the size specifier, 499 // size <T> 500 // 00 B 501 // 01 H 502 // 10 S 503 // 11 RESERVED 504 // bit range mappings: 505 // size: [22:24) 506 func encodeSizeBHS2224(v uint32) (uint32, bool) { 507 switch v { 508 case ARNG_B: 509 return 0 << 22, true 510 case ARNG_H: 511 return 1 << 22, true 512 case ARNG_S: 513 return 2 << 22, true 514 } 515 return 0, false 516 } 517 518 // encodeSizeBHS2224Offset1 is the implementation of the following encoding logic: 519 // Is the size specifier, 520 // size <T> 521 // 00 RESERVED 522 // 01 B 523 // 10 H 524 // 11 S 525 // bit range mappings: 526 // size: [22:24) 527 func encodeSizeBHS2224Offset1(v uint32) (uint32, bool) { 528 switch v { 529 case ARNG_B: 530 return 1 << 22, true 531 case ARNG_H: 532 return 2 << 22, true 533 case ARNG_S: 534 return 3 << 22, true 535 } 536 return 0, false 537 } 538 539 // encodeSizeHSD1315 is the implementation of the following encoding logic: 540 // Is the size specifier, 541 // size <T> 542 // 00 RESERVED 543 // 01 H 544 // 10 S 545 // 11 D 546 // bit range mappings: 547 // size: [13:15) 548 func encodeSizeHSD1315(v uint32) (uint32, bool) { 549 switch v { 550 case ARNG_H: 551 return 1 << 13, true 552 case ARNG_S: 553 return 2 << 13, true 554 case ARNG_D: 555 return 3 << 13, true 556 } 557 return 0, false 558 } 559 560 // encodeSizeHSD1719 is the implementation of the following encoding logic: 561 // Is the size specifier, 562 // size <T> 563 // 00 RESERVED 564 // 01 H 565 // 10 S 566 // 11 D 567 // bit range mappings: 568 // size: [17:19) 569 func encodeSizeHSD1719(v uint32) (uint32, bool) { 570 switch v { 571 case ARNG_H: 572 return 1 << 17, true 573 case ARNG_S: 574 return 2 << 17, true 575 case ARNG_D: 576 return 3 << 17, true 577 } 578 return 0, false 579 } 580 581 // encodeSizeHSD2224 is the implementation of the following encoding logic: 582 // Is the size specifier, 583 // size <T> 584 // 00 RESERVED 585 // 01 H 586 // 10 S 587 // 11 D 588 // bit range mappings: 589 // size: [22:24) 590 func encodeSizeHSD2224(v uint32) (uint32, bool) { 591 switch v { 592 case ARNG_H: 593 return 1 << 22, true 594 case ARNG_S: 595 return 2 << 22, true 596 case ARNG_D: 597 return 3 << 22, true 598 } 599 return 0, false 600 } 601 602 // encodeSizeHSD2224No00 is the implementation of the following encoding logic: 603 // Is the size specifier, 604 // size <T> 605 // 01 H 606 // 10 S 607 // 11 D 608 // bit range mappings: 609 // size: [22:24) 610 func encodeSizeHSD2224No00(v uint32) (uint32, bool) { 611 switch v { 612 case ARNG_H: 613 return 1 << 22, true 614 case ARNG_S: 615 return 2 << 22, true 616 case ARNG_D: 617 return 3 << 22, true 618 } 619 return 0, false 620 } 621 622 // encodeSizeHD2224 is the implementation of the following encoding logic: 623 // Is the size specifier, 624 // size <T> 625 // 01 H 626 // 1x D 627 // bit range mappings: 628 // size: [22:24) 629 func encodeSizeHD2224(v uint32) (uint32, bool) { 630 switch v { 631 case ARNG_H: 632 return 1 << 22, true 633 case ARNG_D: 634 return 3 << 22, true 635 } 636 return 0, false 637 } 638 639 // encodeSizeTbBHSD2224 is the implementation of the following encoding logic: 640 // Is the size specifier, 641 // size <Tb> 642 // 00 B 643 // 01 H 644 // 10 S 645 // 11 D 646 // bit range mappings: 647 // size: [22:24) 648 func encodeSizeTbBHSD2224(v uint32) (uint32, bool) { 649 switch v { 650 case ARNG_B: 651 return 0 << 22, true 652 case ARNG_H: 653 return 1 << 22, true 654 case ARNG_S: 655 return 2 << 22, true 656 case ARNG_D: 657 return 3 << 22, true 658 } 659 return 0, false 660 } 661 662 // encodeSizeTbBHS2224 is the implementation of the following encoding logic: 663 // Is the size specifier, 664 // size <Tb> 665 // 00 RESERVED 666 // 01 B 667 // 10 H 668 // 11 S 669 // bit range mappings: 670 // size: [22:24) 671 func encodeSizeTbBHS2224(v uint32) (uint32, bool) { 672 switch v { 673 case ARNG_B: 674 return 1 << 22, true 675 case ARNG_H: 676 return 2 << 22, true 677 case ARNG_S: 678 return 3 << 22, true 679 } 680 return 0, false 681 } 682 683 // encodeSizeTbHSD2224Offset1 is the implementation of the following encoding logic: 684 // Is the size specifier, 685 // size <Tb> 686 // 00 RESERVED 687 // 01 H 688 // 10 S 689 // 11 D 690 // bit range mappings: 691 // size: [22:24) 692 func encodeSizeTbHSD2224Offset1(v uint32) (uint32, bool) { 693 switch v { 694 case ARNG_H: 695 return 1 << 22, true 696 case ARNG_S: 697 return 2 << 22, true 698 case ARNG_D: 699 return 3 << 22, true 700 } 701 return 0, false 702 } 703 704 // encodeSizeTbBS2224 is the implementation of the following encoding logic: 705 // Is the size specifier, 706 // size <Tb> 707 // 01 B 708 // 1x S 709 // bit range mappings: 710 // size: [22:24) 711 func encodeSizeTbBS2224(v uint32) (uint32, bool) { 712 switch v { 713 case ARNG_B: 714 return 1 << 22, true 715 case ARNG_S: 716 return 3 << 22, true 717 } 718 return 0, false 719 } 720 721 // encodeSize0BH2223 is the implementation of the following encoding logic: 722 // Is the size specifier, 723 // size[0] <T> 724 // 0 B 725 // 1 H 726 // bit range mappings: 727 // size: [22:23) 728 func encodeSize0BH2223(v uint32) (uint32, bool) { 729 switch v { 730 case ARNG_B: 731 return 0 << 22, true 732 case ARNG_H: 733 return 1 << 22, true 734 } 735 return 0, false 736 } 737 738 // encodeSize0SD2223 is the implementation of the following encoding logic: 739 // Is the size specifier, 740 // size[0] <T> 741 // 0 S 742 // 1 D 743 // bit range mappings: 744 // size: [22:23) 745 func encodeSize0SD2223(v uint32) (uint32, bool) { 746 switch v { 747 case ARNG_S: 748 return 0 << 22, true 749 case ARNG_D: 750 return 1 << 22, true 751 } 752 return 0, false 753 } 754 755 // encodeSize0TbBH2223 is the implementation of the following encoding logic: 756 // Is the size specifier, 757 // size[0] <Tb> 758 // 0 B 759 // 1 H 760 // bit range mappings: 761 // size: [22:23) 762 func encodeSize0TbBH2223(v uint32) (uint32, bool) { 763 switch v { 764 case ARNG_B: 765 return 0 << 22, true 766 case ARNG_H: 767 return 1 << 22, true 768 } 769 return 0, false 770 } 771 772 // encodeSzSD1415 is the implementation of the following encoding logic: 773 // Is the size specifier, 774 // sz <T> 775 // 0 S 776 // 1 D 777 // bit range mappings: 778 // sz: [14:15) 779 func encodeSzSD1415(v uint32) (uint32, bool) { 780 switch v { 781 case ARNG_S: 782 return 0 << 14, true 783 case ARNG_D: 784 return 1 << 14, true 785 } 786 return 0, false 787 } 788 789 // encodeSzSD1718 is the implementation of the following encoding logic: 790 // Is the size specifier, 791 // sz <T> 792 // 0 S 793 // 1 D 794 // bit range mappings: 795 // sz: [17:18) 796 func encodeSzSD1718(v uint32) (uint32, bool) { 797 switch v { 798 case ARNG_S: 799 return 0 << 17, true 800 case ARNG_D: 801 return 1 << 17, true 802 } 803 return 0, false 804 } 805 806 // encodeSzSD2223 is the implementation of the following encoding logic: 807 // Is the size specifier, 808 // sz <T> 809 // 0 S 810 // 1 D 811 // bit range mappings: 812 // sz: [22:23) 813 func encodeSzSD2223(v uint32) (uint32, bool) { 814 switch v { 815 case ARNG_S: 816 return 0 << 22, true 817 case ARNG_D: 818 return 1 << 22, true 819 } 820 return 0, false 821 } 822 823 // encodeTszhTszlBHS is the implementation of the following encoding logic: 824 // Is the size specifier, 825 // tszh tszl <T> 826 // 0 00 RESERVED 827 // 0 01 B 828 // 0 10 H 829 // 0 11 RESERVED 830 // 1 00 S 831 // 1 01 RESERVED 832 // 1 1x RESERVED 833 // bit range mappings: 834 // tszh: [22:23) 835 // tszl: [19:21) 836 func encodeTszhTszlBHS(v uint32) (uint32, bool) { 837 switch v { 838 case ARNG_B: 839 return 0<<22 | 1<<19, true 840 case ARNG_H: 841 return 0<<22 | 2<<19, true 842 case ARNG_S: 843 return 1 << 22, true 844 } 845 return 0, false 846 } 847 848 // encodeTszhTszlTbHSD is the implementation of the following encoding logic: 849 // Is the size specifier, 850 // tszh tszl <Tb> 851 // 0 00 RESERVED 852 // 0 01 H 853 // 0 10 S 854 // 0 11 RESERVED 855 // 1 00 D 856 // 1 01 RESERVED 857 // 1 1x RESERVED 858 // bit range mappings: 859 // tszh: [22:23) 860 // tszl: [19:21) 861 func encodeTszhTszlTbHSD(v uint32) (uint32, bool) { 862 switch v { 863 case ARNG_H: 864 return 0<<22 | 1<<19, true 865 case ARNG_S: 866 return 0<<22 | 2<<19, true 867 case ARNG_D: 868 return 1 << 22, true 869 } 870 return 0, false 871 } 872 873 // encodeNoop is the implementation of the following encoding logic: 874 // No-op check, returns true 875 func encodeNoop(v uint32) (uint32, bool) { 876 return 0, true 877 } 878