This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit b91a3a0
committed
Auto merge of rust-lang#132472 - taiki-e:sparc-asm, r=Amanieu
Basic inline assembly support for SPARC and SPARC64
This implements asm_experimental_arch (tracking issue rust-lang#93335) for SPARC and SPARC64.
This PR includes:
- General-purpose registers `r[0-31]` (`reg` register class, LLVM/GCC constraint `r`)
Supported types: i8, i16, i32, i64 (SPARC64-only)
Aliases: `g[0-7]` (`r[0-7]`), `o[0-7]` (`r[8-15]`), `l[0-7]` (`r[16-23]`), `i[0-7]` (`r[24-31]`)
- `y` register (clobber-only, needed for clobber_abi)
- preserves_flags: Integer condition codes (`icc`, `xcc`) and floating-point condition codes (`fcc*`)
The following are *not* included:
- 64-bit integer support on SPARC-V8+'s global or out registers (`g[0-7]`, `o[0-7]`): GCC's `h` constraint (it seems that there is no corresponding constraint in LLVM?)
- Floating-point registers (LLVM/GCC constraint `e`/`f`):
I initially tried to implement this, but postponed it for now because there seemed to be several parts in LLVM that behaved differently than in the LangRef's description.
- clobber_abi: Support for floating-point registers is needed.
Refs:
- LLVM
- Reserved registers https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp#L52
- Register definitions https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.td
- Supported constraints https://llvm.org/docs/LangRef.html#supported-constraint-code-list
- GCC
- Reserved registers https://github.com/gcc-mirror/gcc/blob/63b6967b06b5387821c4e5f2c113da6aaeeae2b7/gcc/config/sparc/sparc.h#L633-L658
- Supported constraints https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
- SPARC ISA/ABI
- (64-bit ISA) The SPARC Architecture Manual, Version 9
(32-bit ISA) The SPARC Architecture Manual, Version 8
(64-bit ABI) System V Application Binary Interface SPARC Version 9 Processor Supplement, Rev 1.35
(32-bit ABI) System V Application Binary Interface SPARC Processor Supplement, Third Edition
The above docs can be downloaded from https://sparc.org/technical-documents
- (32-bit V8+ ABI) The V8+ Technical Specification
https://temlib.org/pub/SparcStation/Standards/V8plus.pdf
cc `@thejpster` (sparc-unknown-none-elf target maintainer)
(AFAIK, other sparc/sprac64 targets don't have target maintainers)
r? `@Amanieu`
`@rustbot` label +O-SPARC +A-inline-assemblyFile tree
14 files changed
+770
-43
lines changed- compiler
- rustc_codegen_gcc/src
- rustc_codegen_llvm/src
- rustc_span/src
- rustc_target/src/asm
- src/doc/unstable-book/src/language-features
- tests
- assembly/asm
- codegen/asm
- ui/asm
- sparc
14 files changed
+770
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
| 691 | + | |
| 692 | + | |
691 | 693 | | |
692 | 694 | | |
693 | 695 | | |
| |||
767 | 769 | | |
768 | 770 | | |
769 | 771 | | |
| 772 | + | |
| 773 | + | |
770 | 774 | | |
771 | 775 | | |
772 | 776 | | |
| |||
946 | 950 | | |
947 | 951 | | |
948 | 952 | | |
| 953 | + | |
949 | 954 | | |
950 | 955 | | |
951 | 956 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
271 | 280 | | |
272 | 281 | | |
273 | 282 | | |
| |||
672 | 681 | | |
673 | 682 | | |
674 | 683 | | |
| 684 | + | |
| 685 | + | |
675 | 686 | | |
676 | 687 | | |
677 | 688 | | |
| |||
765 | 776 | | |
766 | 777 | | |
767 | 778 | | |
| 779 | + | |
768 | 780 | | |
769 | 781 | | |
770 | 782 | | |
| |||
835 | 847 | | |
836 | 848 | | |
837 | 849 | | |
| 850 | + | |
| 851 | + | |
838 | 852 | | |
839 | 853 | | |
840 | 854 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2175 | 2175 | | |
2176 | 2176 | | |
2177 | 2177 | | |
| 2178 | + | |
2178 | 2179 | | |
2179 | 2180 | | |
2180 | 2181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| 213 | + | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| |||
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
| |||
260 | 264 | | |
261 | 265 | | |
262 | 266 | | |
| 267 | + | |
| 268 | + | |
263 | 269 | | |
264 | 270 | | |
265 | 271 | | |
| |||
286 | 292 | | |
287 | 293 | | |
288 | 294 | | |
| 295 | + | |
289 | 296 | | |
290 | 297 | | |
291 | 298 | | |
| |||
309 | 316 | | |
310 | 317 | | |
311 | 318 | | |
| 319 | + | |
312 | 320 | | |
313 | 321 | | |
314 | 322 | | |
| |||
329 | 337 | | |
330 | 338 | | |
331 | 339 | | |
| 340 | + | |
332 | 341 | | |
333 | 342 | | |
334 | 343 | | |
| |||
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
364 | 376 | | |
365 | 377 | | |
366 | 378 | | |
| |||
393 | 405 | | |
394 | 406 | | |
395 | 407 | | |
| 408 | + | |
396 | 409 | | |
397 | 410 | | |
398 | 411 | | |
| |||
420 | 433 | | |
421 | 434 | | |
422 | 435 | | |
| 436 | + | |
423 | 437 | | |
424 | 438 | | |
425 | 439 | | |
| |||
440 | 454 | | |
441 | 455 | | |
442 | 456 | | |
| 457 | + | |
443 | 458 | | |
444 | 459 | | |
445 | 460 | | |
| |||
463 | 478 | | |
464 | 479 | | |
465 | 480 | | |
| 481 | + | |
466 | 482 | | |
467 | 483 | | |
468 | 484 | | |
| |||
487 | 503 | | |
488 | 504 | | |
489 | 505 | | |
| 506 | + | |
490 | 507 | | |
491 | 508 | | |
492 | 509 | | |
| |||
513 | 530 | | |
514 | 531 | | |
515 | 532 | | |
| 533 | + | |
516 | 534 | | |
517 | 535 | | |
518 | 536 | | |
| |||
542 | 560 | | |
543 | 561 | | |
544 | 562 | | |
| 563 | + | |
545 | 564 | | |
546 | 565 | | |
547 | 566 | | |
| |||
571 | 590 | | |
572 | 591 | | |
573 | 592 | | |
| 593 | + | |
574 | 594 | | |
575 | 595 | | |
576 | 596 | | |
| |||
599 | 619 | | |
600 | 620 | | |
601 | 621 | | |
| 622 | + | |
602 | 623 | | |
603 | 624 | | |
604 | 625 | | |
| |||
632 | 653 | | |
633 | 654 | | |
634 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
635 | 659 | | |
636 | 660 | | |
637 | 661 | | |
| |||
658 | 682 | | |
659 | 683 | | |
660 | 684 | | |
| 685 | + | |
661 | 686 | | |
662 | 687 | | |
663 | 688 | | |
| |||
843 | 868 | | |
844 | 869 | | |
845 | 870 | | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
846 | 876 | | |
847 | 877 | | |
848 | 878 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
0 commit comments