Commit Graph

1088 Commits

Author SHA1 Message Date
Patryk Wychowaniec
c2c4c8e146
fix: Add (even more) #[avr_skip] for floats
Tale as old as the world - there's an ABI mismatch:
https://github.com/rust-lang/compiler-builtins/pull/527

Fortunately, newest GCCs (from v11, it seems) actually provide most of
those intrinsics (even for f64!), so that's pretty cool.

(the only intrinsics not provided by GCC are `__powisf2` & `__powidf2`,
but our codegen for AVR doesn't emit those anyway.)

Fixes https://github.com/rust-lang/rust/issues/118079.
2023-11-26 16:17:00 +01:00
Amanieu d'Antras
52959b5800 Bump to 0.1.103
There was a mistake in publishing the 0.1.102 release.
2023-11-04 00:29:46 +00:00
Amanieu d'Antras
44d0e30db9 Bump to 0.1.102 2023-11-04 00:28:36 +00:00
Amanieu d'Antras
2a9210b900
Merge pull request #554 from mchodzikiewicz/fix-math-for-riscv32 2023-10-31 22:43:37 +01:00
Michał Chodzikiewicz
8ec53915fe Enable math module for all "none" os targets
This was initially a bugfix that fixed gating math module for riscv32,
but conclusiion is it makes no sense to gate on target architecture.
2023-10-31 20:32:53 +01:00
Amanieu d'Antras
ed04e1e2b0
Merge pull request #552 from elbe0046/fix-aeabi-multi-def 2023-10-31 20:15:42 +01:00
Nicholas Bishop
e8509dd054 Enable src/math for all UEFI targets
This fixes various math operations on aarch64-unknown-uefi and
i686-unknown-uefi.
2023-10-27 20:21:08 +00:00
Grant Elbert
de2da94c49 intrinsics macro: fix non-weak aeabi generation
Signed-off-by: Grant Elbert <grant.elbert@smartthings.com>
2023-10-23 15:54:05 -05:00
Sebastian Imlay
25fa91e1b2 Add tvOS to build script 2023-10-06 17:35:20 -04:00
James Farrell
6595f36317 Generate outlined_atomics.rs in a deterministic order.
Also add a missing newline.
2023-08-28 22:14:18 +00:00
Amanieu d'Antras
5642f6ba4c Bump to 0.1.101 2023-08-12 10:28:45 +02:00
Sean Cross
10df3f61ad build: compile memory intrinsics on xous
Like SGX, Xous does not have any libc to link against. As a result,
memory intrinsics need to be available as part of `compiler_builtins`

Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-12 07:50:26 +03:00
Amanieu d'Antras
14f4e11a86 Bump to 0.1.100 2023-08-07 23:37:59 +01:00
Amanieu d'Antras
6d180d8377
Merge pull request #546 from ankane/lgamma-r-mingw 2023-08-07 23:37:06 +01:00
klensy
a15a3a5df0 impl_binary_long allow to pass attribute 2023-08-07 21:23:23 +03:00
klensy
10f6ee84e3 allow internal_features, added in https://github.com/rust-lang/rust/pull/108955 2023-08-07 21:04:25 +03:00
klensy
dd34581ec9 edition 2018 2023-08-07 21:04:25 +03:00
Andrew Kane
2a197cb5c9 Add lgamma_r and lgammaf_r to MinGW 2023-07-31 15:08:37 -07:00
Amanieu d'Antras
0db7a3a020 Bump to 0.1.99 2023-07-30 23:56:13 +01:00
Andrew Kane
d4477f8218 Add lgamma_r and lgammaf_r to MSVC 2023-07-30 10:45:26 -07:00
Nicholas Bishop
da05233935 Add __chkstk for aarch64-unknown-uefi
This is based on compiler-rt/lib/builtins/aarch64/chkstk.S:
f8e19b3799
2023-07-22 15:05:30 -04:00
Amanieu d'Antras
05ca9048ad Bump to 0.1.98 2023-07-21 17:46:23 +01:00
Amanieu d'Antras
2b29ddcca7 Upgrade to libm 0.2.7 2023-07-21 17:45:47 +01:00
Amanieu d'Antras
2a14bca476 Bump to 0.1.97 2023-07-21 14:29:00 +01:00
Nicholas Bishop
7eca0c2ba3 Enable chkstk/alloca intrinsics on x86_64-unknown-uefi 2023-07-18 22:58:59 -04:00
Amanieu d'Antras
5cc74482b4 Bump to 0.1.96 2023-07-17 13:51:40 +01:00
Amanieu d'Antras
4cb7858aac
Merge pull request #538 from ankane/lgamma-r-msvc 2023-07-17 13:51:00 +01:00
Taiki Endo
716d2064f0 Fix build error on aarch64_be linux 2023-07-08 14:18:27 +09:00
Andrew Kane
e2f0b9cd3a Add lgamma_r and lgammaf_r to MSVC 2023-07-07 10:49:54 -04:00
Aaron Kutch
025076f763 Use the target_feature "zbb" instead of "b" for RISC-V 2023-07-06 17:20:32 -05:00
Amanieu d'Antras
28f2437614 Disable MIPS in CI
See https://github.com/rust-lang/compiler-team/issues/648
2023-07-06 20:20:19 +02:00
Amanieu d'Antras
8a3c3942a5 Bump to 0.1.95 2023-07-03 10:45:20 +02:00
jyn
c4e9f479ad Only compile outlined-atomics intrinsics on linux 2023-07-02 21:55:02 -05:00
Amanieu d'Antras
9234bedeea Bump to 0.1.94 2023-06-28 23:44:06 +01:00
Amanieu d'Antras
050754d4e3
Merge pull request #534 from kiffie/mips-core-float 2023-06-28 23:43:34 +01:00
Amanieu d'Antras
bb0d107feb
Merge pull request #532 from jyn514/lse.rs 2023-06-28 23:41:39 +01:00
Amanieu d'Antras
d5543c4cfb
Merge pull request #531 from knickish/float_div_subnormal_rounding 2023-06-28 23:41:07 +01:00
Stephan
c6fa74aacb enable simple f32/f64 support needed by core library 2023-06-28 21:35:33 +02:00
Joshua Nelson
1a41e48d11 fix tests to work with --feature c 2023-06-27 02:31:42 +00:00
kirk
379445f9a5 port updated version of llvm float div 2023-06-27 01:17:31 +00:00
Joshua Nelson
e7c4a45348 require naked functions to be unsafe again
they dereference raw pointers, so the caller needs to make sure the
pointer is valid.

note that this requires changing `maybe_use_optimized_c_shim` to support
unsafe functions.
2023-06-26 16:27:16 +00:00
Joshua Nelson
6242fd629e address review comments and fix CI
- implement CAS 16
- remove useless commented out symbol name
- support `feature("no-asm")`
- fix warnings when `feature("c")` is enabled
- rustfmt
2023-06-26 15:09:37 +00:00
Joshua Nelson
21c821c6c9 Port outline-atomics to rust
This has a very long history, summarized in
https://github.com/rust-lang/rust/issues/109064. This port is a very
minimal subset of `aarch64/lse.S` from LLVM's compiler-rt. In
particular, it is missing the following:

1. Any form of runtime dispatch between LL/SC and LSE.

Determining which version of the intrinsics to use
requires one of the following:

  i) `getauxval` from glibc. It's unclear whether `compiler_builtins` is
