File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,12 @@ fn main() {
53
53
assert_eq ! ( 0b100010000000000000000000000000000u128 >> 10 , 0b10001000000000000000000u128 ) ;
54
54
assert_eq ! ( 0xFEDCBA987654321123456789ABCDEFu128 >> 64 , 0xFEDCBA98765432u128 ) ;
55
55
assert_eq ! ( 0xFEDCBA987654321123456789ABCDEFu128 as i128 >> 64 , 0xFEDCBA98765432i128 ) ;
56
- assert_eq ! ( 353985398u128 * 932490u128 , 330087843781020u128 ) ;
56
+
57
+ let tmp = 353985398u128 ;
58
+ assert_eq ! ( tmp * 932490u128 , 330087843781020u128 ) ;
59
+
60
+ let tmp = -0x1234_5678_9ABC_DEF0i64 ;
61
+ assert_eq ! ( tmp as i128 , -0x1234_5678_9ABC_DEF0i128 ) ;
57
62
58
63
// Check that all u/i128 <-> float casts work correctly.
59
64
let houndred_u128 = 100u128 ;
Original file line number Diff line number Diff line change @@ -13,15 +13,19 @@ pub fn clif_intcast(
13
13
14
14
// extend
15
15
( _, types:: I128 ) => {
16
- let wider = if from == types:: I64 {
16
+ let lo = if from == types:: I64 {
17
17
val
18
18
} else if signed {
19
19
fx. bcx . ins ( ) . sextend ( types:: I64 , val)
20
20
} else {
21
21
fx. bcx . ins ( ) . uextend ( types:: I64 , val)
22
22
} ;
23
- let zero = fx. bcx . ins ( ) . iconst ( types:: I64 , 0 ) ;
24
- fx. bcx . ins ( ) . iconcat ( wider, zero)
23
+ let hi = if signed {
24
+ fx. bcx . ins ( ) . sshr_imm ( lo, 63 )
25
+ } else {
26
+ fx. bcx . ins ( ) . iconst ( types:: I64 , 0 )
27
+ } ;
28
+ fx. bcx . ins ( ) . iconcat ( lo, hi)
25
29
}
26
30
( _, _) if to. wider_or_equal ( from) => {
27
31
if signed {
You can’t perform that action at this time.
0 commit comments