Commit Graph

568 Commits

Author SHA1 Message Date
Antoni Boucher de57533e56 Implement dummy emit=llvm-ir 2024-02-14 09:38:56 -05:00
Antoni Boucher ad8e820139 Update for rebased gcc 2024-02-02 11:49:32 -05: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
Guillaume Gomez b5681ca4aa Update intrinsics conversion 2024-01-03 15:27:19 +01: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
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
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
Antoni Boucher a00ea0bf98 Fix unchecked_sadd 2023-10-09 13:03:23 -04:00
Antoni Boucher bd7e5b9d4e Fix bitcast with different sizes 2023-10-09 10:38:37 -04:00
Antoni Boucher c567e59bad Merge branch 'master' into sync_from_rust_2023_10_08 2023-10-08 11:31:53 -04:00
Antoni Boucher b3c10d4a7d Fix 128-bit non-native integers negation 2023-10-08 08:49:20 -04:00
Antoni Boucher b3fecae7d7 Fix 128-bit non-native integers comparison 2023-10-07 15:14:54 -04:00
Erik Desjardins 7e8c85ba31 Reapply: Mark drop calls in landing pads cold instead of noinline
Co-authored-by: Max Fan <git@max.fan>
Co-authored-by: Nikita Popov <npopov@redhat.com>
2023-10-02 10:37:53 +02:00
Oli Scherer 8373b05514 Have a single struct for queries and hook 2023-09-22 16:26:20 +00:00