Commit Graph

834 Commits

Author SHA1 Message Date
bors 35dec6bd8a Auto merge of #192 - est31:master, r=alexcrichton
Refactor float implementation

Refactors the float implementation. Fixes #169. Parts of the PR were inspired a previous PR by @mattico .
2017-09-14 17:27:43 +00:00
est31 0cd476220b Remove duplication by adding a macro 2017-09-14 17:39:25 +02:00
est31 3efae7f7d9 Convert add! to a function 2017-09-14 17:33:44 +02:00
est31 482d98318f Convert int_to_float! to a function 2017-09-14 16:32:50 +02:00
est31 ff63f7b80f Convert float_to_int! into a function 2017-09-14 14:59:32 +02:00
bors ef4951582f Auto merge of #189 - tamird:update-comment-rustbuild, r=alexcrichton
Update rustbuild commentary

r? @nikomatsakis

This is the reason that https://github.com/rust-lang/rust/pull/44509 doesn't work - the `rustbuild` feature _is_ actually used, it was just incorrectly documented here and I missed it.
2017-09-14 00:46:30 +00:00
est31 a272d753f5 Don't use the Wrapping wrapper in float addition
Inspired by a patch by mattico.
2017-09-14 02:08:28 +02:00
est31 72ed4c8bce Don't use a macro for pow calculation 2017-09-14 01:59:02 +02:00
est31 8313cec597 Extend the Float trait by some constants and supertraits 2017-09-14 01:57:52 +02:00
bors 915293c528 Auto merge of #191 - est31:master, r=alexcrichton
Small refactor to use associated consts

Yeey less chars.

r? @alexcrichton
2017-09-13 23:12:44 +00:00
est31 2c1d7dccc1 Use the newly added ONE constant in float addition 2017-09-14 00:10:16 +02:00
est31 46cfa05650 Introduce a float_impl! macro to avoid duplication 2017-09-13 22:44:56 +02:00
est31 9bdedec38e Refactor float builtins to use associated consts 2017-09-13 22:09:52 +02:00
est31 c9a261895e Refactor int builtins to use associated consts 2017-09-13 22:09:31 +02:00
Tamir Duberstein a32e76eaea
Update rustbuild commentary
Also use `cfg!(feature = "rustbuild")` instead of the environment
variable to ease grep-ability.
2017-09-12 20:54:32 -04:00
bors 23f14d3f05 Auto merge of #188 - tamird:remove-unused-rustbuild, r=alexcrichton
Remove unused rustbuild feature

I can't tell if this was ever used, but it's not used today.
2017-09-10 15:35:24 +00:00
Tamir Duberstein 9d536cf96a
Remove unused rustbuild feature
I can't tell if this was ever used, but it's not used today.
2017-09-10 09:30:47 -04:00
bors 38ffaf97aa Auto merge of #187 - est31:master, r=alexcrichton
Update the gcc crate to 0.3.53 and disable compilation warnings

The update is needed because you'd otherwise get a deprecation warning about `Config` being deprecated, as rust-lang/rust has updated the gcc crate.

The compilation warnings are inside the compiler-rt submodule, about which we don't have
direct control over, so we disable them.
2017-09-07 05:51:19 +00:00
est31 02ea9e5f54 Update the gcc crate to 0.3.53 and disable compilation warnings
They are inside the compiler-rt submodule, about which we don't have
direct control over.
2017-09-07 07:49:34 +02:00
bors 94c4c1c534 Auto merge of #184 - DirkyJerky:patch-1, r=alexcrichton
Fix README relative link.
2017-08-22 05:03:25 +00:00
Geoff Yoerger fe6197e2f2 Fix README relative link. 2017-08-21 16:17:04 -05:00
bors 6b9281d2b2 Auto merge of #181 - TimNN:no-memcpy, r=alexcrichton
Avoid memcpy references in unoptimized code

Fixes rust-lang/rust#43411.
2017-07-23 05:10:08 +00:00
Tim Neumann c138713df1 Avoid memcpy references in unoptimized code 2017-07-22 23:10:30 +02:00
bors f6c4034d59 Auto merge of #179 - ollie27:chkstk, r=alexcrichton
Don't include custom chkstk on MSVC

MSVC includes its own __chkstk so these aren't used.

These aren't included in compiler-rt: cb42103777/lib/builtins/CMakeLists.txt (L224-L284).
They also weren't included in compiler-builtins: 1685c92986/src/libcompiler_builtins/build.rs (L255-L293) until rust-lang/rust#42899.
2017-07-12 22:28:43 +00:00
Oliver Middleton 064452423a Don't include custom chkstk on MSVC
MSVC includes its own __chkstk so these aren't used.
2017-07-12 22:40:49 +01:00
bors 5e49856003 Auto merge of #176 - alexcrichton:probestack2, r=alexcrichton
Tweak definition of probestack functions

It looks like the old `__rust_probestack` routine is incompatible with newer
linux kernels. My best guess for this is that the kernel's auto-growth logic is
failing to trigger, causing what looks like a legitimate segfault to get
delivered. My best guess for why *that's* happening is that the faulting address
is below `%rsp`, whereas previously all faulting stack addresses were above
`%rsp`. The probestack routine does not modify `%rsp` as it's probing the stack,
and presumably newer kernels are interpreting this as a legitimate violation.

This commit tweaks the probestack routine to instead update `%rsp` incrementally
as probing happens. The ABI of the function, however, requires that `%rsp`
isn't changed as part of the function so it's restored at the end to the
previous value.
2017-07-08 03:36:04 +00:00
Alex Crichton 91eaa85902 Don't mangle probes all the time 2017-07-07 20:35:14 -07:00
Alex Crichton f9f6bd0589 Tweak definition of probestack functions
It looks like the old `__rust_probestack` routine is incompatible with newer
linux kernels. My best guess for this is that the kernel's auto-growth logic is
failing to trigger, causing what looks like a legitimate segfault to get
delivered. My best guess for why *that's* happening is that the faulting address
is below `%rsp`, whereas previously all faulting stack addresses were above
`%rsp`. The probestack routine does not modify `%rsp` as it's probing the stack,
and presumably newer kernels are interpreting this as a legitimate violation.

This commit tweaks the probestack routine to instead update `%rsp` incrementally
as probing happens. The ABI of the function, however, requires that `%rsp`
isn't changed as part of the function so it's restored at the end to the
previous value.
2017-07-07 10:16:03 -07:00
bors e9b258bc0c Auto merge of #175 - alexcrichton:probestack, r=alexcrichton
Add `__rust_probestack` intrinsic

Will be required for rust-lang/rust#42816
2017-07-06 13:59:05 +00:00
Alex Crichton 7ccf8408d0 Add `__rust_probestack` intrinsic
Will be required for rust-lang/rust#42816
2017-07-06 06:58:32 -07:00
Alex Crichton 238647af80 Fix unused imports on iOS 2017-07-03 19:11:34 -07:00
Alex Crichton a1700f9da9 Fix a typo in the build script 2017-07-03 15:28:03 -07:00
Alex Crichton 070990f10a Compile ffsdi2 with `rustbuild` feature
This is not used by LLVM/Rust, but is apparently used by gcc/C which jemalloc
can require at least.
2017-07-03 15:00:51 -07:00
bors 906b2bfc5d Auto merge of #174 - alexcrichton:less-compiler-rt, r=alexcrichton
Use the Rust implementation of udivsi3 on ARM

Although compiler-rt presumably has a more optimized implementation written in
assembly, it appears buggy for whatever reason, causing #173.

For now let's see if integration into rust-lang/rust will work with the
Rust-defined implementation!
2017-07-03 16:48:23 +00:00
Alex Crichton 681aaa914d Use the Rust implementation of udivsi3 on ARM
Although compiler-rt presumably has a more optimized implementation written in
assembly, it appears buggy for whatever reason, causing #173.

For now let's see if integration into rust-lang/rust will work with the
Rust-defined implementation!
2017-07-03 09:48:11 -07:00
Alex Crichton a6bbbea236 Merge pull request #172 from alexcrichton/update-compielr-rt
Update compiler-rt submodule
2017-07-01 07:49:17 -07:00
Alex Crichton 5a39eed988 Update compiler-rt submodule
Needed to pull in some recent changes with rust-lang/rust
2017-07-01 00:31:53 -07:00
bors b0300b16ed Auto merge of #164 - rust-lang-nursery:memclr, r=alexcrichton
optimize memset and memclr for ARM

This commit optimizes those routines by rewriting them in assembly and
performing the memory copying in 32-bit chunks, rather than in 8-bit chunks
as it was done before this commit. This assembly implementation is
compatible with the ARMv6 and ARMv7 architectures.

This change results in a reduction of runtime of about 40-70% in all cases
that matter (the compiler will never use these intrinsics for sizes smaller
than 4 bytes). See data below:

| Bytes | HEAD | this PR | diff       |
| ----- | ---- | ------- | ---------- |
| 0     | 6    | 14      | +133.3333% |
| 1     | 10   | 13      | +30%       |
| 2     | 14   | 13      | -7.1429%   |
| 3     | 18   | 13      | -27.77%    |
| 4     | 24   | 21      | -12.5%     |
| 16    | 70   | 36      | -48.5714%  |
| 64    | 263  | 97      | -63.1179%  |
| 256   | 1031 | 337     | -67.3133%  |
| 1024  | 4103 | 1297    | -68.389%   |

All times are in clock cycles. The measurements were done on a Cortex-M3
processor running at 8 MHz using the technique described [here].

[here]: http://blog.japaric.io/rtfm-overhead

---

For relevance all pure Rust programs for Cortex-M microcontrollers use memclr to
zero the .bss during startup so this change results in a quicker boot time.

Some questions / comments:

- ~~the original code (it had a bug) comes from this [repo] and it's licensed
  under the ICS license. I have preserved the copyright and license text in the
  source code. IANAL, is that OK?~~ no longer applies. The intrinsics are written in Rust now.

- ~~I don't know whether this ARM implementation works for ARMv4 or ARMv5.
  @FenrirWolf and @Uvekilledkenny may want to take look at it first.~~ no longer applies. The intrinsics are written in Rust now.

- ~~No idea whether this implementation works on processors that have no thumb
  instruction set. The current implementation uses 16-bit thumb instructions.~~ no longer applies. The intrinsics are written in Rust now.

- ~~The loop code can be rewritten in less instructions but using 32-bit thumb
  instructions. That 32-bit version would only work on ARMv7 though. I have yet
  to check whether that makes any difference in the runtime of the intrinsic.~~ no longer applies. The intrinsics are written in Rust now.

- ~~I'll look into memcpy4 next.~~ done

[repo]: https://github.com/bobbl/libaeabi-cortexm0
2017-07-01 07:27:55 +00:00
Jorge Aparicio b8a662040e no aeabi_mem* symbols on iOS, weak symbols on thumb, normal symbols elsewhere 2017-06-30 18:06:25 -05: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
bors c311deeb76 Auto merge of #171 - rust-lang-nursery:gh150, r=japaric
enable tests now that #150 has been fixed

cc @parched
2017-06-28 03:49:35 +00:00
Jorge Aparicio f3350c5499 enable tests now that #150 has been fixed 2017-06-27 22:48:57 -05:00
bors 6024080570 Auto merge of #166 - alexcrichton:test-c, r=japaric
Test with the 'c' feature enabled on CI
2017-06-25 17:10:13 +00:00
Alex Crichton 0ebbcaede4 Enable the `intrinsics` program on thumb 2017-06-25 10:09:50 -07:00
Alex Crichton afe5c717a9 Address review comments 2017-06-24 21:51:34 -07: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
Alex Crichton 5c74fb13d9 Enable 128-bit integer tests on Windows
Closes #158
2017-06-24 12:23:28 -07:00
Alex Crichton acaa2f071a Don't check for references to panics with debug assertions 2017-06-24 11:44:50 -07:00
Alex Crichton 4859aba5f4 Don't build gcc_personality_v0 2017-06-24 11:36:05 -07:00
Alex Crichton d051480eff Don't generate unmangled aeabi with gen-tests
The symbols they delgate to also don't exist...
2017-06-24 11:34:10 -07:00