Commit Graph

675 Commits

Author SHA1 Message Date
Erik Desjardins
19a648218f remove struct_gep, use manual layout calculations for va_arg 2024-02-26 22:28:09 -05:00
Erik Desjardins
7d086c72f7 always use gep inbounds i8 (ptradd) for field offsets 2024-02-26 22:28:09 -05:00
bors
b4b180c218 Auto merge of #121635 - 823984418:remove_archive_builder_lifetime_a, r=nnethercote
Remove useless lifetime of ArchiveBuilder

`trait ArchiveBuilder<'a>` has a seemingly useless lifetime a, so I remove it. If this is intentional, please reject this PR.

```rust
pub trait ArchiveBuilder<'a> {
    fn add_file(&mut self, path: &Path);

    fn add_archive(
        &mut self,
        archive: &Path,
        skip: Box<dyn FnMut(&str) -> bool + 'static>,
    ) -> io::Result<()>;

    fn build(self: Box<Self>, output: &Path) -> bool;
}
```
2024-02-27 03:27:48 +00:00
823984418
7f34119c1a remove useless lifetime of ArchiveBuilder 2024-02-26 22:37:04 +08:00
Ralf Jung
a06a87b37d rename 'try' intrinsic to 'catch_unwind' 2024-02-26 11:10:18 +01:00
Gary Guo
c7607b024e Implement asm goto for LLVM and GCC backend 2024-02-24 18:50:09 +00:00
tempdragon
2ffe9d1eef feat(int.rs&build.rs): Add location info to arithmetic operators
TODO:
1. Clean the unnecessary locations in builder.rs & int.rs
2. Add demangling support
3. Add debug scope support
4. Add vtable support
5. Clean up builder.rs locations
2024-02-24 20:12:08 +08:00
tempdragon
c638defad7 feat(debuginfo): Init Commit for debuginfo Support
TODO:
1. Add int.rs locations
2. Add demangling support
3. Add debug scope support
4. Add vtable support
5. Clean up builder.rs locations
2024-02-24 20:12:08 +08:00
Ralf Jung
0abd3b76b7 remove simd_reduce_{min,max}_nanless 2024-02-21 20:50:47 +01:00
Ralf Jung
a9b5c0832f make simd_reduce_{mul,add}_unordered use only the 'reassoc' flag, not all fast-math flags 2024-02-21 16:28:20 +01:00
bors
7a991d522a Auto merge of #120718 - saethlin:reasonable-fast-math, r=nnethercote
Add "algebraic" fast-math intrinsics, based on fast-math ops that cannot return poison

Setting all of LLVM's fast-math flags makes our fast-math intrinsics very dangerous, because some inputs are UB. This set of flags permits common algebraic transformations, but according to the [LangRef](https://llvm.org/docs/LangRef.html#fastmath), only the flags `nnan` (no nans) and `ninf` (no infs) can produce poison.

And this uses the algebraic float ops to fix https://github.com/rust-lang/rust/issues/120720

cc `@orlp`
2024-02-21 09:43:33 +00:00
Ben Kimock
6ff147b205 Add "algebraic" versions of the fast-math intrinsics 2024-02-20 12:39:03 -05:00
Antoni Boucher
f6e16e95df Merge branch 'master' into sync_from_rust_2024_02_20 2024-02-20 10:24:06 -05:00
antoyo
3e02db23af
Merge pull request #446 from sadlerap/fix-simd-gather
fix tests/ui/simd/issue-89193.rs and mark as passing
2024-02-18 14:26:57 -05:00
Andy Sadler
4ec4209ff5
use default as output type source in simd_gather
Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2024-02-18 12:40:20 -06:00
Andy Sadler
5ac9bee7f1
fix tests/ui/simd/issue-89193.rs and mark as passing
Work around an issue where usize and isize can sometimes (but not
always) get canonicalized to their corresponding integer type.  This
causes shuffle_vector to panic, since the types of the vectors it got
passed aren't the same.

