Skip to content

Commit f6cfb0b

Browse files
committed
---
yaml --- r: 232508 b: refs/heads/try c: a70635b h: refs/heads/master v: v3
1 parent ae42ec4 commit f6cfb0b

File tree

112 files changed

+1724
-3780
lines changed

Some content is hidden

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

112 files changed

+1724
-3780
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: a91f19f35662f83cdb20ae8445c941aaff33fc18
4+
refs/heads/try: a70635b2ccc0c3a28757fd948170f182299ce927
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: 3 additions & 4 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 rustc_platform_intrinsics
59+
rustc_data_structures
6060
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
6161
TOOLS := compiletest rustdoc rustc rustbook error-index-generator
6262

@@ -74,16 +74,15 @@ 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 rustc_platform_intrinsics
78-
DEPS_rustc_typeck := rustc syntax rustc_platform_intrinsics
77+
log syntax serialize rustc_llvm
78+
DEPS_rustc_typeck := rustc syntax
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
8786
DEPS_rustc_back := std syntax rustc_llvm flate log libc
8887
DEPS_rustc_data_structures := std log serialize
8988
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \

branches/try/src/libcollectionstest/str.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,6 @@ 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-
}
10888
}
10989

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

branches/try/src/libcore/lib.rs

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

@@ -151,13 +150,7 @@ pub mod iter;
151150
pub mod option;
152151
pub mod raw;
153152
pub mod result;
154-
155-
#[cfg(stage0)]
156-
#[path = "simd_old.rs"]
157-
pub mod simd;
158-
#[cfg(not(stage0))]
159153
pub mod simd;
160-
161154
pub mod slice;
162155
pub mod str;
163156
pub mod hash;

branches/try/src/libcore/marker.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
//! Rust types can be classified in various useful ways according to
1414
//! intrinsic properties of the type. These classifications, often called
1515
//! 'kinds', are represented as traits.
16-
//!
17-
//! They cannot be implemented by user code, but are instead implemented
18-
//! by the compiler automatically for the types to which they apply.
19-
//!
20-
//! Marker types are special types that are used with unsafe code to
21-
//! inform the compiler of special constraints. Marker types should
22-
//! only be needed when you are creating an abstraction that is
23-
//! implemented using unsafe code. In that case, you may want to embed
24-
//! some of the marker types below into your type.
2516
2617
#![stable(feature = "rust1", since = "1.0.0")]
2718

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

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,63 @@ 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+
219276
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
220277
/// number is `Float::nan()`.
221278
#[inline]
@@ -251,6 +308,14 @@ impl Float for f32 {
251308
self < 0.0 || (1.0 / self) == Float::neg_infinity()
252309
}
253310

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+
254319
/// Returns the reciprocal (multiplicative inverse) of the number.
255320
#[inline]
256321
fn recip(self) -> f32 { 1.0 / self }
@@ -260,6 +325,81 @@ impl Float for f32 {
260325
unsafe { intrinsics::powif32(self, n) }
261326
}
262327

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+
263403
/// Converts to degrees, assuming the number is in radians.
264404
#[inline]
265405
fn to_degrees(self) -> f32 { self * (180.0f32 / consts::PI) }

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

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,39 @@ 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+
219252
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
220253
/// number is `Float::nan()`.
221254
#[inline]
@@ -251,15 +284,74 @@ impl Float for f64 {
251284
self < 0.0 || (1.0 / self) == Float::neg_infinity()
252285
}
253286

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+
254295
/// Returns the reciprocal (multiplicative inverse) of the number.
255296
#[inline]
256297
fn recip(self) -> f64 { 1.0 / self }
257298

299+
#[inline]
300+
fn powf(self, n: f64) -> f64 {
301+
unsafe { intrinsics::powf64(self, n) }
302+
}
303+
258304
#[inline]
259305
fn powi(self, n: i32) -> f64 {
260306
unsafe { intrinsics::powif64(self, n) }
261307
}
262308

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+
263355
/// Converts to degrees, assuming the number is in radians.
264356
#[inline]
265357
fn to_degrees(self) -> f64 { self * (180.0f64 / consts::PI) }

0 commit comments

Comments
 (0)