about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2017-12-06Stabilize abi_sysv64CensoredUsername-1/+0
2017-12-02rustc: don't unpack newtypes of scalar-pairs with mismatched alignment.Eduard-Mihai Burtescu-0/+11
2017-11-25rustc: Add support for some more x86 SIMD opsAlex Crichton-0/+53
This commit adds compiler support for two basic operations needed for binding SIMD on x86 platforms: * First, a `nontemporal_store` intrinsic was added for the `_mm_stream_ps`, seen in rust-lang-nursery/stdsimd#114. This was relatively straightforward and is quite similar to the volatile store intrinsic. * Next, and much more intrusively, a new type to the backend was added. The `x86_mmx` type is used in LLVM for a 64-bit vector register and is used in various intrinsics like `_mm_abs_pi8` as seen in rust-lang-nursery/stdsimd#74. This new type was added as a new layout option as well as having support added to the trans backend. The type is enabled with the `#[repr(x86_mmx)]` attribute which is intended to just be an implementation detail of SIMD in Rust. I'm not 100% certain about how the `x86_mmx` type was added, so any extra eyes or thoughts on that would be greatly appreciated!
2017-11-19rustc_trans: work around i686-pc-windows-msvc byval align LLVM bug.Eduard-Mihai Burtescu-3/+3
2017-11-19Don't glob-import overlapping variant names in ↵Eduard-Mihai Burtescu-11/+9
test/codegen/match-optimizes-away.rs.
2017-11-19rustc: unpack scalar pair newtype layout ABIs.Eduard-Mihai Burtescu-1/+1
2017-11-19rustc: unpack scalar newtype layout ABIs.Eduard-Mihai Burtescu-5/+5
2017-11-19rustc: encode scalar pairs in layout ABI.Eduard-Mihai Burtescu-10/+7
2017-11-19rustc_trans: compute better align/dereferenceable attributes from pointees.Eduard-Mihai Burtescu-6/+6
2017-11-19rustc_trans: go through layouts uniformly for fat pointers and variants.Eduard-Mihai Burtescu-14/+13
2017-11-19rustc: do not inject discriminant fields into Layout::General's variants.Eduard-Mihai Burtescu-2/+2
2017-11-19rustc_trans: always insert alignment padding, even before the first field.Eduard-Mihai Burtescu-8/+11
2017-11-19rustc_trans: use *[T; 0] for slice data pointers instead of *T.Eduard-Mihai Burtescu-7/+8
2017-11-19rustc_trans: use more of the trans::mir and ty::layout APIs throughout.Eduard-Mihai Burtescu-6/+6
2017-11-19rustc_trans: use a predictable layout for constant ADTs.Eduard-Mihai Burtescu-4/+4
2017-11-15Emit debug info for trait object pointerTom Tromey-0/+33
Emit better debugging information for a trait object pointer. In particular, now: * The fields are explicitly represented in the DWARF; * DWARF for the vtable itself is emitted; and * The DWARF for the vtable's type has a DW_AT_containing_type which points to the concrete type for which the vtable was emitted. This is a small DWARF extension, that allows debuggers to determine the real type of the object to which a trait object points. I'll submit the gdb patch to take advantage of this new debuginfo once this lands. The vtable type is not currently complete -- it doesn't include members for the pointers it contains. This information was not needed for this feature. This addresses part 1 of #1563.
2017-11-14add optimization codegen testsDjzin-0/+44
2017-11-14always add an unreachable branch on matches to give more info to llvm about ↵Djzin-3/+6
which values are possible
2017-11-10Make saturating u128 -> f32 casts the default behaviorRobin Kruppe-21/+2
... rather than being gated by -Z saturating-float-casts. There are several reasons for this: 1. Const eval already implements this behavior. 2. Unlike with float->int casts, this behavior is uncontroversially the right behavior and it is not as performance critical. Thus there is no particular need to make the bug fix for u128->f32 casts opt-in. 3. Having two orthogonal features under one flag is silly, and never should have happened in the first place. 4. Benchmarking float->int casts with the -Z flag should not pick up performance changes due to the u128->f32 casts (assuming there are any). Fixes #41799
2017-11-08Auto merge of #45205 - rkruppe:saturating-casts, r=eddybbors-0/+65
Saturating casts between integers and floats Introduces a new flag, `-Z saturating-float-casts`, which makes code generation for int->float and float->int casts safe (`undef`-free), implementing [the saturating semantics laid out by](https://github.com/rust-lang/rust/issues/10184#issuecomment-299229143) @jorendorff for float->int casts and overflowing to infinity for `u128::MAX` -> `f32`. Constant evaluation in trans was changed to behave like HIR const eval already did, i.e., saturate for u128->f32 and report an error for problematic float->int casts. Many thanks to @eddyb, whose APFloat port simplified many parts of this patch, and made HIR constant evaluation recognize dangerous float casts as mentioned above. Also thanks to @ActuallyaDeviloper whose branchless implementation served as inspiration for this implementation. cc #10184 #41799 fixes #45134
2017-11-08Update fastcall-inreg codegen test so that functions actually get instantiated.Michael Woerister-7/+7
2017-11-07Saturating casts between integers and floats (both directions).Robin Kruppe-0/+65
This affects regular code generation as well as constant evaluation in trans, but not the HIR constant evaluator because that one returns an error for overflowing casts and NaN-to-int casts. That error is conservatively correct and we should be careful to not accept more code in constant expressions. The changes to code generation are guarded by a new -Z flag, to be able to evaluate the performance impact. The trans constant evaluation changes are unconditional because they have no run time impact and don't affect type checking either.
2017-11-07Update codegen tests.Michael Woerister-20/+20
2017-10-26Avoid unnecessary copies of arguments that are simple bindingsBjörn Steinbrink-38/+36
Initially MIR differentiated between arguments and locals, which introduced a need to add extra copies assigning the argument to a local, even for simple bindings. This differentiation no longer exists, but we're still creating those copies, bloating the MIR and LLVM IR we emit. Additionally, the current approach means that we create debug info for both the incoming argument (marking it as an argument), and then immediately shadow it a local that goes by the same name. This can be confusing when using e.g. "info args" in gdb, or when e.g. a debugger with a GUI displays the function arguments separately from the local variables, especially when the binding is mutable, because the argument doesn't change, while the local variable does.
2017-10-21Auto merge of #45391 - malbarbo:x32-1, r=alexcrichtonbors-0/+1
Update libc and some fixes for x86_64-unknown-linux-gnux32
2017-10-20Fix some tests for linux gnux32Marco A L Barbosa-0/+1
2017-10-18Remove two obsolete min-llvm-version testsJosh Stone-1/+0
2017-10-16Update the codegen/mainsubprogram tests to min-llvm 4.0Josh Stone-8/+6
The necessary changes were only in upstream LLVM in 4.0, but they were for a while backported to Rust LLVM. Now that Rust LLVM is also 4.0, we can make the test conditional here more accurate.
2017-10-11rustc: Add LLVM `nounwind` with `-C panic=abort`Alex Crichton-1/+40
This informs LLVM that functions can't unwind, which while it should typically have already been inferred when necessary or otherwise not impact codegen is apparently needed on targets like ARM to avoid references to unnecessary symbols. Closes #44992
2017-10-07Fix typo in codegen testRobin Kruppe-1/+1
2017-10-05Auto merge of #44940 - philipc:remap-path, r=michaelwoeristerbors-0/+23
Don't use remapped path when loading modules and include files Fixes bug reported in https://github.com/rust-lang/rust/issues/41555#issuecomment-327866056. cc @michaelwoerister
2017-09-30rustc: Use 16bit c_int for msp430Daniel Klauer-0/+35
Fix regression from c2fe69b9, where main() signature was changed from using 16bit isize to 32bit c_int for argc parameter/result.
2017-09-30Don't use remapped path when loading modules and include filesPhilip Craig-0/+23
2017-09-28test: Check native main() signatureDaniel Klauer-0/+17
2017-09-02add test for not optimized `pow` with constant powerEvgeniy A. Dushistov-0/+23
Closes #34947
2017-08-28std: Mark allocation functions as nounwindAlex Crichton-0/+32
This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-06Auto merge of #43488 - Florob:repeat-opt, r=arielb1bors-0/+74
Optimize initialization of arrays using repeat expressions This PR was inspired by [this thread](https://www.reddit.com/r/rust/comments/6o8ok9/understanding_rust_performances_a_newbie_question/) on Reddit. It tries to bring array initialization in the same ballpark as `Vec::from_elem()` for unoptimized builds. For optimized builds this should relieve LLVM of having to figure out the construct we generate is in fact a `memset()`. To that end this emits `llvm.memset()` when: * the array is of integer type and all elements are zero (`Vec::from_elem()` also explicitly optimizes for this case) * the array elements are byte sized If the array is zero-sized initialization is omitted entirely.
2017-08-05codegen tests: Check type of `len` argument to `llvm.memset.*` based on the ↵Florian Zeitz-3/+3
exact intrinsic used
2017-07-29std: Mark `Layout::repeat` as `#[inline]`Alex Crichton-0/+21
This fixes an optimization regression by allowing LLVM to see through more functions. Closes #43272
2017-07-26trans: Optimize initialization using repeat expressionsFlorian Zeitz-0/+74
This elides initialization for zero-sized arrays: * for zero-sized elements we previously emitted an empty loop * for arrays with a length of zero we previously emitted a loop with zero iterations This emits llvm.memset() instead of a loop over each element when: * all elements are zero integers * elements are byte sized
2017-07-24Add a disabled builder for aarch64 emulated testsAlex Crichton-0/+1
This commit adds a disabled builder which will run all tests for the standard library for aarch64 in a QEMU instance. Once we get enough capacity to run this on Travis this can be used to boost our platform coverage of AArch64
2017-07-23Auto merge of #43387 - TimNN:rustllvm50, r=alexcrichtonbors-8/+8
Update Rust LLVM bindings for LLVM 5.0 This is the initial set of changes to update the rust llvm bindings for 5.0. The llvm commits necessitating these changes are linked from the tracking issue, #43370.
2017-07-21Relax a codegen test to be compatible with LLVM 5.0Alex Crichton-8/+8
2017-07-21Ignore stack probe tests on AArch64Mátyás Mustoha-0/+1
2017-07-18powerpc: Ignore the stack-probes testLuca Barbato-0/+1
2017-07-12[LLVM] Avoid losing the !nonnull attribute in SROAAriel Ben-Yehuda-0/+36
This still does not work on 32-bit archs because of an LLVM limitation, but this is only an optimization, so let's push it on 64-bit only for now. Fixes #37945
2017-07-06rustc: Implement stack probes for x86Alex Crichton-0/+24
This commit implements stack probes on x86/x86_64 using the freshly landed support upstream in LLVM. The purpose of stack probes here are to guarantee a segfault on stack overflow rather than having a chance of running over the guard page already present on all threads by accident. At this time there's no support for any other architecture because LLVM itself does not have support for other architectures.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-1/+1
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-19Auto merge of #39409 - pnkfelix:mir-borrowck2, r=nikomatsakisbors-1/+1
MIR EndRegion Statements (was MIR dataflow for Borrows) This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow). An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...) This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
2017-06-15Add a no-system-llvm compilecheck headerSimonas Kazlauskas-9/+3