Also insert a cast on the mask element, since we might get passed a
signed integer of any size, not just i32.  For now, we always cast to
i32.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2024-02-17 17:24:46 -06:00
Antoni Boucher
e116cb7811 Fix to use the correct libgccjit for the CI where 128-bit integers are disabled 2024-02-17 15:16:09 -05:00
Matthias Krüger
bd53510a9f Rollup merge of #121209 - nnethercote:infallible-join_codegen, r=bjorn3
Make `CodegenBackend::join_codegen` infallible.

Because they all are, in practice.

r? ```@bjorn3```
2024-02-17 18:47:42 +01:00
Matthias Krüger
e9aa2540c3 Rollup merge of #121085 - davidtwco:always-eager-diagnostics, r=nnethercote
errors: only eagerly translate subdiagnostics

Subdiagnostics don't need to be lazily translated, they can always be eagerly translated. Eager translation is slightly more complex as we need to have a `DiagCtxt` available to perform the translation, which involves slightly more threading of that context.

This slight increase in complexity should enable later simplifications - like passing `DiagCtxt` into `AddToDiagnostic` and moving Fluent messages into the diagnostic structs rather than having them in separate files (working on that was what led to this change).

r? ```@nnethercote```
2024-02-17 18:47:40 +01:00
Nicholas Nethercote
7b1ac28f1c Make CodegenBackend::join_codegen infallible.
Because they all are, in practice.
2024-02-17 10:51:35 +11:00
Antoni Boucher
af289a5eac Use the default rust mangling 2024-02-16 11:13:26 -05:00
David Wood
ec5328b3d9 errors: only eagerly translate subdiagnostics
Subdiagnostics don't need to be lazily translated, they can always be
eagerly translated. Eager translation is slightly more complex as we need
to have a `DiagCtxt` available to perform the translation, which involves
slightly more threading of that context.

This slight increase in complexity should enable later simplifications -
like passing `DiagCtxt` into `AddToDiagnostic` and moving Fluent messages
into the diagnostic structs rather than having them in separate files
(working on that was what led to this change).

Signed-off-by: David Wood <david@davidtw.co>
2024-02-15 10:34:41 +00:00
Antoni Boucher
de57533e56 Implement dummy emit=llvm-ir 2024-02-14 09:38:56 -05:00
Oli Scherer
64dfa4f455 Teach llvm backend how to fall back to default bodies 2024-02-12 17:50:39 +00:00
Matthias Krüger
5a12a89992 Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwco
Invert diagnostic lints.

That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.

r? ````@davidtwco````
2024-02-09 14:41:50 +01:00
Matthias Krüger
1f5316a769 Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compiler-errors
Remove `ffi_returns_twice` feature

The [tracking issue](https://github.com/rust-lang/rust/issues/58314) and [RFC](https://github.com/rust-lang/rfcs/pull/2633) have been closed for a couple of years.

There is also an attribute gate in R-A which should be removed if this lands.
2024-02-06 22:45:42 +01:00
Michael Goulet
31f7f03c2a Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs 2024-02-06 02:22:58 +00:00
Nicholas Nethercote
007cea3238 Invert diagnostic lints.
That is, change `diagnostic_outside_of_impl` and
`untranslatable_diagnostic` from `allow` to `deny`, because more than
half of the compiler has be converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow`
attributes, which proves that this change is warranted.
2024-02-06 13:12:33 +11:00
Matthias Krüger
fe7be54b91 Rollup merge of #119543 - usamoi:avx512fp16, r=oli-obk
add avx512fp16 to x86 target features

std_detect avx512fp16: https://github.com/rust-lang/stdarch/pull/1508
2024-02-03 21:29:40 +01:00
Antoni Boucher
ad8e820139 Update for rebased gcc 2024-02-02 11:49:32 -05:00
clubby789
04e4c5ddbc Remove ffi_returns_twice feature 2024-01-30 22:09:09 +00:00
Nicholas Nethercote
b9d44eef7a Remove the lifetime from DiagnosticArgValue.
Because it's almost always static.

This makes `impl IntoDiagnosticArg for DiagnosticArgValue` trivial,
which is nice.

There are a few diagnostics constructed in
`compiler/rustc_mir_build/src/check_unsafety.rs` and
`compiler/rustc_mir_transform/src/errors.rs` that now need symbols
converted to `String` with `to_string` instead of `&str` with `as_str`,
but that' no big deal, and worth it for the simplifications elsewhere.
2024-01-30 18:46:06 +11:00
bors
d645e1638d Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obk
Replacement of #114390: Add new intrinsic `is_var_statically_known` and optimize pow for powers of two

This adds a new intrinsic `is_val_statically_known` that lowers to [``@llvm.is.constant.*`](https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic).` It also applies the intrinsic in the int_pow methods to recognize and optimize the idiom `2isize.pow(x)`. See #114390 for more discussion.

While I have extended the scope of the power of two optimization from #114390, I haven't added any new uses for the intrinsic. That can be done in later pull requests.

Note: When testing or using the library, be sure to use `--stage 1` or higher. Otherwise, the intrinsic will be a noop and the doctests will be skipped. If you are trying out edits, you may be interested in [`--keep-stage 0`](https://rustc-dev-guide.rust-lang.org/building/suggested.html#faster-builds-with---keep-stage).

Fixes #47234
Resolves #114390
`@Centri3`
2024-01-25 05:16:53 +00:00
Nicholas Thompson
b2a7afd898 Further Implement is_val_statically_known 2024-01-23 12:02:31 -05:00
usamoi
0783d45057 add avx512fp16 to x86 target features 2024-01-13 13:50:10 +08:00
Nicholas Nethercote
558d051b1d Rename {create,emit}_warning as {create,emit}_warn.
For consistency with `warn`/`struct_warn`, and also `{create,emit}_err`,
all of which use an abbreviated form.
2024-01-10 07:33:06 +11:00
vuittont60
f8e079a171
Fix typo src/intrinsic/llvm.rs 2024-01-09 10:53:11 +08:00
vuittont60
4e8627cf89
Fix typo src/base.rs 2024-01-09 10:53:00 +08:00
Michael Goulet
41b758f437 Rollup merge of #119538 - nnethercote:cleanup-errors-5, r=compiler-errors
Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to https://github.com/rust-lang/rust/pull/119171.

r? ````@compiler-errors````
2024-01-05 10:57:21 -05:00
Matthias Krüger
fe71e04f7f Rollup merge of #119431 - taiki-e:asm-s390x-reg-addr, r=Amanieu
Support reg_addr register class in s390x inline assembly

In s390x, `r0` cannot be used as an address register (it is evaluated as zero in an address context).

Therefore, currently, in assemblies involving memory accesses, `r0` must be [marked as clobbered](1a1155653a/src/arch/s390x.rs (L58)) or [explicitly used to a non-address](1a1155653a/src/arch/s390x.rs (L135)) or explicitly use an address register to prevent `r0` from being allocated to a register for the address.

This patch adds a register class for allocating general-purpose registers, except `r0`, to make it easier to use address registers. (powerpc already has a register class (reg_nonzero) for a similar purpose.)

This is identical to the `a` constraint in LLVM and GCC:

https://llvm.org/docs/LangRef.html#supported-constraint-code-list
> a: A 32, 64, or 128-bit integer address register (excludes R0, which in an address context evaluates as zero).

https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
> a
> Address register (general purpose register except r0)

cc ``@uweigand``

r? ``@Amanieu``
2024-01-04 15:33:59 +01:00
Guillaume Gomez
b5681ca4aa Update intrinsics conversion 2024-01-03 15:27:19 +01:00
Taiki Endo
f93e985664 Support reg_addr register class in s390x inline assembly 2024-01-03 18:00:37 +09:00
Nicholas Nethercote
a56eff2b41 Rename some Diagnostic setters.
`Diagnostic` has 40 methods that return `&mut Self` and could be
considered setters. Four of them have a `set_` prefix. This doesn't seem
necessary for a type that implements the builder pattern. This commit
removes the `set_` prefixes on those four methods.
2024-01-03 19:40:20 +11:00
bors
a2efaf0030 Auto merge of #118705 - WaffleLapkin:codegen-atomic-exhange-untuple, r=cjgillot
Change `rustc_codegen_ssa`'s `atomic_cmpxchg` interface to return a pair of values

Doesn't change much, but a little nicer that way.
2023-12-30 07:42:19 +00:00
Michael Goulet
eca05c6cb0 Remove movability from TyKind::Coroutine 2023-12-28 16:35:01 +00:00
Bernd Schmidt
69b5a9f2eb Change rustc_codegen_ssa's atomic_cmpxchg interface to return a pair of values 2023-12-28 09:40:47 +00:00
Nicholas Nethercote
02ed790631 Remove Session methods that duplicate DiagCtxt methods.
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Antoni Boucher
a53495ab45 Add comment 2023-12-21 11:18:11 -05:00
antoyo
db494375ab
Merge pull request #382 from sadlerap/impl-generic-arithmetic-pass
simd: implement missing intrinsics from simd/generic-arithmetic-pass.rs
2023-12-19 13:00:35 -05:00
Nicholas Nethercote
472ea06999 Add level arg to into_diagnostic.
And make all hand-written `IntoDiagnostic` impls generic, by using
`DiagnosticBuilder::new(dcx, level, ...)` instead of e.g.
`dcx.struct_err(...)`.

This means the `create_*` functions are the source of the error level.
This change will let us remove `struct_diagnostic`.

Note: `#[rustc_lint_diagnostics]` is added to `DiagnosticBuilder::new`,
it's necessary to pass diagnostics tests now that it's used in
`into_diagnostic` functions.
2023-12-19 09:19:25 +11:00
Nicholas Nethercote
5ea71c1150 Rename many DiagCtxt arguments. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote
a5c63ae13b Rename CodegenContext::create_diag_handler as CodegenContext::create_dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote
590e0d9573 Rename Handler as DiagCtxt. 2023-12-18 16:06:19 +11:00
bors
335e3ec566 Auto merge of #118828 - mu001999:master, r=b-naber
Remove dead codes in rustc_codegen_gcc

