File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
branches/try/src/libcore/num Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5
- refs/heads/try: 8f991d1fc27a176254ebfe99ed7e5a339cb9c7e2
5
+ refs/heads/try: 36dccec2f39c7e1da7f056ea421ad5256df3fb0b
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
8
8
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
Original file line number Diff line number Diff line change @@ -745,7 +745,20 @@ macro_rules! uint_impl {
745
745
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
746
746
#[ inline]
747
747
pub fn trailing_zeros( self ) -> u32 {
748
- unsafe { $cttz( self as $ActualT) as u32 }
748
+ // As of LLVM 3.6 the codegen for the zero-safe cttz8 intrinsic
749
+ // emits two conditional moves on x86_64. By promoting the value to
750
+ // u16 and setting bit 8, we get better code without any conditional
751
+ // operations.
752
+ // FIXME: There's a LLVM patch (http://reviews.llvm.org/D9284)
753
+ // pending, remove this workaround once LLVM generates better code
754
+ // for cttz8.
755
+ unsafe {
756
+ if $BITS == 8 {
757
+ intrinsics:: cttz16( self as u16 | 0x100 ) as u32
758
+ } else {
759
+ $cttz( self as $ActualT) as u32
760
+ }
761
+ }
749
762
}
750
763
751
764
/// Shifts the bits to the left by a specified amount, `n`,
You can’t perform that action at this time.
0 commit comments