File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ no-lang-items = []
60
60
# Only used in the compiler's build system
61
61
rustc-dep-of-std = [' compiler-builtins' , ' core' ]
62
62
63
+ # Used for faster u128 division on x86_64
64
+ asymmetric-asm = []
65
+
63
66
[[example ]]
64
67
name = " intrinsics"
65
68
required-features = [" compiler-builtins" ]
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ intrinsics! {
53
53
// `_trifecta` is efficient for large divisions, even when division
54
54
// hardware is not availiable at all.
55
55
56
- #[ cfg( not( target = "x86_64" ) ) ]
56
+ #[ cfg( any ( not( feature = "asymmetric-asm" ) , not ( target = "x86_64" ) ) ) ]
57
57
intrinsics ! {
58
58
#[ win64_128bit_abi_hack]
59
59
/// Returns `n / d`
@@ -68,7 +68,7 @@ intrinsics! {
68
68
}
69
69
}
70
70
71
- #[ cfg( target = "x86_64" ) ]
71
+ #[ cfg( all ( feature = "asymmetric-asm" , target = "x86_64" ) ) ]
72
72
intrinsics ! {
73
73
#[ win64_128bit_abi_hack]
74
74
/// Returns `a / b`
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ mod asymmetric;
18
18
19
19
/// This function is unsafe, because if the quotient of `duo` and `div` does not
20
20
/// fit in a `u64`, a floating point exception is thrown.
21
- #[ cfg( target = "x86_64" ) ]
21
+ #[ cfg( all ( feature = "asymmetric-asm" , target = "x86_64" ) ) ]
22
22
#[ inline]
23
23
unsafe fn u128_by_u64_div_rem ( duo : u128 , div : u64 ) -> ( u64 , u64 ) {
24
24
let quo: u64 ;
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ intrinsics! {
56
56
// `_trifecta` is efficient for large divisions, even when division
57
57
// hardware is not availiable at all.
58
58
59
- #[ cfg( not( target = "x86_64" ) ) ]
59
+ #[ cfg( any ( not( feature = "asymmetric-asm" ) , not ( target = "x86_64" ) ) ) ]
60
60
intrinsics ! {
61
61
#[ win64_128bit_abi_hack]
62
62
/// Returns `n / d`
@@ -81,7 +81,7 @@ intrinsics! {
81
81
}
82
82
}
83
83
84
- #[ cfg( target = "x86_64" ) ]
84
+ #[ cfg( all ( feature = "asymmetric-asm" , target = "x86_64" ) ) ]
85
85
intrinsics ! {
86
86
#[ win64_128bit_abi_hack]
87
87
/// Returns `n / d`
You can’t perform that action at this time.
0 commit comments