Commit Graph

45659 Commits

Author SHA1 Message Date
Felix S. Klock II
2ac5cc4863 Fix (and extend) src/test/run-pass/foreign-call-no-runtime.rs
While going over various problems signaled by valgrind when running
`make check` on a build configured with `--enable-valgrind`, I
discovered a bug in this test case.

Namely, the test case was previously creating an `i32` (originally an
`int` aka `isize` but then we changed the name and the fallback
rules), and then reading from a `*const isize`. Valgrind rightly
complains about this, since we are reading an 8 byte value on 64-bit
systems, but in principle only 4 bytes have been initialized.

(I wish this was the only valgrind unclean test, but unfortunately
there are a bunch more. This was just the easiest/first one that I
dissected.)
2015-08-20 13:28:11 +02:00
bors
a91f19f356 Auto merge of #27869 - alexcrichton:libtest-panic, r=brson
This commit removes the call to `panic!("Some tests failed")` at the end of all
tests run when running with libtest. The panic is replaced with
`std::process::exit` to have a nonzero error code, but this change both:

1. Makes the test runner no longer print out the extraneous panic message at the
   end of a failing test run that some tests failed. (this is already summarized
   in the output of the test run).
2. When running tests with `RUST_BACKTRACE` set it removes an extraneous
   backtrace from the output (only failing tests will have their backtraces in
   the output.
2015-08-18 08:51:02 +00:00
bors
16cacbe258 Auto merge of #27866 - arielb1:really-fast-reject, r=nikomatsakis
also, use the right caching logic for type_moves_by_default (this was
broken by @jroesch).

```
before:
593.10user 5.21system 7:51.41elapsed 126%CPU (0avgtext+0avgdata 1150016maxresident)k

after:
567.03user 4.00system 7:28.23elapsed 127%CPU (0avgtext+0avgdata 1133112maxresident)k
```

A nice 4.5% improvement. For reference, on the last run LLVM takes 429.267s, which is 75% - hopefully this can be reduced.

I think the regression since #27751 is because of the wf patch - need to investigate it through.

r? @nikomatsakis
2015-08-18 07:16:10 +00:00
bors
4c0ffc0e38 Auto merge of #27823 - eefriedman:float-dep-core, r=alexcrichton
There wasn't any particular reason the functions needed to be there
anyway, so just get rid of them, and adjust libstd to compensate.

With this change, libcore depends on exactly two floating-point functions:
fmod and fmodf.  They are implicitly referenced because they are used to
implement "%".

Dependencies of libcore on Linux x86-x64 with this patch:
```
0000000000000000         *UND*	0000000000000000 __powidf2
0000000000000000         *UND*	0000000000000000 __powisf2
0000000000000000         *UND*	0000000000000000 fmod
0000000000000000         *UND*	0000000000000000 fmodf
0000000000000000         *UND*	0000000000000000 memcmp
0000000000000000         *UND*	0000000000000000 memcpy
0000000000000000         *UND*	0000000000000000 memset
0000000000000000         *UND*	0000000000000000 rust_begin_unwind
0000000000000000         *UND*	0000000000000000 rust_eh_personality
```
2015-08-18 04:23:25 +00:00
bors
de67d62c6b Auto merge of #27474 - bluss:twoway-reverse, r=brson
StrSearcher: Implement the complete reverse case for the two way algorithm

Fix quadratic behavior in StrSearcher in reverse search with periodic
needles.

This commit adds the missing pieces for the "short period" case in
reverse search. The short case will show up when the needle is literally
periodic, for example "abababab".

Two way uses a "critical factorization" of the needle: x = u v.

Searching matches v first, if mismatch at character k, skip k forward.
Matching u, if mismatch, skip period(x) forward.

To avoid O(mn) behavior after mismatch in u, memorize the already
matched prefix.

The short period case requires that |u| < period(x).

For the reverse search we need to compute a different critical
factorization x = u' v' where |v'| < period(x), because we are searching
for the reversed needle. A short v' also benefits the algorithm in
general.

The reverse critical factorization is computed quickly by using the same
maximal suffix algorithm, but terminating as soon as we have a location
with local period equal to period(x).

This adds extra fields crit_pos_back and memory_back for the reverse
case. The new overhead for TwoWaySearcher::new is low, and additionally
I think the "short period" case is uncommon in many applications of
string search.

The maximal_suffix methods were updated in documentation and the
algorithms updated to not use !0 and wrapping add, variable left is now
1 larger, offset 1 smaller.

Use periodicity when computing byteset: in the periodic case, just
iterate over one period instead of the whole needle.

Example before (rfind) after (twoway_rfind) benchmark shows the removal
of quadratic behavior.

needle: "ab" * 100, haystack: ("bb" + "ab" * 100) * 100

```
test periodic::rfind           ... bench:   1,926,595 ns/iter (+/- 11,390) = 10 MB/s
test periodic::twoway_rfind    ... bench:      51,740 ns/iter (+/- 66) = 386 MB/s
```
2015-08-18 02:02:57 +00:00
bors
e35fd74811 Auto merge of #27169 - huonw:simd, r=alexcrichton
This implements https://github.com/rust-lang/rfcs/pull/1199 (except for doing all the platform intrinsics).

Things remaining for SIMD (not necessarily in this PR):

- [x] I (@huonw) am signed up to ensure the compiler matches the RFC, when it lands
- [x] the platform specific intrinsics aren't properly type checked at the moment (LLVM will throw a "random" assertion)
- [ ] there's a lot of useful intrinsics that are missing, including whole platforms (mips, powerpc)
- [ ] the target-feature `cfg` detection/adding is not so great at the moment
- [x] I think the platform specific intrinsics should go in their own `extern` ABI (i.e. not `"rust-intrinsic"`)

(I'm adjusting the RFC to reflect the latter.)

I think it would be very nice for this to land without requiring the RFC to land first, because of the first point, and because this is the only way for any further work to happen/be experimented with, without requiring people to build/install/multirust a compiler from a custom branch.

r? @alexcrichton
2015-08-17 23:41:36 +00:00
Huon Wilson
02e97342c1 Add AArch64 vrecpeq_... intrinsic (necessary for minimal API). 2015-08-17 14:48:44 -07:00
Huon Wilson
b067e4464b Clean up simd_cast translation. 2015-08-17 14:48:44 -07:00
Huon Wilson
502f9acbe9 Revamp SIMD intrinsic trans error handling.
Factor out common pieces, follow `expected ..., found ...` convention
everywhere.
2015-08-17 14:48:44 -07:00
Huon Wilson
891c91438d simd_shuffleNNN returns its type parameter directly.
I.e. the signature now must be

    fn simd_shuffleNNN<T, U>(x: T, y: T, idx: [u32; NNN]) -> U;

(modulo names.)
2015-08-17 14:48:44 -07:00
Huon Wilson
d792925b4d Shim some of the old std::simd functionality.
Overload the operators using the traits so that things mostly keep
working during the deprecation period.
2015-08-17 14:48:43 -07:00
Huon Wilson
62ba85b7aa Rebase cleanup: is_simd lost its parameter. 2015-08-17 14:41:40 -07:00
Huon Wilson
4b242497d3 Code style tweaks. 2015-08-17 14:41:40 -07:00
Huon Wilson
84de8caa87 Add tests for various intrinsic behaviours. 2015-08-17 14:41:40 -07:00
Huon Wilson
926b8351cf Tweak intrinsic error handling.
Better error messages, US spelling, more real checks.
2015-08-17 14:41:40 -07:00
Huon Wilson
3e500673cc Fix existing tests for new #[repr(simd)]. 2015-08-17 14:41:40 -07:00
Huon Wilson
8b68f58fef Allow generic repr(simd) types.
Absolute correctness is checked at monomorphisation time.
2015-08-17 14:41:40 -07:00
Huon Wilson
1f5739fb3c Switch shuffle intrinsics to arrays of indices.
Format:

    fn shuffle_simdNNN<T, U>(x: T, y: T, idx: [u32; NNN]) -> U;
2015-08-17 14:41:40 -07:00
Huon Wilson
2115468f33 Add most ARM intrinsics. 2015-08-17 14:41:40 -07:00
Huon Wilson
d598bddc98 Reorganise ARM intrinsic definitions. 2015-08-17 14:41:40 -07:00
Huon Wilson
2a408ef6ee Add most AVX2 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
29b79aabd8 Add most AVX intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
67d56db16f Rearrange x86 intrinsics to prepare for AVX. 2015-08-17 14:41:39 -07:00
Huon Wilson
627784b186 Add most SSE4.1 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
f6275b760c Add most SSSE3 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
9d78efbd60 Add most SSE3 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
907bbac40f Reorganise x86 intrinsic definitions.
- factor out redundant mm prefix
- group methods by instruction set
2015-08-17 14:41:39 -07:00
Huon Wilson
e61f5397db Add most SSE2 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
9b26895346 Generalise SIMD casting to unequal bitwidths. 2015-08-17 14:41:39 -07:00
Huon Wilson
4fe138cac0 Add _mm_shuffle_epi8 intrinsic. 2015-08-17 14:41:39 -07:00
Huon Wilson
bef1828d42 Rename simd_basics feature gate to repr_simd. 2015-08-17 14:41:39 -07:00
Huon Wilson
48f3507763 Use error codes for platform-intrinsic typeck errors. 2015-08-17 14:41:39 -07:00
Huon Wilson
dbcd9f00d1 Create separate module for intrinsic typechecking. 2015-08-17 14:41:38 -07:00
Huon Wilson
717da9513f Create "platform-intrinsic" ABI for SIMD/platform intrinsics.
This is purposely separate to the "rust-intrinsic" ABI, because these
intrinsics are theoretically going to become stable, and should be fine
to be independent of the compiler/language internals since they're
intimately to the platform.
2015-08-17 14:41:38 -07:00
Huon Wilson
58891278a3 Type check platform-intrinsics in typeck. 2015-08-17 14:41:38 -07:00
Huon Wilson
cb1eb9d0c4 Remove automatic built-in SIMD operators.
These should now go via the intrinsics, and implement the standard traits.
2015-08-17 14:41:38 -07:00
Huon Wilson
8d8b489bc9 Add intrinsics for SIMD arithmetic. 2015-08-17 14:41:38 -07:00
Huon Wilson
ecb3df5a91 Add simd_cast intrinsic. 2015-08-17 14:41:38 -07:00
Huon Wilson
f1d3b0271e Add x86 & arm reciprocal approximation intrinsics. 2015-08-17 14:41:38 -07:00
Huon Wilson
78eead63fa Implement the simd_insert/simd_extract intrinsics. 2015-08-17 14:41:38 -07:00
Huon Wilson
9af385bddb Add rustc_platform_intrinsics & some arm/x86 intrs.
These are enough to implement a cross-platform SIMD single-precision
mandelbrot renderer.
2015-08-17 14:41:38 -07:00
Huon Wilson
1bfbde6778 Add comparison and shuffle SIMD intrinsics.
- simd_eq, simd_ne, simd_lt, simd_le, simd_gt, simd_ge
- simd_shuffleNNN
2015-08-17 14:41:37 -07:00
Huon Wilson
4f4425840d Add some SIMD target_feature cfg's when appropriate.
NB. this may not be 100% perfect.
2015-08-17 14:41:37 -07:00
Huon Wilson
e364f0eb5a feature gate cfg(target_feature).
This is theoretically a breaking change, but GitHub search turns up no
uses of it, and most non-built-in cfg's are passed via cargo features,
which look like `feature = "..."`, and hence can't overlap.
2015-08-17 14:41:37 -07:00
Huon Wilson
c66554cab3 switch core::simd to repr(simd) and deprecate it.
This functionality will be available out of tree in the `simd` crate on
crates.io.

[breaking-change]
2015-08-17 14:41:37 -07:00
Ariel Ben-Yehuda
13809ffff7 don't iterate over all impls when none match
before:
573.01user 4.04system 7:33.86elapsed 127%CPU (0avgtext+0avgdata 1141656maxresident)k
after:
567.03user 4.00system 7:28.23elapsed 127%CPU (0avgtext+0avgdata 1133112maxresident)k

an additional 1% improvement
2015-08-18 00:25:29 +03:00
Ariel Ben-Yehuda
8aeaaac654 add a fast-path to resolve_type_vars_if_possible
this avoids needless substituting

before:
577.76user 4.27system 7:36.13elapsed 127%CPU (0avgtext+0avgdata 1141608maxresident)k

after:
573.01user 4.04system 7:33.86elapsed 127%CPU (0avgtext+0avgdata 1141656maxresident)k
2015-08-18 00:24:16 +03:00
bors
6d992728c3 Auto merge of #27833 - arielb1:robust-construction, r=eddyb
Fixes #27815

r? @eddyb
2015-08-17 21:02:47 +00:00
Alex Crichton
bfc45834c1 test: Don't panic if some tests failed
This commit removes the call to `panic!("Some tests failed")` at the end of all
tests run when running with libtest. The panic is replaced with
`std::process::exit` to have a nonzero error code, but this change both:

1. Makes the test runner no longer print out the extraneous panic message at the
   end of a failing test run that some tests failed. (this is already summarized
   in the output of the test run).
2. When running tests with `RUST_BACKTRACE` set it removes an extraneous
   backtrace from the output (only failing tests will have their backtraces in
   the output.
2015-08-17 12:58:19 -07:00
Ariel Ben-Yehuda
96e6b2fef8 use an FnvHashSet instead of an HashSet in fulfill
this doesn't cause a measurable perf increase, but it makes callgrind output
cleaner. Anyway, rustc should be using FNV everywhere.
2015-08-17 21:53:46 +03:00