Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove most floating-point/integer intrinsics from the compiler #5724

Closed

Conversation

auroranockert
Copy link
Contributor

I am not convinced that this is a great idea, but I wanted to throw this out here since I noticed it was possible to save a few hundred lines of code with no reduction in functionality.

The main ideas of this commit is to remove most of the special implementation for llvm-intrinsics in src/librustc/middle/trans/base.rs and friends, and instead declare them as semi-standard functions instead with a combination of attributes instead.

In the end, this means that the compiler doesn't need to know about every intrinsic and we only need to provide definitions for the ones we use in the core/std library and users can provide the rest if they need them.

@brson
Copy link
Contributor

brson commented Apr 4, 2013

Makes sense to me.

@brson
Copy link
Contributor

brson commented Apr 4, 2013

Thanks.

@auroranockert
Copy link
Contributor Author

I'm really sorry about these silly errors. This attribute does not exist, it has the proper name #[no_mangle] but is not needed.

bors added a commit that referenced this pull request Apr 5, 2013
I am not convinced that this is a great idea, but I wanted to throw this out here since I noticed it was possible to save a few hundred lines of code with no reduction in functionality.

The main ideas of this commit is to remove most of the special implementation for llvm-intrinsics in src/librustc/middle/trans/base.rs and friends, and instead declare them as semi-standard functions instead with a combination of attributes instead.

In the end, this means that the compiler doesn't need to know about every intrinsic and we only need to provide definitions for the ones we use in the core/std library and users can provide the rest if they need them.
@auroranockert
Copy link
Contributor Author

This seems to break the buildbot, if it is related to the modified code, could someone send me the logs?

@brson
Copy link
Contributor

brson commented Apr 6, 2013

I thought I heard graydon mention that one of the bots was running out of memory, so it might not be related to this branch.

It looks like ther's a build error in the sudoku benchmark http://buildbot.rust-lang.org/builders/auto-mac/builds/764/steps/test/logs/stdio

@auroranockert
Copy link
Contributor Author

@brson Oh, that is good to head, because it should work. Especially on OS X, where I did the development. The changed API on the intrinsics might have broken that benchmark. I didn't know that it used the ctlz intrinsic, I didn't grep good enough, mea maxima culpa.

That intrinsic is at least partially broken, since it takes a constant parameter. I am working on a patch to provide them as pragmas, then I'll update the PR. If I cannot do that, I'll just revert the CTTZ/CTLZ intrinsics.

@auroranockert
Copy link
Contributor Author

Status update: I can now call the CTTZ/CTLZ, but I need to clean up the code and make a proper parser for the new function attribute I added to support constant integer arguments.

After it is done, we can see if we want to revert parts of this patch to have the old CTTZ/CTLZ, or the 'new' patch with a small amount of new compiler guck, but which can move all intrinsics into libcore.

@auroranockert
Copy link
Contributor Author

Status update: I have a patch that fixes the cttz/ctlz/memmove-issue here auroranockert@f566870 but it needs work, mainly the changes in src/librustc/middle/foreign.rs, and I need some tips on how to best refactor it.

@auroranockert
Copy link
Contributor Author

I'm closing this, and instead adding the new code as a PR.

flip1995 added a commit to flip1995/rust that referenced this pull request Jun 23, 2020
…anishearth

redundant_pattern_matching: avoid non-`const fn` calls in const contexts

changelog: Avoid suggesting non-`const fn` calls in const contexts in [`redundant_pattern_matching`]

Fixes rust-lang#5697
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 23, 2020
Rollup of 9 pull requests

Successful merges:

 - rust-lang#5178 (clippy-driver: pass all args to rustc if --rustc is present)
 - rust-lang#5705 (Downgrade unnested_or_patterns to pedantic)
 - rust-lang#5709 (Fix ICE in consts::binop)
 - rust-lang#5710 (typo)
 - rust-lang#5712 (Remove `bar` from blacklisted names)
 - rust-lang#5713 (Use lints in Clippy that are enabled in rustc bootstrap)
 - rust-lang#5716 (Fix typo in wildcard_imports)
 - rust-lang#5724 (redundant_pattern_matching: avoid non-`const fn` calls in const contexts)
 - rust-lang#5726 (Fix typo)

Failed merges:

r? @ghost

changelog: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants