gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Reorganize the CPU feature detection

Open antoyo opened this issue 1 year ago • 2 comments

Move the code from i386-rust.cc to i386-rust-and-jit.inc so that it can be reused by libgccjit.

gcc/ChangeLog:

* config/i386/i386-rust-and-jit.inc: New file.
* config/i386/i386-rust.cc: Move code to i386-rust-and-jit.inc.

Here is a checklist to help you with your PR.

  • [x] GCC development requires copyright assignment or the Developer's Certificate of Origin sign-off, see https://gcc.gnu.org/contribute.html or https://gcc.gnu.org/dco.html
  • [x] Read contributing guidlines
  • [ ] make check-rust passes locally (it doesn't pass, but same number of failures as on master)
  • [x] Run clang-format
  • (n/a) [ ] Added any relevant test cases to gcc/testsuite/rust/

Since both libgccjit (via rustc_codegen_gcc) and gccrs need to do the same CPU features detection, refactor this code to avoid duplication.

antoyo avatar Oct 11 '24 21:10 antoyo

As discussed with you, @CohenArthur, here's the PR that will allow us to not have duplication for the CPU features detection.

Some more context on the mailing list.

I already tested this in rustc_codegen_gcc: you can see the libgccjit commit here.

Test results:

		=== rust Summary ===

# of expected passes		9158
# of expected failures		315
# of unsupported tests		8

(same on the master branch)

antoyo avatar Oct 11 '24 21:10 antoyo

cc @davidmalcolm: Is this what you had in mind?

antoyo avatar Oct 11 '24 21:10 antoyo

Waiting for David's opinion but happy to merge this

CohenArthur avatar Oct 28 '24 08:10 CohenArthur

cc @davidmalcolm: Is this what you had in mind?

Yes; this looks great; thank you.

davidmalcolm avatar Oct 29 '24 21:10 davidmalcolm

Note that we might want to merge this once stage1 opens again @antoyo, as these aren't changes to gcc/rust/ and might require GCC maintainer approval. Or we can ask if we're free to upstream this on IRC

CohenArthur avatar Oct 30 '24 11:10 CohenArthur

@CohenArthur Given the "rust" and "jit" in the file names I think these patches can be approved by rust and jit maintainers. Given that you are the former and I'm the latter (and yes, I do approve the patch), I think you're good to go - but it should be posted to gcc-patches.

davidmalcolm avatar Oct 30 '24 13:10 davidmalcolm

@CohenArthur: I thought we were in stage 1 until November 18?

antoyo avatar Nov 04 '24 14:11 antoyo

@CohenArthur: I thought we were in stage 1 until November 18?

Yes, but that is only in 14 days - given how long it usually takes to get reviews and considering that reviewers will be pretty busy until that day, I consider it a bit late. However, as David said, we're probably maintainers of our config files for our respective frontends, so I'm happy to push this as part of our upstreaming process and post the patch upstream

CohenArthur avatar Nov 05 '24 11:11 CohenArthur

Thanks @CohenArthur! Could you please CC me when you post this on the mailing list?

antoyo avatar Nov 05 '24 12:11 antoyo

Yes will do @antoyo!

CohenArthur avatar Nov 05 '24 13:11 CohenArthur