about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-04-13 13:04:15 -0400
committerGitHub <noreply@github.com>2017-04-13 13:04:15 -0400
commit6dfd8f6e12e94ca17009d641cff743a13a13285c (patch)
tree42d36ca52ad06607b2b8d32cd04f3d1b823b2a29 /src/test/run-pass/thinlto
parent9eb3468e2f40ea2c3d7f00de07e51214c37f71e5 (diff)
parent71a9e106690627e657a466938e578608d8bcd04a (diff)
downloadrust-6dfd8f6e12e94ca17009d641cff743a13a13285c.tar.gz
rust-6dfd8f6e12e94ca17009d641cff743a13a13285c.zip
Rollup merge of #41250 - kennytm:fix-41228, r=nikomatsakis
Fix invalid 128-bit division on 32-bit target (#41228)

The bug of #41228 is a typo, this line: https://github.com/rust-lang/rust/blob/1dca19ae3fd195fa517e326a39bfee729da7cadb/src/libcompiler_builtins/lib.rs#L183

```rust
            // 1 <= sr <= u64::bits() - 1
            q = n.wrapping_shl(64u32.wrapping_sub(sr));
```

The **64** should be **128**.

(Compare with https://github.com/rust-lang-nursery/compiler-builtins/blob/280d19f1127aa80739f4179152b11a5f7d36d79f/src/int/udiv.rs#L213-L214:

```rust
            // 1 <= sr <= <hty!($ty)>::bits() - 1
            q = n << (<$ty>::bits() - sr);
```

Or compare with the C implementation https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/udivmodti4.c#L113-L116

```c
        /* 1 <= sr <= n_udword_bits - 1 */
        /* q.all = n.all << (n_utword_bits - sr); */
        q.s.low = 0;
        q.s.high = n.s.low << (n_udword_bits - sr);
```
)

Added a bunch of randomly generated division test cases to try to cover every described branch of `udivmodti4`.
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions