Skip to content

Commit 653793d

Browse files
committed
---
yaml --- r: 232505 b: refs/heads/try c: 16cacbe h: refs/heads/master i: 232503: 8bc3d62 v: v3
1 parent 126732e commit 653793d

File tree

105 files changed

+3751
-1693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3751
-1693
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 13809ffff7022a24b33d93f63a2cbdb6ecd20805
4+
refs/heads/try: 16cacbe2586fb37521679664798d006cd6831504
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/mk/crates.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ TARGET_CRATES := libc std flate arena term \
5656
alloc_system
5757
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
5858
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
59-
rustc_data_structures
59+
rustc_data_structures rustc_platform_intrinsics
6060
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
6161
TOOLS := compiletest rustdoc rustc rustbook error-index-generator
6262

@@ -74,15 +74,16 @@ DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_bo
7474
rustc_trans rustc_privacy rustc_lint
7575

7676
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
77-
log syntax serialize rustc_llvm
78-
DEPS_rustc_typeck := rustc syntax
77+
log syntax serialize rustc_llvm rustc_platform_intrinsics
78+
DEPS_rustc_typeck := rustc syntax rustc_platform_intrinsics
7979
DEPS_rustc_borrowck := rustc log graphviz syntax
8080
DEPS_rustc_resolve := rustc log syntax
8181
DEPS_rustc_privacy := rustc log syntax
8282
DEPS_rustc_lint := rustc log syntax
8383
DEPS_rustc := syntax flate arena serialize getopts rbml \
8484
log graphviz rustc_llvm rustc_back rustc_data_structures
8585
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
86+
DEPS_rustc_platform_intrinsics := rustc rustc_llvm
8687
DEPS_rustc_back := std syntax rustc_llvm flate log libc
8788
DEPS_rustc_data_structures := std log serialize
8889
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \

branches/try/src/libcollectionstest/str.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,26 @@ fn test_find_str() {
8585
assert_eq!(data[43..86].find("ย中"), Some(67 - 43));
8686
assert_eq!(data[43..86].find("iệt"), Some(77 - 43));
8787
assert_eq!(data[43..86].find("Nam"), Some(83 - 43));
88+
89+
// find every substring -- assert that it finds it, or an earlier occurence.
90+
let string = "Việt Namacbaabcaabaaba";
91+
for (i, ci) in string.char_indices() {
92+
let ip = i + ci.len_utf8();
93+
for j in string[ip..].char_indices()
94+
.map(|(i, _)| i)
95+
.chain(Some(string.len() - ip))
96+
{
97+
let pat = &string[i..ip + j];
98+
assert!(match string.find(pat) {
99+
None => false,
100+
Some(x) => x <= i,
101+
});
102+
assert!(match string.rfind(pat) {
103+
None => false,
104+
Some(x) => x >= i,
105+
});
106+
}
107+
}
88108
}
89109

90110
fn s(x: &str) -> String { x.to_string() }

branches/try/src/libcore/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
#![feature(optin_builtin_traits)]
7979
#![feature(reflect)]
8080
#![feature(rustc_attrs)]
81-
#![feature(simd)]
81+
#![cfg_attr(stage0, feature(simd))]
82+
#![cfg_attr(not(stage0), feature(repr_simd, platform_intrinsics))]
8283
#![feature(staged_api)]
8384
#![feature(unboxed_closures)]
8485

@@ -150,7 +151,13 @@ pub mod iter;
150151
pub mod option;
151152
pub mod raw;
152153
pub mod result;
154+
155+
#[cfg(stage0)]
156+
#[path = "simd_old.rs"]
157+
pub mod simd;
158+
#[cfg(not(stage0))]
153159
pub mod simd;
160+
154161
pub mod slice;
155162
pub mod str;
156163
pub mod hash;

branches/try/src/libcore/num/f32.rs

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -216,63 +216,6 @@ impl Float for f32 {
216216
(mantissa as u64, exponent, sign)
217217
}
218218

219-
/// Rounds towards minus infinity.
220-
#[inline]
221-
fn floor(self) -> f32 {
222-
return floorf(self);
223-
224-
// On MSVC LLVM will lower many math intrinsics to a call to the
225-
// corresponding function. On MSVC, however, many of these functions
226-
// aren't actually available as symbols to call, but rather they are all
227-
// `static inline` functions in header files. This means that from a C
228-
// perspective it's "compatible", but not so much from an ABI
229-
// perspective (which we're worried about).
230-
//
231-
// The inline header functions always just cast to a f64 and do their
232-
// operation, so we do that here as well, but only for MSVC targets.
233-
//
234-
// Note that there are many MSVC-specific float operations which
235-
// redirect to this comment, so `floorf` is just one case of a missing
236-
// function on MSVC, but there are many others elsewhere.
237-
#[cfg(target_env = "msvc")]
238-
fn floorf(f: f32) -> f32 { (f as f64).floor() as f32 }
239-
#[cfg(not(target_env = "msvc"))]
240-
fn floorf(f: f32) -> f32 { unsafe { intrinsics::floorf32(f) } }
241-
}
242-
243-
/// Rounds towards plus infinity.
244-
#[inline]
245-
fn ceil(self) -> f32 {
246-
return ceilf(self);
247-
248-
// see notes above in `floor`
249-
#[cfg(target_env = "msvc")]
250-
fn ceilf(f: f32) -> f32 { (f as f64).ceil() as f32 }
251-
#[cfg(not(target_env = "msvc"))]
252-
fn ceilf(f: f32) -> f32 { unsafe { intrinsics::ceilf32(f) } }
253-
}
254-
255-
/// Rounds to nearest integer. Rounds half-way cases away from zero.
256-
#[inline]
257-
fn round(self) -> f32 {
258-
unsafe { intrinsics::roundf32(self) }
259-
}
260-
261-
/// Returns the integer part of the number (rounds towards zero).
262-
#[inline]
263-
fn trunc(self) -> f32 {
264-
unsafe { intrinsics::truncf32(self) }
265-
}
266-
267-
/// The fractional part of the number, satisfying:
268-
///
269-
/// ```
270-
/// let x = 1.65f32;
271-
/// assert!(x == x.trunc() + x.fract())
272-
/// ```
273-
#[inline]
274-
fn fract(self) -> f32 { self - self.trunc() }
275-
276219
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
277220
/// number is `Float::nan()`.
278221
#[inline]
@@ -308,14 +251,6 @@ impl Float for f32 {
308251
self < 0.0 || (1.0 / self) == Float::neg_infinity()
309252
}
310253

311-
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
312-
/// error. This produces a more accurate result with better performance than
313-
/// a separate multiplication operation followed by an add.
314-
#[inline]
315-
fn mul_add(self, a: f32, b: f32) -> f32 {
316-
unsafe { intrinsics::fmaf32(self, a, b) }
317-
}
318-
319254
/// Returns the reciprocal (multiplicative inverse) of the number.
320255
#[inline]
321256
fn recip(self) -> f32 { 1.0 / self }
@@ -325,81 +260,6 @@ impl Float for f32 {
325260
unsafe { intrinsics::powif32(self, n) }
326261
}
327262

328-
#[inline]
329-
fn powf(self, n: f32) -> f32 {
330-
return powf(self, n);
331-
332-
// see notes above in `floor`
333-
#[cfg(target_env = "msvc")]
334-
fn powf(f: f32, n: f32) -> f32 { (f as f64).powf(n as f64) as f32 }
335-
#[cfg(not(target_env = "msvc"))]
336-
fn powf(f: f32, n: f32) -> f32 { unsafe { intrinsics::powf32(f, n) } }
337-
}
338-
339-
#[inline]
340-
fn sqrt(self) -> f32 {
341-
if self < 0.0 {
342-
NAN
343-
} else {
344-
unsafe { intrinsics::sqrtf32(self) }
345-
}
346-
}
347-
348-
#[inline]
349-
fn rsqrt(self) -> f32 { self.sqrt().recip() }
350-
351-
/// Returns the exponential of the number.
352-
#[inline]
353-
fn exp(self) -> f32 {
354-
return expf(self);
355-
356-
// see notes above in `floor`
357-
#[cfg(target_env = "msvc")]
358-
fn expf(f: f32) -> f32 { (f as f64).exp() as f32 }
359-
#[cfg(not(target_env = "msvc"))]
360-
fn expf(f: f32) -> f32 { unsafe { intrinsics::expf32(f) } }
361-
}
362-
363-
/// Returns 2 raised to the power of the number.
364-
#[inline]
365-
fn exp2(self) -> f32 {
366-
unsafe { intrinsics::exp2f32(self) }
367-
}
368-
369-
/// Returns the natural logarithm of the number.
370-
#[inline]
371-
fn ln(self) -> f32 {
372-
return logf(self);
373-
374-
// see notes above in `floor`
375-
#[cfg(target_env = "msvc")]
376-
fn logf(f: f32) -> f32 { (f as f64).ln() as f32 }
377-
#[cfg(not(target_env = "msvc"))]
378-
fn logf(f: f32) -> f32 { unsafe { intrinsics::logf32(f) } }
379-
}
380-
381-
/// Returns the logarithm of the number with respect to an arbitrary base.
382-
#[inline]
383-
fn log(self, base: f32) -> f32 { self.ln() / base.ln() }
384-
385-
/// Returns the base 2 logarithm of the number.
386-
#[inline]
387-
fn log2(self) -> f32 {
388-
unsafe { intrinsics::log2f32(self) }
389-
}
390-
391-
/// Returns the base 10 logarithm of the number.
392-
#[inline]
393-
fn log10(self) -> f32 {
394-
return log10f(self);
395-
396-
// see notes above in `floor`
397-
#[cfg(target_env = "msvc")]
398-
fn log10f(f: f32) -> f32 { (f as f64).log10() as f32 }
399-
#[cfg(not(target_env = "msvc"))]
400-
fn log10f(f: f32) -> f32 { unsafe { intrinsics::log10f32(f) } }
401-
}
402-
403263
/// Converts to degrees, assuming the number is in radians.
404264
#[inline]
405265
fn to_degrees(self) -> f32 { self * (180.0f32 / consts::PI) }

branches/try/src/libcore/num/f64.rs

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -216,39 +216,6 @@ impl Float for f64 {
216216
(mantissa, exponent, sign)
217217
}
218218

219-
/// Rounds towards minus infinity.
220-
#[inline]
221-
fn floor(self) -> f64 {
222-
unsafe { intrinsics::floorf64(self) }
223-
}
224-
225-
/// Rounds towards plus infinity.
226-
#[inline]
227-
fn ceil(self) -> f64 {
228-
unsafe { intrinsics::ceilf64(self) }
229-
}
230-
231-
/// Rounds to nearest integer. Rounds half-way cases away from zero.
232-
#[inline]
233-
fn round(self) -> f64 {
234-
unsafe { intrinsics::roundf64(self) }
235-
}
236-
237-
/// Returns the integer part of the number (rounds towards zero).
238-
#[inline]
239-
fn trunc(self) -> f64 {
240-
unsafe { intrinsics::truncf64(self) }
241-
}
242-
243-
/// The fractional part of the number, satisfying:
244-
///
245-
/// ```
246-
/// let x = 1.65f64;
247-
/// assert!(x == x.trunc() + x.fract())
248-
/// ```
249-
#[inline]
250-
fn fract(self) -> f64 { self - self.trunc() }
251-
252219
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
253220
/// number is `Float::nan()`.
254221
#[inline]
@@ -284,74 +251,15 @@ impl Float for f64 {
284251
self < 0.0 || (1.0 / self) == Float::neg_infinity()
285252
}
286253