Detected by #118257
2023-12-17 12:15:56 +00:00
Urgau
b1affb9321 Move rustc_codegen_ssa target features to rustc_target 2023-12-14 14:40:55 +01:00
Lukasz Anforowicz
e1f039f562 Add unstable -Zdefault-hidden-visibility cmdline flag for rustc.
The new flag has been described in the Major Change Proposal at
https://github.com/rust-lang/compiler-team/issues/656
2023-12-13 21:14:23 +00:00
r0cky
92de9d4210 Remove dead codes 2023-12-11 23:24:32 +08:00
bors
c578f4302c Auto merge of #117873 - quininer:android-emutls, r=Amanieu
Add emulated TLS support

This is a reopen of https://github.com/rust-lang/rust/pull/96317 . many android devices still only use 128 pthread keys, so using emutls can be helpful.

Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false.

This commit has some changes to allow users to enable emutls:

1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key.
2. when using emutls, decorate symbol names to find thread local symbol correctly.
3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.

r? `@Amanieu`
2023-12-09 05:32:35 +00:00
bors
17f0dd5898 Auto merge of #118324 - RalfJung:ctfe-read-only-pointers, r=saethlin
compile-time evaluation: detect writes through immutable pointers

This has two motivations:
- it unblocks https://github.com/rust-lang/rust/pull/116745 (and therefore takes a big step towards `const_mut_refs` stabilization), because we can now detect if the memory that we find in `const` can be interned as "immutable"
- it would detect the UB that was uncovered in https://github.com/rust-lang/rust/pull/117905, which was caused by accidental stabilization of `copy` functions in `const` that can only be called with UB

