Commit Graph

8 Commits (462b73c1fe1f67a62223a3ccf830f02a2571c016)

Author SHA1 Message Date
Ian Kronquist 462b73c1fe Implement bcmp (#315)
As of LLVM 9.0, certain calls to memcmp may be converted to bcmp, which I guess
could save a single subtraction on some architectures. [1]

bcmp is just like memcmp except instead of returning the difference between the
two differing bytes, it returns non-zero instead. As such, memcmp is a valid
implementation of bcmp.

If we care about size, bcmp should just call memcmp.
If we care about speed, we can change bcmp to look like this instead:
```rust
pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
    let mut i = 0;
    while i < n {
        let a = *s1.offset(i as isize);
        let b = *s2.offset(i as isize);
        if a != b {
            return 1;
        }
        i += 1;
    }
    0
}
```

In this PR I do not address any changes which may or may not be needed for arm
aebi as I lack proper test hardware.

[1]: https://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations
2019-09-30 11:02:47 -05:00
Benjamin Saunders 9775f08b1d Tidy up unordered elementwise atomic memory intrinsics 2019-08-23 10:20:09 -07:00
Benjamin Saunders 997b86d767 Implement LLVM's elementwise unordered atomic memory intrinsics
Allows uses of intrinsics of the form
llvm.(memcpy|memmove|memset).element.unordered.atomic.* to be linked.
2019-08-21 18:21:58 -07:00
Alex Crichton c88c9502b7 Run rustfmt over everything 2019-05-14 14:40:38 -07:00
Jorge Aparicio 75c6ccca71 optimize 32-bit aligned mem{cpy,clr,set} intrinsics for ARM
this reduces the execution time of all these routines by 40-70%
2017-06-29 22:40:58 -05:00
Alex Crichton c193113721 Don't test mangled names on thumb
We are both the "real compiler-rt" and the "to be tested one".
2017-06-24 12:54:35 -07:00
Vadzim Dambrouski 9897bfb8a9 Fix memset arguments for MSP430 target.
On MSP430 second argument to memset has i16 type instead of i32.
2016-12-19 05:31:20 +03:00
Jorge Aparicio a1caa7ccac add implementations of memcpy et al
behind the "mem" Cargo feature, which used to be named "weak"

fixes #126
2016-12-17 23:06:37 -05:00