287-
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
288-
/// error. This produces a more accurate result with better performance than
289-
/// a separate multiplication operation followed by an add.
290-
#[inline]
291-
fn mul_add(self, a: f64, b: f64) -> f64 {
292-
unsafe { intrinsics::fmaf64(self, a, b) }
293-
}
294-
295254
/// Returns the reciprocal (multiplicative inverse) of the number.
296255
#[inline]
297256
fn recip(self) -> f64 { 1.0 / self }
298257

299-
#[inline]
300-
fn powf(self, n: f64) -> f64 {
301-
unsafe { intrinsics::powf64(self, n) }
302-
}
303-
304258
#[inline]
305259
fn powi(self, n: i32) -> f64 {
306260
unsafe { intrinsics::powif64(self, n) }
307261
}
308262

309-
#[inline]
310-
fn sqrt(self) -> f64 {
311-
if self < 0.0 {
312-
NAN
313-
} else {
314-
unsafe { intrinsics::sqrtf64(self) }
315-
}
316-
}
317-
318-
#[inline]
319-
fn rsqrt(self) -> f64 { self.sqrt().recip() }
320-
321-
/// Returns the exponential of the number.
322-
#[inline]
323-
fn exp(self) -> f64 {
324-
unsafe { intrinsics::expf64(self) }
325-
}
326-
327-
/// Returns 2 raised to the power of the number.
328-
#[inline]
329-
fn exp2(self) -> f64 {
330-
unsafe { intrinsics::exp2f64(self) }
331-
}
332-
333-
/// Returns the natural logarithm of the number.
334-
#[inline]
335-
fn ln(self) -> f64 {
336-
unsafe { intrinsics::logf64(self) }
337-
}
338-
339-
/// Returns the logarithm of the number with respect to an arbitrary base.
340-
#[inline]
341-
fn log(self, base: f64) -> f64 { self.ln() / base.ln() }
342-
343-
/// Returns the base 2 logarithm of the number.
344-
#[inline]
345-
fn log2(self) -> f64 {
346-
unsafe { intrinsics::log2f64(self) }
347-
}
348-
349-
/// Returns the base 10 logarithm of the number.
350-
#[inline]
351-
fn log10(self) -> f64 {
352-
unsafe { intrinsics::log10f64(self) }
353-
}
354-
355263
/// Converts to degrees, assuming the number is in radians.
356264
#[inline]
357265
fn to_degrees(self) -> f64 { self * (180.0f64 / consts::PI) }

branches/try/src/libcore/num/flt2dec/decoder.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,15 @@ pub enum FullDecoded {
5353

5454
/// A floating point type which can be `decode`d.
5555
pub trait DecodableFloat: Float + Copy {
56-
/// Returns `x * 2^exp`. Almost same to `std::{f32,f64}::ldexp`.
57-
/// This is used for testing.
58-
fn ldexpi(f: i64, exp: isize) -> Self;
5956
/// The minimum positive normalized value.
6057
fn min_pos_norm_value() -> Self;
6158
}
6259

6360
impl DecodableFloat for f32 {
64-
fn ldexpi(f: i64, exp: isize) -> Self { f as Self * (exp as Self).exp2() }
6561
fn min_pos_norm_value() -> Self { f32::MIN_POSITIVE }
6662
}
6763

6864
impl DecodableFloat for f64 {
69-
fn ldexpi(f: i64, exp: isize) -> Self { f as Self * (exp as Self).exp2() }
7065
fn min_pos_norm_value() -> Self { f64::MIN_POSITIVE }
7166
}
7267

branches/try/src/libcore/num/flt2dec/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ functions.
132132

133133
use prelude::v1::*;
134134
use i16;
135-
use num::Float;
136135
use slice::bytes;
137136
pub use self::decoder::{decode, DecodableFloat, FullDecoded, Decoded};
138137

0 commit comments

Comments
 (0)