Skip to content

Commit 96c1206

Browse files
committed
---
yaml --- r: 58364 b: refs/heads/auto c: 8d1a09c h: refs/heads/master v: v3
1 parent 5a9782e commit 96c1206

File tree

13 files changed

+35
-158
lines changed

13 files changed

+35
-158
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: fa1a172f9c8b5071a7bc9d818bfa6ae26401ec5b
17+
refs/heads/auto: 8d1a09c8109eec23c7e85feff26db75eca2dcfd6
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,7 @@ impl Float for f32 {
578578
/// Returns `true` if the number is neither zero, infinite, subnormal or NaN
579579
#[inline(always)]
580580
fn is_normal(&self) -> bool {
581-
match self.classify() {
582-
FPNormal => true,
583-
_ => false,
584-
}
581+
self.classify() == FPNormal
585582
}
586583

587584
/// Returns the floating point category of the number. If only one property is going to
@@ -591,14 +588,14 @@ impl Float for f32 {
591588
static MAN_MASK: u32 = 0x007fffff;
592589

593590
match (
591+
unsafe { ::cast::transmute::<f32,u32>(*self) } & MAN_MASK,
594592
unsafe { ::cast::transmute::<f32,u32>(*self) } & EXP_MASK,
595-
unsafe { ::cast::transmute::<f32,u32>(*self) } & MAN_MASK
596593
) {
597-
(EXP_MASK, 0) => FPInfinite,
598-
(EXP_MASK, _) => FPNaN,
599-
(exp, _) if exp != 0 => FPNormal,
600-
_ if self.is_zero() => FPZero,
601-
_ => FPSubnormal,
594+
(0, 0) => FPZero,
595+
(_, 0) => FPSubnormal,
596+
(0, EXP_MASK) => FPInfinite,
597+
(_, EXP_MASK) => FPNaN,
598+
_ => FPNormal,
602599
}
603600
}
604601

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,7 @@ impl Float for f64 {
621621
/// Returns `true` if the number is neither zero, infinite, subnormal or NaN
622622
#[inline(always)]
623623
fn is_normal(&self) -> bool {
624-
match self.classify() {
625-
FPNormal => true,
626-
_ => false,
627-
}
624+
self.classify() == FPNormal
628625
}
629626

630627
/// Returns the floating point category of the number. If only one property is going to
@@ -634,14 +631,14 @@ impl Float for f64 {
634631
static MAN_MASK: u64 = 0x000fffffffffffff;
635632

636633
match (
634+
unsafe { ::cast::transmute::<f64,u64>(*self) } & MAN_MASK,
637635
unsafe { ::cast::transmute::<f64,u64>(*self) } & EXP_MASK,
638-
unsafe { ::cast::transmute::<f64,u64>(*self) } & MAN_MASK
639636
) {
640-
(EXP_MASK, 0) => FPInfinite,
641-
(EXP_MASK, _) => FPNaN,
642-
(exp, _) if exp != 0 => FPNormal,
643-
_ if self.is_zero() => FPZero,
644-
_ => FPSubnormal,
637+
(0, 0) => FPZero,
638+
(_, 0) => FPSubnormal,
639+
(0, EXP_MASK) => FPInfinite,
640+
(_, EXP_MASK) => FPNaN,
641+
_ => FPNormal,
645642
}
646643
}
647644

branches/auto/src/libcore/unstable/intrinsics.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ pub extern "rust-intrinsic" {
1919
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
2020
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
2121
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
22-
23-
#[cfg(not(stage0))]
24-
pub fn atomic_load(src: &int) -> int;
25-
#[cfg(not(stage0))]
26-
pub fn atomic_load_acq(src: &int) -> int;
27-
28-
#[cfg(not(stage0))]
29-
pub fn atomic_store(dst: &mut int, val: int);
30-
#[cfg(not(stage0))]
31-
pub fn atomic_store_rel(dst: &mut int, val: int);
3222

3323
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
3424
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;

branches/auto/src/libcore/util.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -132,6 +132,20 @@ impl Drop for NonCopyable {
132132

133133
pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }
134134

135+
136+
/// A type with no inhabitants
137+
pub enum Void { }
138+
139+
pub impl Void {
140+
/// A utility function for ignoring this uninhabited type
141+
fn uninhabited(&self) -> ! {
142+
match *self {
143+
// Nothing to match on
144+
}
145+
}
146+
}
147+
148+
135149
/**
136150
A utility function for indicating unreachable code. It will fail if
137151
executed. This is occasionally useful to put after loops that never

branches/auto/src/librustc/lib/llvm.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,16 +1339,13 @@ pub mod llvm {
13391339
PointerVal: ValueRef) -> ValueRef;
13401340
#[fast_ffi]
13411341
pub unsafe fn LLVMBuildLoad(B: BuilderRef,
1342-
PointerVal: ValueRef,
1343-
Name: *c_char)
1344-
-> ValueRef;
1345-
1342+
PointerVal: ValueRef,
1343+
Name: *c_char)
1344+
-> ValueRef;
13461345
#[fast_ffi]
13471346
pub unsafe fn LLVMBuildStore(B: BuilderRef,
13481347
Val: ValueRef,
1349-
Ptr: ValueRef)
1350-
-> ValueRef;
1351-
1348+
Ptr: ValueRef) -> ValueRef;
13521349
#[fast_ffi]
13531350
pub unsafe fn LLVMBuildGEP(B: BuilderRef,
13541351
Pointer: ValueRef,
@@ -1564,17 +1561,6 @@ pub mod llvm {
15641561
Name: *c_char) -> ValueRef;
15651562

15661563
/* Atomic Operations */
1567-
pub unsafe fn LLVMBuildAtomicLoad(B: BuilderRef,
1568-
PointerVal: ValueRef,
1569-
Order: AtomicOrdering)
1570-
-> ValueRef;
1571-
1572-
pub unsafe fn LLVMBuildAtomicStore(B: BuilderRef,
1573-
Val: ValueRef,
1574-
Ptr: ValueRef,
1575-
Order: AtomicOrdering)
1576-
-> ValueRef;
1577-
15781564
pub unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
15791565
LHS: ValueRef,
15801566
CMP: ValueRef,

branches/auto/src/librustc/middle/trans/build.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -537,18 +537,6 @@ pub fn Load(cx: block, PointerVal: ValueRef) -> ValueRef {
537537
}
538538
}
539539
540-
pub fn AtomicLoad(cx: block, PointerVal: ValueRef, order: AtomicOrdering) -> ValueRef {
541-
unsafe {
542-
let ccx = cx.fcx.ccx;
543-
if cx.unreachable {
544-
return llvm::LLVMGetUndef(ccx.int_type);
545-
}
546-
count_insn(cx, "load.atomic");
547-
return llvm::LLVMBuildAtomicLoad(B(cx), PointerVal, order);
548-
}
549-
}
550-
551-
552540
pub fn LoadRangeAssert(cx: block, PointerVal: ValueRef, lo: c_ulonglong,
553541
hi: c_ulonglong, signed: lib::llvm::Bool) -> ValueRef {
554542
let value = Load(cx, PointerVal);
@@ -579,17 +567,6 @@ pub fn Store(cx: block, Val: ValueRef, Ptr: ValueRef) {
579567
}
580568
}
581569
582-
pub fn AtomicStore(cx: block, Val: ValueRef, Ptr: ValueRef, order: AtomicOrdering) {
583-
unsafe {
584-
if cx.unreachable { return; }
585-
debug!("Store %s -> %s",
586-
val_str(cx.ccx().tn, Val),
587-
val_str(cx.ccx().tn, Ptr));
588-
count_insn(cx, "store.atomic");
589-
llvm::LLVMBuildAtomicStore(B(cx), Val, Ptr, order);
590-
}
591-
}
592-
593570
pub fn GEP(cx: block, Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef {
594571
unsafe {
595572
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }

branches/auto/src/librustc/middle/trans/foreign.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -592,30 +592,6 @@ pub fn trans_intrinsic(ccx: @CrateContext,
592592
Release);
593593
Store(bcx, old, fcx.llretptr.get());
594594
}
595-
~"atomic_load" => {
596-
let old = AtomicLoad(bcx,
597-
get_param(decl, first_real_arg),
598-
SequentiallyConsistent);
599-
Store(bcx, old, fcx.llretptr.get());
600-
}
601-
~"atomic_load_acq" => {
602-
let old = AtomicLoad(bcx,
603-
get_param(decl, first_real_arg),
604-
Acquire);
605-
Store(bcx, old, fcx.llretptr.get());
606-
}
607-
~"atomic_store" => {
608-
AtomicStore(bcx,
609-
get_param(decl, first_real_arg + 1u),
610-
get_param(decl, first_real_arg),
611-
SequentiallyConsistent);
612-
}
613-
~"atomic_store_rel" => {
614-
AtomicStore(bcx,
615-
get_param(decl, first_real_arg + 1u),
616-
get_param(decl, first_real_arg),
617-
Release);
618-
}
619595
~"atomic_xchg" => {
620596
let old = AtomicRMW(bcx, Xchg,
621597
get_param(decl, first_real_arg),

branches/auto/src/librustc/middle/trans/type_use.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
124124
~"get_tydesc" | ~"needs_drop" => use_tydesc,
125125

126126
~"atomic_cxchg" | ~"atomic_cxchg_acq"|
127-
~"atomic_cxchg_rel"| ~"atomic_load" |
128-
~"atomic_load_acq" | ~"atomic_store" |
129-
~"atomic_store_rel"| ~"atomic_xchg" |
127+
~"atomic_cxchg_rel"| ~"atomic_xchg" |
130128
~"atomic_xadd" | ~"atomic_xsub" |
131129
~"atomic_xchg_acq" | ~"atomic_xadd_acq" |
132130
~"atomic_xsub_acq" | ~"atomic_xchg_rel" |

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,25 +3486,6 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
34863486
],
34873487
ty::mk_int())
34883488
}
3489-
~"atomic_load" | ~"atomic_load_acq" => {
3490-
(0,
3491-
~[
3492-
arg(ty::mk_imm_rptr(tcx,
3493-
ty::re_bound(ty::br_anon(0)),
3494-
ty::mk_int()))
3495-
],
3496-
ty::mk_int())
3497-
}
3498-
~"atomic_store" | ~"atomic_store_rel" => {
3499-
(0,
3500-
~[
3501-
arg(ty::mk_mut_rptr(tcx,
3502-
ty::re_bound(ty::br_anon(0)),
3503-
ty::mk_int())),
3504-
arg(ty::mk_int())
3505-
],
3506-
ty::mk_nil())
3507-
}
35083489
~"atomic_xchg" | ~"atomic_xadd" | ~"atomic_xsub" |
35093490
~"atomic_xchg_acq" | ~"atomic_xadd_acq" | ~"atomic_xsub_acq" |
35103491
~"atomic_xchg_rel" | ~"atomic_xadd_rel" | ~"atomic_xsub_rel" => {

branches/auto/src/rustllvm/RustWrapper.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -545,28 +545,6 @@ extern "C" LLVMTypeRef LLVMMetadataType(void) {
545545
return LLVMMetadataTypeInContext(LLVMGetGlobalContext());
546546
}
547547

548-
extern "C" LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef B,
549-
LLVMValueRef source,
550-
const char* Name,
551-
AtomicOrdering order) {
552-
LoadInst* li = new LoadInst(unwrap(source),0);
553-
li->setVolatile(true);
554-
li->setAtomic(order);
555-
li->setAlignment(sizeof(intptr_t));
556-
return wrap(unwrap(B)->Insert(li));
557-
}
558-
559-
extern "C" LLVMValueRef LLVMBuildAtomicStore(LLVMBuilderRef B,
560-
LLVMValueRef val,
561-
LLVMValueRef target,
562-
AtomicOrdering order) {
563-
StoreInst* si = new StoreInst(unwrap(val),unwrap(target));
564-
si->setVolatile(true);
565-
si->setAtomic(order);
566-
si->setAlignment(sizeof(intptr_t));
567-
return wrap(unwrap(B)->Insert(si));
568-
}
569-
570548
extern "C" LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B,
571549
LLVMValueRef target,
572550
LLVMValueRef old,

branches/auto/src/rustllvm/rustllvm.def.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ LLVMArrayType
8484
LLVMBasicBlockAsValue
8585
LLVMBlockAddress
8686
LLVMBuildAShr
87-
LLVMBuildAtomicLoad
88-
LLVMBuildAtomicStore
8987
LLVMBuildAtomicCmpXchg
9088
LLVMBuildAtomicRMW
9189
LLVMBuildAdd

branches/auto/src/test/run-pass/intrinsic-atomics.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ mod rusti {
1515
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
1616
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
1717

18-
pub fn atomic_load(src: &int) -> int;
19-
pub fn atomic_load_acq(src: &int) -> int;
20-
21-
pub fn atomic_store(dst: &mut int, val: int);
22-
pub fn atomic_store_rel(dst: &mut int, val: int);
23-
2418
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
2519
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
2620
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
@@ -39,15 +33,6 @@ pub fn main() {
3933
unsafe {
4034
let mut x = ~1;
4135

42-
assert!(rusti::atomic_load(x) == 1);
43-
*x = 5;
44-
assert!(rusti::atomic_load_acq(x) == 5);
45-
46-
rusti::atomic_store(x,3);
47-
assert!(*x == 3);
48-
rusti::atomic_store_rel(x,1);
49-
assert!(*x == 1);
50-
5136
assert!(rusti::atomic_cxchg(x, 1, 2) == 1);
5237
assert!(*x == 2);
5338

0 commit comments

Comments
 (0)