Commit graph

60123 commits

Author SHA1 Message Date
est31 6b359635ec Fix warning when compiling on 64 bit Linux
Code is much simpler now as well.
2016-12-30 15:19:51 +01:00
est31 d166ee9664 Add test to ensure unadjusted stays unstable 2016-12-30 15:19:51 +01:00
Simonas Kazlauskas 86ce3a2f7c Further and hopefully final Windows fixes 2016-12-30 15:19:50 +01:00
est31 ee6256b1ff More windows fixes 2016-12-30 15:17:30 +01:00
est31 9842d27e9c Fix build 2016-12-30 15:17:30 +01:00
Simonas Kazlauskas 5a853b0422 The windows special-cases only apply to x64 2016-12-30 15:17:30 +01:00
Simonas Kazlauskas e0e53773e3 Fix a return type 2016-12-30 15:17:30 +01:00
Simonas Kazlauskas 208c8f58b2 Fix sign-extension in stage1 compiler 2016-12-30 15:17:30 +01:00
est31 0a481fe5d2 Fix rebase fallout and compilation fixes 2016-12-30 15:17:30 +01:00
est31 dd10c5a503 Feature gate: 1.16.0 instead of 1.15.0 2016-12-30 15:17:30 +01:00
est31 8cbe725d34 Fix rebase fallout 2016-12-30 15:17:29 +01:00
est31 01dcb7fe6c Tidy 2016-12-30 15:17:29 +01:00
est31 c3e3bc0058 Fix another windows ABI mistake
...this time with the float intrinsics.
2016-12-30 15:17:29 +01:00
est31 d71223a6c5 intrinsics: try to return everything via {u,i}128ret to match LLVM
on suggestion by nagisa.
2016-12-30 15:17:29 +01:00
est31 92163f1c5e Windows x64 ABI requires i128 params to be passed as reference 2016-12-30 15:17:29 +01:00
est31 ca73affe8d Tidy 2016-12-30 15:17:29 +01:00
est31 53ff50a94f Port to wrapping_* and unchecked_* operations
Otherwise, we codegen panic calls which create problems with debug assertions turned on.
2016-12-30 15:17:28 +01:00
est31 3be141f1b4 Remove unimplemented() function 2016-12-30 15:17:28 +01:00
est31 92e6c53a25 libcompiler_builtins: don't codegen dead code call to eh_personality
There was a linker error on 32 bit platforms with optimisations turned off,
complaining that there was an undefined reference to "rust_eh_personality",
when compiling the rustc_const_math as stage1 artifact.

Apparently the compiler_builtins crate includes a call to "rust_eh_personality".
If compiled for 64 bits, this call doesn't appear, which explains why the linker
error only happens on 32 bit platforms, and optimisations will get it removed
on 32 bit as well.

There were two origins of the call:
    1. A for loop where apparently the compiler wasn't sure
       whether next() could panic or not, and therefore generated a landing
       pad for the worst case. The minimal reproducible example is "for _ in 0..sr { }".
    2. A default impl of uabs where the compiler apparently wasn't sure either
       whether iabs() could panic or not. Many thanks to nagisa for
       contributing the fix.