When UB is detected, we emit a future-compat warn-by-default lint. This is not a breaking change, so completely in line with [the const-UB RFC](https://rust-lang.github.io/rfcs/3016-const-ub.html), meaning we don't need t-lang FCP here. I made the lint immediately show up for dependencies since it is nearly impossible to even trigger this lint without `const_mut_refs` -- the accidentally stabilized `copy` functions are the only way this can happen, so the crates that popped up in #117905 are the only causes of such UB (in the code that crater covers), and the three cases of UB that we know about have all been fixed in their respective crates already.

The way this is implemented is by making use of the fact that our interpreter is already generic over the notion of provenance. For CTFE we now use the new `CtfeProvenance` type which is conceptually an `AllocId` plus a boolean `immutable` flag (but packed for a more efficient representation). This means we can mark a pointer as immutable when it is created as a shared reference. The flag will be propagated to all pointers derived from this one. We can then check the immutable flag on each write to reject writes through immutable pointers.

I just hope perf works out.
2023-12-07 18:11:01 +00:00
Ralf Jung
cb32ffd8da ctfe interpreter: extend provenance so that it can track whether a pointer is immutable 2023-12-07 17:46:36 +01:00
quininer
2baa073fb1 Add emulated TLS support
Currently LLVM uses emutls by default
for some targets (such as android, openbsd),
but rust does not use it, because `has_thread_local` is false.

This commit has some changes to allow users to enable emutls:

1. add `-Zhas-thread-local` flag to specify
    that std uses `#[thread_local]` instead of pthread key.
2. when using emutls, decorate symbol names
    to find thread local symbol correctly.
3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated`
    to explicitly specify whether to generate emutls.
2023-12-07 00:21:32 +08:00
Nicholas Nethercote
f9a228df48 Rename some arguments.
`sess` is a terribly misleading name for a `Handler`! This confused me
for a bit.
2023-12-04 18:57:41 +11:00
Andy Sadler
3a221320eb
fix simd_neg implementation for ints
gcc_not would panic upon encountering a vector type, which is not what
we want here.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:42 -06:00
Andy Sadler
03e11a214e
impl simd_ctlz/simd_cttz intrinsic
Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:42 -06:00
Andy Sadler
8d42a82b6e
impl simd_bitreverse intrinsic
If we're running against a patched libgccjit, use an algorithm similar
to what LLVM uses for this intrinsic.  Otherwise, fallback to a
per-element bitreverse.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:34 -06:00
Andy Sadler
70586a23a7
fix simd_frem intrinsic implementation
The simd intrinsic handler was delegating implementation of `simd_frem`
to `Builder::frem`, which wasn't able to handle vector-typed inputs.  To
fix this, teach this method how to handle vector inputs.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:23 -06:00
Andy Sadler
cc7c9bea15
implement simd_bswap intrinsic
Implements lane-local byte swapping through vector shuffles.  While this
is more setup than non-vector shuffles, this implementation can shuffle
multiple integers concurrently.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:17 -06:00
Nicholas Nethercote
8e13be084a Use rustc_fluent_macro::fluent_messages! directly.
Currently we always do this:
```
use rustc_fluent_macro::fluent_messages;
...
fluent_messages! { "./example.ftl" }
```
But there is no need, we can just do this everywhere:
```
rustc_fluent_macro::fluent_messages! { "./example.ftl" }
```
which is shorter.
2023-11-26 08:38:40 +11:00
Nicholas Nethercote
4de5d372aa Avoid need for {D,Subd}iagnosticMessage imports.
The `fluent_messages!` macro produces uses of
`crate::{D,Subd}iagnosticMessage`, which means that every crate using
the macro must have this import:
```
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
```

This commit changes the macro to instead use
`rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the
imports.
2023-11-26 08:38:00 +11:00
Antoni Boucher
456754c21a Pass TyCtxt by value 2023-11-19 14:04:40 -05:00
Antoni Boucher
75fce09751 Merge commit '2e8386e9fb3506cef991d04f8b3bc78f9a0c2630' into subtree-update_cg_gcc_2023-11-17 2023-11-19 13:42:13 -05:00
Mark Rousskov
a6493c1f65 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
Ralf Jung
b2add8a63e target_feature: make it more clear what that 'Option' means 2023-11-12 12:46:05 +01:00
Antoni Boucher
4dbfa4d698 Set the .comment section 2023-11-08 17:24:04 -05:00
Antoni Boucher
cc2af1fb41 Do not emit .eh_frame section when using -Cpanic=abort 2023-11-08 09:10:33 -05:00
Antoni Boucher
9149becf6a Fix vector compilation error 2023-11-03 09:05:31 -04:00
Antoni Boucher
9f4f90b19a Merge commit 'e4fe941b11a55c5005630696e9b6d81c65f7bd04' into subtree-update_cg_gcc_2023-10-25 2023-10-26 17:42:02 -04:00
Antoni Boucher
c12ac7ea76 Fix warning 2023-10-25 20:42:47 -04:00
Antoni Boucher
42e37059a3 Fix rebase 2023-10-25 20:41:39 -04:00
Antoni Boucher
4d66cd8aa8 Merge branch 'master' into sync_from_rust_2023_10_25 2023-10-25 20:39:08 -04:00
antoyo
8329a356fc
Merge pull request #369 from GuillaumeGomez/regen-intrinsics
Regenerate intrinsics mapping
2023-10-25 18:21:34 -04:00
Antoni Boucher
783789f831 Build the sysroot and run more tests 2023-10-25 11:19:03 -04:00
Guillaume Gomez
c15ad9e7a5 Regenerate intrinsics mapping 2023-10-25 15:53:31 +02:00
Antoni Boucher
a93d1b73c6 Fix volatile_load 2023-10-24 19:53:59 -04:00
Antoni Boucher
7425c560d3 Add comment 2023-10-21 18:48:03 -04:00
Oli Scherer
67b28ac34b s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Andy Sadler
81c1f39a86
optimize u128/i128 popcounts further
Don't fall back on breaking apart the popcount operation if 128-bit
integers are natively supported.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-10-18 22:10:41 -05:00
Antoni Boucher
9d5e0ba1f5 Fixes including fixing compilation for --no-default-features 2023-10-17 20:55:54 -04:00
Antoni Boucher
e5fa9f8692 Use the correct alignment for integer types 2023-10-17 20:55:54 -04:00
antoyo
fabdc1a273
Merge pull request #348 from sadlerap/optimize-popcount
optimize popcount implementation
2023-10-17 20:47:05 -04:00
Andy Sadler
64abf5862f
optimize popcount implementation
In the current implementation, the gcc backend of rustc currently emits the
following for a function that implements popcount for a u32 (x86_64 targeting
AVX2, using standard unix calling convention):

    popcount:
        mov     eax, edi
        and     edi, 1431655765
        shr     eax
        and     eax, 1431655765
        add     edi, eax
        mov     edx, edi
        and     edi, 858993459
        shr     edx, 2
        and     edx, 858993459
        add     edx, edi
        mov     eax, edx
        and     edx, 252645135
        shr     eax, 4
        and     eax, 252645135
        add     eax, edx
        mov     edx, eax
        and     eax, 16711935
        shr     edx, 8
        and     edx, 16711935
        add     edx, eax
        movzx   eax, dx
        shr     edx, 16
        add     eax, edx
        ret

Rather than using this implementation, gcc could be told to use Wenger's
algorithm.  This would give the same function the following implementation:

    popcount:
        xor eax, eax
        xor edx, edx
        popcnt eax, edi
        test edi, edi
        cmove eax, edx
        ret

This patch implements the popcount operation in terms of Wenger's algorithm in
all cases.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-10-17 16:20:55 -05:00
Guillaume Gomez
0348a5f17a Improve code readability 2023-10-17 23:00:23 +02:00
Guillaume Gomez
096f14d374 Add support for NonNull function attribute 2023-10-17 15:03:25 +02:00
Michael Howell
e1cb8187e1 docs: add Rust logo to more compiler crates
c6e6ecb1af added it to some of the
compiler's crates, but avoided adding it to all of them to reduce
bit-rot. This commit adds to more.
2023-10-16 15:38:08 -07:00
Antoni Boucher
e3998b2d46 Handle unsigned comparison for signed integers 2023-10-13 07:50:42 -04:00
Antoni Boucher
100dfced20 Fix #[inline(always)] attribute 2023-10-11 20:55:32 -04:00
Antoni Boucher
ba103e34c0 Use IntoDynSyncSend 2023-10-09 17:13:35 -04:00
Antoni Boucher
22e6f6caaf Fix checks 2023-10-09 16:03:05 -04:00
Antoni Boucher
242a482c88 Merge commit '11a0cceab966e5ff1058ddbcab5977e8a1d6d290' into subtree-update_cg_gcc_2023-10-09 2023-10-09 15:53:34 -04:00
Antoni Boucher
a7532daa76 Fix unchecked_ssub, unchecked_smul, and unchecked_umul 2023-10-09 13:16:47 -04:00