rustc_codegen_gcc: Progress Report #11
What is rustc_codegen_gcc?
rustc_codegen_gcc is a GCC codegen for rustc, meaning that it can be loaded by the existing rustc frontend, but benefits from GCC by having more architectures supported and having access to GCC’s optimizations.
GCC patches status
There was a lot of progress this month! The following patches were reviewed and merged upstream:
This means that they will be included in the GCC 12 release which should happen in the following days! This also means that all of my patches that were sent for review were merged. I still have a few that I need to prepare and send for review and I’ll send them on the GCC mailing list this month.
State of rustc_codegen_gcc
Since GCC 12 will be released soon, I started looking at rustup in order to allow distributing the GCC codegen along with libgccjit via rustup. Unfortunately, there’s a step before creating the distribution artifacts that panics, so we’re not there yet, but I will continue looking into this when this issue is fixed.
Here’s what has been done this month:
-
Implement saturating_{add, sub} for non-native integer types (thanks to yvt!)
-
Don’t assume /bin/bash is available on every system (thanks to MikaelUrankar!)
-
Add inline assembly sym operands as GCC input operands (thanks to yvt!)
-
Don’t emit .intel_syntax for non-x86 targets (thanks to yvt!)
-
Use the provided pointee type in <Builder as BuilderMethods>::load (thanks to yvt!)
-
Update intrinsics conversion generation (thanks to GuillaumeGomez!)
The work on SIMD is still not completed as I cannot compile stdarch yet, but there’s been good progress. Some of the complexity comes from the fact that there’s not a one-to-one mapping for some SIMD intrinsics.
Here’s a rough summary of what has been implemented:
Feature | Completion |
---|---|
target-specific builtins support in libgccjit |
Done |
support for vector shuffle (equivalent of |
Done |
|
Done |
|
Done |
|
Done |
|
Done |
|
implemented for x86 |
LLVM SIMD intrinsics |
~70% implemented for x86 |
|
50% implemented |
|
20% implemented |
|
20% implemented |
|
0% |
|
0% |
|
0% |
SIMD float intrinsics |
0% |
|
0% |
|
0% |
|
0% |
UI tests progress
Here are the results of running the UI tests in the CI:
Category | Last Month | This Month | Delta |
---|---|---|---|
Passed |
4598 |
4598 |
0 |
Failed |
64 |
64 |
0 |
For the next month, I’ll continue working on SIMD support.
How to contribute
rustc_codegen_gcc
If you want to help on the project itself, please do the following:
-
Run the tests locally.
-
Choose a test that fails.
-
Investigate why it fails.
-
Fix the problem.
Even if you can’t fix the problem, your investigation could help, so if you enjoy staring at assembly code, have fun!
Crates and rustc
If you would like to contribute on adding support for Rust on
currently unsupported platforms, you can help by adding the support
for those platforms in some crates like libc
and object
and also
in the rust compiler itself.
Test this project
Otherwise, you can test this project on new platforms and also compare the assembly with LLVM to see if some optimization is missing.
Good first issue
Finally, another good way to help is to look at good first issues. Those are issues that should be easier to start with.
Thanks for your support!
I wanted to personally thank all the people that sponsor this project: your support is very much appreciated.
A special thanks to the following sponsors:
-
saethlin
-
embark-studios
-
Traverse-Research
-
Shnatsel
A big thank you to bjorn3 for his help, contributions and reviews. And a big thank you to lqd and GuillaumeGomez for answering my questions about rustc’s internals. Another big thank you to Commeownist for his contributions.
Also, a big thank you to the rest of my sponsors:
-
kpp
-
0x7CFE
-
repi
-
nevi-me
-
oleid
-
acshi
-
joshtriplett
-
djc
-
TimNN
-
sdroege
-
pcn
-
alanfalloon
-
steven-joruk
-
davidlattimore
-
Nehliin
-
colelawrence
-
zmanian
-
alexkirsz
-
regiontog
-
berkus
-
belzael
-
vincentdephily
-
jam1garner
-
yvt
-
Shoeboxam
-
evanrichter
-
yerke
-
bes
-
seanpianka
-
srijs
-
kkysen
-
messense
-
riking
-
rafaelcaricio
-
Lemmih
-
memoryruins
-
pthariensflame
-
senden9
-
robjtede
-
Jonas Platte
-
zebp
-
spike grobstein
-
Oliver Marshall
-
Sam Harrington
-
Jonas
-
Jeff Muizelaar
-
Chris Butler
-
sierrafiveseven
-
Joseph Garvin
-
MarcoFalke
-
icewind
-
Tommy Thorn
-
Sebastian Zivota
-
Oskar Nehlin
-
Nicolas Barbier
-
Daniel
-
Thomas Colliers
-
Justin Ossevoort
-
sbstp
-
Chris
-
Bálint Horváth
-
fanquake
-
sstadick
-
luizirber
-
kiyoshigawa
-
robinmoussu
-
Daniel Sheehan
-
Marvin Löbel
-
nacaclanga
and a few others who preferred to stay anonymous.
Former sponsors/patreons:
-
igrr
-
finfet
-
Alovchin91
-
wezm
-
stuhood
-
mexus
-
raymanfx
-
0xdeafbeef
-
ghost
-
gilescope
-
Hofer-Julian
-
olanod
-
Denis Zaletaev
-
Chai T. Rex
-
Paul Ellenbogen
-
Dakota Brink
-
Botlabs
-
Cass
-
Oliver Marshall