This commit also puts extern "C" to the intrinsics, as this is generally a
good thing to do.
2016-12-30 15:17:28 +01:00
est31 3e2046214c Try to fix some things
* shift so that no panics are generated (otherwise results in linker error)
* no_std as insurance to not get into issues with errors like "cannot satisfy dependencies so `rustc_i128` only shows up once" (pure guessing here, but it doesn't hurt...)
2016-12-30 15:17:28 +01:00
est31 317810d4c4 Always use Rust based intrinsics on Windows
The check inside compiler-rt file int_types.h to #define CRT_HAS_128BIT
looks like:

 #if (defined(__LP64__) || defined(__wasm__)) && \
     !(defined(__mips__) && defined(__clang__))
 #define CRT_HAS_128BIT
 #endif

Windows uses LLP64 instead of LP64, so it doesn't ship with the C based
intrinsics.

Also, add libcompiler_builtins to the list of crates that may have platform
specific checks (like the ones we just added).
2016-12-30 15:17:28 +01:00
est31 c79aba71d5 40 -> 39, as ceil(log10(2^128)) == 39
just as ceil(log10(2^64)) == 20
2016-12-30 15:17:28 +01:00
est31 3b34f90bc1 Move from RUSTC_CRATES to TARGET_CRATES 2016-12-30 15:17:28 +01:00
est31 13d49f5299 Fix warning on 64 bit 2016-12-30 15:17:28 +01:00
est31 2715367f08 intrinsics : uabs and iabs 2016-12-30 15:17:28 +01:00
est31 dc14a108ae Fix intrinsics and expand tests 2016-12-30 15:17:27 +01:00
est31 85ec09187c Make rustdoc aware of the primitive i128 type
Many thanks to ollie27 for spotting all the places.
2016-12-30 15:17:27 +01:00
est31 9e99213831 Compilation fixes 2016-12-30 15:17:27 +01:00
est31 8bcb021991 Use LLVMRustConstInt128Get on stage1 too
llvm::LLVMConstIntGetZExtValue doesn't accept values with more than 64 bits.

This fixes an LLVM assertion error when compiling libcore with stage1:

src/llvm/include/llvm/ADT/APInt.h:1336:
	uint64_t llvm::APInt::getZExtValue() const:
		Assertion `getActiveBits() <= 64 && "Too many bits for uint64_t"' failed.
2016-12-30 15:17:27 +01:00
est31 32d8d24159 Fix rebase fallout 2016-12-30 15:17:27 +01:00
Simonas Kazlauskas 5fd5d524b7 WIP intrinsics 2016-12-30 15:17:27 +01:00
Simonas Kazlauskas 7a3704c500 Fix rebase fallout
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:27 +01:00
Simonas Kazlauskas bfa53cfb76 Fix i128 alignment calculation 2016-12-30 15:17:27 +01:00
Simonas Kazlauskas 4ff620e0ed Implement emit_iu128 for json serialiser
Causes ICEs otherwise while trying to dump AST
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas 9aad2d551e Add a way to retrieve constant value in 128 bits
Fixes rebase fallout, makes code correct in presence of 128-bit constants.

This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas 508fef5dff impl Step for iu128
Also fix the leb128 tests
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas db2527add3 Fix parse-fail and compile-fail tests 2016-12-30 15:17:26 +01:00
Simonas Kazlauskas d9eb756cbf Wrapping<i128> and attempt at LLVM 3.7 compat
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas ec1fdfe1c3 Makefiles support for rustc_i128 crate
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas 64fbce6826 Tidy
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas 64de4e2731 Fix LEB128 to work with the stage1
Stage 1 can’t really handle negative 128-bit literals, but an equivalent bit-not is fine
2016-12-30 15:17:25 +01:00
Simonas Kazlauskas 4e2b946e65 Cleanup FIXMEs 2016-12-30 15:17:25 +01:00
Simonas Kazlauskas d4d5be18b7 Feature gate the 128 bit types
Dangling a carrot in front of a donkey.

This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:25 +01:00
Simonas Kazlauskas b5260644af Tests for the 128 bit integers 2016-12-30 15:15:44 +01:00
Simonas Kazlauskas b0e55a83a8 Such large. Very 128. Much bits.
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which
understands and supports 128-bit integers throughout.

The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to
iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported,
this strategy is good enough to get past the first bootstrap stages to end up with a fully working
128-bit capable compiler.

In order for this strategy to work, number of locations had to be changed to use associated
max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?)
had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works
(former not necessarily producing the right results in stage1).

This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:15:44 +01:00
Philip Craig e8d8353c20 rustbuild: allow running debuginfo-lldb tests on linux 2016-12-30 22:39:47 +10:00
bors 7f2d2afa91 Auto merge of #38697 - alexcrichton:rollup, r=alexcrichton
Rollup of 25 pull requests

- Successful merges: #37149, #38491, #38517, #38559, #38587, #38609, #38611, #38622, #38628, #38630, #38631, #38632, #38635, #38647, #38649, #38655, #38659, #38660, #38662, #38665, #38671, #38674, #38676, #38693, #38695
- Failed merges: #38657, #38680
2016-12-30 07:34:19 +00:00
Alex Crichton e484197482 A few small test fixes and such from rollup 2016-12-29 23:33:13 -08:00
Jonathan A. Kollasch 8aef058329 Add sparc64-unknown-netbsd target 2016-12-29 21:30:01 -05:00
Jonathan A. Kollasch 0751743d86 libpanic_unwind: UNWIND_DATA_REG for sparc64 2016-12-29 21:30:01 -05:00