allowed to depend on libc at all, and musl doesn't even support
getauxval. Don't enshrine the requirement "de-facto" by making it
required for outline-atomics.

  ii) kernel support. Linux and FreeBSD have limited support, but it
requires an extremely recent kernel version and doesn't work at all under QEMU (https://github.com/rust-lang/rust/issues/109064#issuecomment-1494939904).

Instead, we hard-code LL/SC intrinsics. Users who want LSE support
should use the LLVM compiler-rt (if you're building from source in
rust-lang/rust, make sure you have `src/llvm-project` checked out
locally. the goal is to soon add a new `optimized-compiler-builtins`
option so this is easier to discover).

2. The global `___aarch64_have_lse_atomics` CTOR, required to do runtime
   dispatch. Thom Chiviolani has this to say about global CTORs:

> static ctors are problems because we are pretty eager about dead code elim
> in general if you have a module that isnt directly reference we will probably not have its static ctors
> also, while llvm has a super robust way to have a static ctor (theres s special "appending global" to use for c++), we dont use that and just have people make a #[used] static in a special section
> 1. the robust way kinda requires rust knowing that the argument is a static ctor (maybe a #[rustc_static_ctor] attribute). it also would be... finnicky, since on windows we actually care beyond being a static ctor, that we run as part in a specific group of ctors, which means a very specific section (one for TLS and the other for, uh, i dont remember)
> 2. we still actually have to codegen the cgu that isn't referenced. but maybe we could remember that it has that attribute and use that

So while this is possible in theory, it's decidedly non-trivial, and
needs invasive changes to rust itself. In any case, it doesn't matter
until we decide the story around libc.

3. The 16-byte (i128) version of compare_and_swap. This wouldn't be
   *too* hard to add, but it would be hard to test. The way I tested the
existing code was not just with unit tests but also by loading it as a
path dependency and running `x test core` - the latter caught several
bugs the unit tests didn't catch (because I originally wrote the tests
wrong). So I am slightly nervous about adding a 16-byte version that is
much more poorly tested than the other intrinsics.
2023-06-26 05:56:08 +00:00
Amanieu d'Antras
4a84991713
Merge pull request #529 from knickish/compile_warning_cleanup 2023-06-18 00:47:22 +02:00
kirk
fad0b3a431 change links in README to match reference code version used in CI 2023-06-17 14:35:00 +00:00
kirk
d3951c082e allow stable features lint, fix link formatting warning, add ignore block to intrinsics macro documentation 2023-06-17 14:11:31 +00:00
Amanieu d'Antras
2eeedaf25a Bump to 0.1.93 2023-06-12 15:37:22 +01:00
Patryk Wychowaniec
73f57893aa
fix: Add #[avr_skip] for floats
Same story as always, i.e. ABI mismatch:

- https://github.com/rust-lang/compiler-builtins/pull/462
- https://github.com/rust-lang/compiler-builtins/pull/466
- https://github.com/rust-lang/compiler-builtins/pull/513

I've made sure the changes work by rendering a Mandelbrot fractal:

```rust
#[arduino_hal::entry]
fn main() -> ! {
    let dp = arduino_hal::Peripherals::take().unwrap();
    let pins = arduino_hal::pins!(dp);
    let mut serial = arduino_hal::default_serial!(dp, pins, 57600);

    mandelbrot(&mut serial, 60, 40, -2.05, -1.12, 0.47, 1.12, 100);

    loop {
        //
    }
}

fn mandelbrot<T>(
    output: &mut T,
    viewport_width: i64,
    viewport_height: i64,
    x1: f32,
    y1: f32,
    x2: f32,
    y2: f32,
    max_iterations: i64,
) where
    T: uWrite,
{
    for viewport_y in 0..viewport_height {
        let y0 = y1 + (y2 - y1) * ((viewport_y as f32) / (viewport_height as f32));

        for viewport_x in 0..viewport_width {
            let x0 = x1 + (x2 - x1) * ((viewport_x as f32) / (viewport_width as f32));

            let mut x = 0.0;
            let mut y = 0.0;
            let mut iterations = max_iterations;

            while x * x + y * y <= 4.0 && iterations > 0 {
                let xtemp = x * x - y * y + x0;
                y = 2.0 * x * y + y0;
                x = xtemp;
                iterations -= 1;
            }

            let ch = "#%=-:,. "
                .chars()
                .nth((8.0 * ((iterations as f32) / (max_iterations as f32))) as _)
                .unwrap();

            _ = ufmt::uwrite!(output, "{}", ch);
        }

        _ = ufmt::uwriteln!(output, "");
    }
}
```

... where without avr_skips, the code printed an image full of only `#`.

Note that because libgcc doesn't provide implementations for f64, using
those (e.g. swapping f32 to f64 in the code above) will cause linking to
fail:

```
undefined reference to `__divdf3'
undefined reference to `__muldf3'
undefined reference to `__gedf2'
undefined reference to `__fixunsdfsi'
undefined reference to `__gtdf2'
```

Ideally compiler-builtins could jump right in and provide those, but f64
also require a special calling convention which hasn't been yet exposed
through LLVM.

Note that because using 64-bit floats on an 8-bit target is a pretty
niche thing to do, and because f64 floats don't work correctly anyway at
the moment (due to this ABI mismatch), we're not actually breaking
anything by skipping those functions, since any code that currently uses
f64 on AVR works by accident.

Closes https://github.com/rust-lang/rust/issues/108489.
2023-06-12 14:14:36 +02:00
Amanieu d'Antras
92d88fd7a4 Bump to 0.1.92 2023-05-20 10:50:12 +02:00
Amanieu d'Antras
2eb4f692bc Upgrade libm to 0.2.7 2023-05-20 10:49:41 +02:00
danakj
fb77604e79 Add the weak-intrinsics feature
When enabled, the weak-intrinsics feature will cause all intrinsics
functions to be marked with weak linkage (i.e. `#[linkage = "weak"])
so that they can be replaced at link time by a stronger symbol.

This can be set to use C++ intrinsics from the compiler-rt library,
as it will avoid Rust's implementation replacing the compiler-rt
implementation as long as the compiler-rt symbols are linked as
strong symbols. Typically this requires the compiler-rt library to
be explicitly specified in the link command.

Addresses https://github.com/rust-lang/compiler-builtins/issues/525.

Without weak-intrinsics, from nm:
```
00000000 W __aeabi_memclr8  // Is explicitly weak
00000000 T __udivsi3  // Is not.
```

With weak-intrinsics, from nm:
```
00000000 W __aeabi_memclr8  // Is explicitly weak
00000000 W __udivsi3  // Is weak due to weak-intrinsics
```
2023-05-19 17:35:00 -04:00
Amanieu d'Antras
7749ed6580 Bump to 0.1.91 2023-03-29 23:55:20 +01:00
William D. Jones
5246405d61 Ensure shift instrinsic arguments match width of compiler-rt's (int vs si_int). 2023-03-29 17:55:46 -04:00
Amanieu d'Antras
7db8c0581d Disable another test on powerpc 2023-03-29 21:49:08 +01:00
Amanieu d'Antras
26e2432c25 Bump to 0.1.90 2023-03-25 21:55:23 +00:00
Taiki Endo
2f43b93603 Fix panic due to overflow in riscv.rs and int/shift.rs 2023-03-23 22:00:22 +09:00
Amanieu d'Antras
da5001e4c6
Merge pull request #516 from TDecki/master 2023-03-12 22:17:23 +01:00
Amanieu d'Antras
20fb963ab6 Add emutls.c for OpenHarmony 2023-03-10 19:59:23 +00:00
Tobias Decking
59766673e7
more fixing 2023-03-06 19:28:49 +01:00
Tobias Decking
73fa0deaa6
formatting 2023-03-06 19:24:02 +01:00
Tobias Decking
215f63ad19
Final version. 2023-03-06 19:20:30 +01:00
Andrew Kane
59fb34e63a Added lgamma_r and lgammaf_r 2023-03-05 12:17:21 -08:00
Amanieu d'Antras
3e59619de7 Bump to 0.1.88 2023-02-23 18:19:41 +00:00
Tobias Decking
04fe482160
Formatting 2023-02-22 22:19:10 +01:00
Tobias Decking
c7404df069
Provide a non-sse version for x86_64. 2023-02-22 22:16:29 +01:00
Scott Mabin
67ebc4ae14 Extend the intrinsics exported for Xtensa no_std 2023-02-22 20:56:31 +00:00
Tobias Decking
97402fc580
Change implementation to SSE 2023-02-22 21:54:33 +01:00
Tobias Decking
e9e34801a6
Remove superfluous comment. 2023-02-22 00:10:46 +01:00
Tobias Decking
b53c1ae17a
Improve assembly quality + AT&T syntax. 2023-02-22 00:07:41 +01:00
Tobias Decking
44d34e87fa
Update path for argument. 2023-02-21 23:36:47 +01:00
Tobias Decking
990596fa28
Correct path. 2023-02-21 23:32:39 +01:00
Tobias Decking
a11bd1cfdb
Specialize strlen for x86_64. 2023-02-21 23:13:02 +01:00
Amanieu d'Antras
2ca64c2798 Bump to 0.1.87 2023-02-03 19:21:40 +01:00
Josh Stone
8d4e906206 Drop the llvm14-builtins-abi hack 2023-02-01 14:52:18 -08:00
Amanieu d'Antras
7f39126ff9 Bump to 0.1.86 2022-12-29 20:36:57 +01:00
Patryk Wychowaniec
d20eea4d47
fix: Add #[avr_skip] for bit shifts
This commit follows the same logic as:

- https://github.com/rust-lang/compiler-builtins/pull/462
- https://github.com/rust-lang/compiler-builtins/pull/466

I've tested the changes by preparing a simple program:

```rust
fn calc() -> ... {
    let x = hint::black_box(4u...); // 4u8, 4u16, 4u32, 4u64, 4u128 + signed
    let y = hint::black_box(1u32);

    // x >> y
    // x << y
}

fn main() -> ! {
    let dp = arduino_hal::Peripherals::take().unwrap();
    let pins = arduino_hal::pins!(dp);
    let mut serial = arduino_hal::default_serial!(dp, pins, 57600);

    for b in calc().to_le_bytes() {
        _ = ufmt::uwrite!(&mut serial, "{} ", b);
    }

    _ = ufmt::uwriteln!(&mut serial, "");

    loop {
        //
    }
}
```

... switching types & operators in `calc()`, and observing the results;
what I ended up with was:

```
 u32 << u32 - ok
 u64 << u32 - ok
u128 << u32 - error (undefined reference to `__ashlti3')
 i32 >> u32 - ok
 i64 >> u32 - ok
i128 >> u32 - error (undefined reference to `__ashrti3')
 u32 >> u32 - ok
 u64 >> u32 - ok
u128 >> u32 - error (undefined reference to `__lshrti3')

(where "ok" = compiles and returns correct results)
```

As with multiplication and division, so do in here 128-bit operations
not work, because avr-gcc's standard library doesn't provide them (at
the same time, requiring that specific calling convention, making it
pretty difficult for compiler-builtins to jump in).

I think 128-bit operations non-working on an 8-bit controller is an
acceptable trade-off - 😇 - and so the entire fix in here is
just about skipping those functions.
2022-12-25 11:46:30 +01:00
Amanieu d'Antras
62cd3780ae Bump to 0.1.85 2022-12-08 13:31:59 +00:00
Martin Kröning
620f50589e Expose minimal floating point symbols for x86_64-unknown-none 2022-12-07 16:08:01 +01:00
Jérome Eertmans
80828bfb0b
fix(docs): typo in docstrings
Hello, I think you misspelled `width` to `with`.
2022-11-28 10:53:42 +01:00
Amanieu d'Antras
ad4ab99a2e Bump to 0.1.84 2022-11-18 02:58:11 +00:00
Nicholas Bishop
ebaca42a41 Use a stub stdlib.h when compiling for UEFI targets
int_util.c includes stdlib.h if `_WIN32` is defined. When compiling
the UEFI targets with clang they are treated as Windows targets (e.g. if
the Rust target is x86_64-unknown-uefi, the clang target is
x86_64-unknown-windows-gnu). So stdlib.h gets included, even though we
are compilling with `-ffreestanding` and don't want stdlib.h to be
used. That file may not be present, or an incompatible version might be
installed leading to typedef redefinition errors.

The contents of stdlib.h aren't actually needed for these targets anyway
(due to `__STDC_HOSTED__` being 0), so create a minimal stdlib.h in
`build.rs` when `target_os == uefi` and add it to the include path.
2022-11-17 21:16:01 -05:00
Amanieu d'Antras
371a6856ee
Merge pull request #504 from nicholasbishop/bishop-no-uefi-asm 2022-11-16 19:05:16 +00:00
Nicholas Bishop
98b3454d3d Skip assembly implementations on the UEFI targets
The UEFI targets link with `/SAFESEH`. That requires that objects have a
symbol called [`@feat.00`]. Clang adds that symbol for COFF targets if
the input is a C file, but not if the input is an ASM file. That doesn't
prevent compiler_builtins or rustc from building, but using the
resulting rustc to compile something that references one of the objects
lacking `@feat.00` will result in a linker error.

Fix by removing all the `.S` implementations when `target_os == uefi`.

[`@feat.00`]: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-sxdata-section
2022-11-16 13:16:42 -05:00
Nicholas Bishop
524ca7ceb6 Remove unused no-lang-items feature 2022-11-12 12:09:06 -05:00
Amanieu d'Antras
a996f56f5a Bump to 0.1.83 2022-11-09 04:12:51 +00:00
Jules Bertholet
af5664be84
Update libm, add rint and rintf 2022-11-08 21:04:02 -05:00
Felix S. Klock II
2faf57c08d might as well add the link to the LLVM assembly code as well. 2022-10-25 12:32:41 -04:00
Felix S. Klock II
8266a1343b Document origins of the multiplication method being used here. 2022-10-25 11:25:14 -04:00
Amanieu d'Antras
6f53a4f074 Bump to 0.1.82 2022-10-10 19:04:06 +01:00
Ralf Jung
6267545315 invoke the unreachable intrinsic, not the stable wrapper 2022-10-10 19:34:48 +02:00
Amanieu d'Antras
2e0590c997 Fix clippy lints 2022-10-10 17:40:16 +01:00
Amanieu d'Antras
1bffeb803e
Merge pull request #343 from silwol/master 2022-10-10 17:35:41 +01:00
Amanieu d'Antras
8bc227d1fe Bump to 0.1.81 2022-09-29 03:16:50 +01:00
Lokathor
f6cd5cf806
Update macros.rs 2022-09-27 13:22:45 -06:00
Amanieu d'Antras
4c8bb40c8d Bump to 0.1.80 2022-09-20 16:20:52 +08:00
D1plo1d
1d5b952100 math: Enabled floating point intrinsics for RISCV32 microcontrollers 2022-09-17 11:47:21 -04:00
Amanieu d'Antras
83c4ff5f96 Bump to 0.1.79 2022-08-10 15:28:39 +01:00
Amanieu d'Antras
1eb4cc1977 Update libm submodule 2022-08-10 15:24:16 +01:00
David Hoppenbrouwers
a695cf95cf
Remove c32() from x86_64 memcmp
Fixes https://github.com/rust-lang/compiler-builtins/issues/487
2022-08-10 11:29:38 +02:00
Nicholas Bishop
abb6893a85 Enable unadjusted_on_win64 for UEFI in some cases
The conversion functions from i128/u128 to f32/f64 have the
`unadjusted_on_win64` attribute, but it is disabled starting with
LLVM14. This seems to be the correct thing to do for Win64, but for some
reason x86_64-unknown-uefi is different, despite generally using the
same ABI as Win64.
2022-08-03 19:16:03 -04:00
Amanieu d'Antras
8a9e33297a Bump to 0.1.78 2022-07-30 01:45:31 +01:00
Amanieu d'Antras
b71753da80
Merge pull request #484 from Alexhuszagh/armv5te 2022-07-30 02:42:08 +02:00
Amanieu d'Antras
a81a868a59
Merge pull request #482 from ankane/gamma 2022-07-30 02:41:21 +02:00
Andrew Kane
d9cd50d32f Update libm 2022-07-29 17:34:06 -07:00
Alex Huszagh
599dcc2c46
Add compiler-rt fallbacks for sync builtins on armv5te-musl. 2022-07-29 16:58:05 -05:00
Alex Huszagh
de09c87e0b
Add compiler-rt fallback for __trunctfsf2 on mips64-musl. 2022-07-29 15:52:23 -05:00
Andrew Kane
89df6f6bc0 Added tgamma and tgammaf 2022-07-28 16:21:37 -07:00
Amanieu d'Antras
1913181e24 Bump to 0.1.77 2022-07-28 20:58:02 +01:00
David Hoppenbrouwers
66f22e0931
Remove branches around rep movsb/stosb
While it is measurably faster for older CPUs, removing them keeps the code
smaller and is likely more beneficial for newer CPUs.
2022-07-28 18:45:28 +02:00
David Hoppenbrouwers
04c223f0df
Skip rep movsb in copy_backward if possible
There is currently no measureable performance difference in benchmarks
but it likely will make a difference in real workloads.
2022-07-28 18:32:57 +02:00
David Hoppenbrouwers
30e0c1f4c2
Use att_syntax for now 2022-07-28 18:32:56 +02:00
David Hoppenbrouwers
897a133869
Remove rep_param_rev 2022-07-28 18:32:56 +02:00
David Hoppenbrouwers
45e2996c96
Fix suboptimal codegen in memset 2022-07-28 18:32:56 +02:00
David Hoppenbrouwers
a977b01090
Align destination in mem* instructions.
While misaligned reads are generally fast, misaligned writes aren't and
can have severe penalties.
2022-07-28 18:32:51 +02:00
Amanieu d'Antras
0cc9a7e4a6
Merge pull request #478 from Lokathor/weak-linkage-for-division 2022-07-28 18:14:59 +02:00
Nicholas Bishop
586e2b38ef Enable win64_128bit_abi_hack for x86_64-unknown-uefi
The `x86_64-unknown-uefi` target is Windows-like [1], and requires the
same altered ABI for some 128-bit integer intrinsics.

See also https://github.com/rust-lang/rust/issues/86494.

[1]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
2022-07-28 11:55:59 -04:00
Lokathor
8568a33255
restrict linkage to platforms using ELF binaries
on windows and apple (which don't use ELF) we can't apply weak linkage
2022-07-28 09:42:18 -06:00
Lokathor
1070134a56
Merge pull request #1 from rust-lang/master
updates from main
2022-07-28 09:36:02 -06:00
Ayush Singh
f2ac36348c
Use all of src/math for UEFI
This is needed for libtest
2022-07-28 20:51:44 +05:30
Amanieu d'Antras
6b6db5cc84 Disable some PPC64 tests which are failing due to an LLVM(?) bug
See https://github.com/rust-lang/rust/issues/99853
2022-07-28 16:02:04 +01:00
Lokathor
011f92c877
add weak linkage to the ARM AEABI division functions 2022-07-22 17:14:18 -06:00
Amanieu d'Antras
5e48419836 Bump to 0.1.76 2022-06-29 01:08:54 +01:00
Amanieu d'Antras
db6016bee5
Merge pull request #473 from Ayush1325/uefi-std
Enable mem for UEFI
2022-06-29 02:08:09 +02:00
Ayush Singh
f6ab9ca9a7
Enable mem for UEFI
Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-06-28 20:16:07 +05:30
Amanieu d'Antras
4d44679eb5 Bump to 0.1.75 2022-06-12 01:19:53 +01:00
Amanieu d'Antras
d14c5a43b7
Merge pull request #471 from Demindiro/x86_64-fix-recursive-memcmp 2022-06-12 02:19:30 +02:00
David Hoppenbrouwers
08f4f4007d
Fix infinite recursion in x86_64 memcmp if SSE2 is not present
Fixes #470
2022-06-11 09:20:01 +02:00
Sean Cross
7cdad114a5 math: compile math functions for Xous
This adds support for Xous, enabling users to call math functions on
primitives such as `cos()`.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-09 09:12:44 +08:00
Sean Cross
bb0b7d660f build: compile C code for "xous" operating system
The "xous" operating system is enturely Rust-based, meaning it has no
libc. Therefore, it relies on `compiler-builtins` for all intrinsics.

Unfortunately, there are not yet Rust equivalents for all C functions.
For example, triganometric functions are still missing. In the meantime,
enable C replacements for these functions so that Rust programs compiled
for Xous can call these functions.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-09 08:40:15 +08:00
Amanieu d'Antras
cfc0422a7e Bump to 0.1.74 2022-05-31 17:19:27 +01:00
David Hoppenbrouwers
cb63d7d500
Use unchecked_div/rem 2022-05-31 08:20:30 +02:00
David Hoppenbrouwers
b94e93ead8
Slightly optimize main (32b) memcmp loop
It only seems to save a single instruction at first sight yet the
effects are significant.
2022-05-28 22:46:16 +02:00
David Hoppenbrouwers
95d2cd5502
Fix rustfmt sillyness 2022-05-28 08:16:46 +02:00
David Hoppenbrouwers
217748f91b
Fix panic not being optimized out.
I don't know why it isn't being optimized out though, which worries
me.
2022-05-28 01:24:17 +02:00
David Hoppenbrouwers
2071d05a19
Always inline compare_bytes::cmp 2022-05-28 00:50:05 +02:00
David Hoppenbrouwers
e7a8932e3b
Fix CI, better memcmp tests 2022-05-28 00:10:55 +02:00
David Hoppenbrouwers
d6650678de
Fix formatting 2022-05-27 22:37:54 +02:00
David Hoppenbrouwers
4dbd8387f9
Implement faster memcmp for x86_64
x86_64 can load unaligned words in a single cache line as fast as
aligned words. Even when crossing cache or page boundaries it is just as
fast to do an unaligned word read instead of multiple byte reads.

Also add a couple more tests & benchmarks.
2022-05-27 21:58:39 +02:00
Amanieu d'Antras
735ad07501 Bump to 0.1.73 2022-05-26 19:54:32 +01:00
Amanieu d'Antras
18623bffad
Merge pull request #464 from m-ou-se/floatconv2 2022-05-26 20:53:14 +02:00
Mara Bos
ca517a25e7 Explicitly use parentheses for associativity of shift operators. 2022-05-26 17:21:21 +02:00
Amanieu d'Antras
c585b7fd4e
Merge pull request #466 from Patryk27/avr 2022-05-24 19:58:50 +02:00
Amanieu d'Antras
ad71d3c6d5
Merge pull request #460 from keith/ks/remove-apple_versioning.c-inclusion 2022-05-24 19:50:27 +02:00
Patryk Wychowaniec
ac47841ce2
Add avr_skip for __udivti3 & __umodti3 2022-05-24 19:49:08 +02:00
Amanieu d'Antras
092bbb67d4
Merge pull request #465 from thomcc/cast-before-transmute 2022-05-24 19:24:15 +02:00
Amanieu d'Antras
f1fe94e882
Merge pull request #462 from Patryk27/avr 2022-05-24 16:41:59 +02:00
Thom Chiovoloni
dcdd9bbc56
Avoid int to ptr transmute by casting first 2022-05-23 23:34:10 -07:00
Mara Bos
425c78ee7a Faster int<->float conversions. 2022-05-20 16:25:18 +02:00
Mara Bos
7ed26a7e7a De-duplicate 128 bit float conv intrinsics using cfg_attr. 2022-05-20 15:04:36 +02:00
Mara Bos
2063e07b35 Support cfg_attr attributes in intrinsics!() macro. 2022-05-20 15:01:50 +02:00