about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
2024-08-12Rollup merge of #128537 - Jamesbarford:118980-const-vector, r=RalfJung,nikicGuillaume Gomez-0/+107
const vector passed through to codegen This allows constant vectors using a repr(simd) type to be propagated through to the backend by reusing the functionality used to do a similar thing for the simd_shuffle intrinsic #118209 r​? RalfJung
2024-08-12Rollup merge of #128149 - RalfJung:nontemporal_store, r=jieyouxu,Amanieu,JubileeGuillaume Gomez-3/+27
nontemporal_store: make sure that the intrinsic is truly just a hint The `!nontemporal` flag for stores in LLVM *sounds* like it is just a hint, but actually, it is not -- at least on x86, non-temporal stores need very special treatment by the programmer or else the Rust memory model breaks down. LLVM still treats these stores as-if they were normal stores for optimizations, which is [highly dubious](https://github.com/llvm/llvm-project/issues/64521). Let's avoid all that dubiousness by making our own non-temporal stores be truly just a hint, which is possible on some targets (e.g. ARM). On all other targets, non-temporal stores become regular stores. ~~Blocked on https://github.com/rust-lang/stdarch/pull/1541 propagating to the rustc repo, to make sure the `_mm_stream` intrinsics are unaffected by this change.~~ Fixes https://github.com/rust-lang/rust/issues/114582 Cc `@Amanieu` `@workingjubilee`
2024-08-12Auto merge of #128371 - andjo403:rangeAttribute, r=nikicbors-10/+77
Add range attribute to scalar function results and arguments as LLVM 19 adds the range attribute this starts to use it for better optimization. hade been interesting to see a perf run with the https://github.com/rust-lang/rust/pull/127513 closes https://github.com/rust-lang/rust/issues/50156 cc https://github.com/rust-lang/rust/issues/49572 shall be fixed but not possible to see as there is asserts that already trigger the optimization.
2024-08-12make the codegen test also cover an ill-behaved arch, and add linksRalf Jung-3/+12
2024-08-12Auto merge of #128862 - cblh:fix/128855, r=scottmcmbors-0/+13
fix: #128855 Ensure `Guard`'s `drop` method is removed at `opt-level=s` for `… fix: #128855 …Copy` types Added `#[inline]` to the `drop` method in the `Guard` implementation to ensure that the method is removed by the compiler at optimization level `opt-level=s` for `Copy` types. This change aims to align the method's behavior with optimization expectations and ensure it does not affect performance. r​? `@scottmcm`
2024-08-11Add range attribute to scalar function results and argumentsAndreas Jonson-10/+77
2024-08-10test(std): Add codegen test for array::from_fn optimizationburlinchen-0/+13
This commit adds a new test file 'array-from_fn.rs' to the codegen test suite. The test checks the behavior of std::array::from_fn under different optimization levels: 1. At opt-level=0 (debug build), it verifies that the core::array::Guard is present in the generated code. 2. At opt-level=s (size optimization), it ensures that the Guard is optimized out. This test helps ensure that the compiler correctly optimizes array::from_fn calls in release builds while maintaining safety checks in debug builds.
2024-08-10Auto merge of #128584 - DianQK:tests-for-llvm-19, r=nikicbors-0/+67
Add a set of tests for LLVM 19 Close #107681. Close #118306. Close #126585. r? compiler
2024-08-09unconditionally allow shadow call-stack for AArch64 whenever fixed-x18 is ↵Ding Xiang Fei-0/+19
applied
2024-08-08const vector passed to codegenJames Barford-Evans-0/+107
2024-08-08Add a set of tests for LLVM 19DianQK-0/+67
2024-08-07Auto merge of #128796 - matthiaskrgr:rollup-r7l68ph, r=matthiaskrgrbors-6/+6
Rollup of 8 pull requests Successful merges: - #128221 (Add implied target features to target_feature attribute) - #128261 (impl `Default` for collection iterators that don't already have it) - #128353 (Change generate-copyright to generate HTML, with cargo dependencies included) - #128679 (codegen: better centralize function declaration attribute computation) - #128732 (make `import.vis` is immutable) - #128755 (Integrate crlf directly into related test file instead via of .gitattributes) - #128772 (rustc_codegen_ssa: Set architecture for object crate for 32-bit SPARC) - #128782 (unused_parens: do not lint against parens around &raw) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-07Disallow setting built-in cfgs via set the command-lineUrgau-43/+43
2024-08-07Add implied features to non-target-feature functionsCaleb Zulawski-4/+4
2024-08-07Don't use LLVM to compute -Ctarget-featureCaleb Zulawski-1/+1
2024-08-07Fix codegen testsCaleb Zulawski-5/+5
2024-08-06alloc: add ToString specialization for `&&str`Michael Howell-0/+36
Fixes #128690
2024-08-05nontemporal_store: make sure that the intrinsic is truly just a hintRalf Jung-2/+17
2024-08-05Rollup merge of #128500 - clubby789:122600-test, r=Mark-SimulacrumMatthias Krüger-0/+19
Add test for updating enum discriminant through pointer Closes #122600
2024-08-04Auto merge of #128466 - sayantn:stdarch-update, r=tgross35bors-21/+0
Update the stdarch submodule cc `@tgross35` `@Amanieu` r? `@tgross35` try-job: dist-various-2
2024-08-04Chore: add `x86_amx_intrinsics` feature flag to `core/lib.rs` and remove ↵sayantn-21/+0
`issue-120720-reduce-nan.rs`
2024-08-03Add test for updating enum discriminant through pointerclubby789-0/+19
2024-08-01Implement `UncheckedIterator` directly for `RepeatN`Scott McMurray-1/+14
2024-07-30Auto merge of #128378 - matthiaskrgr:rollup-i3qz9uo, r=matthiaskrgrbors-0/+55
Rollup of 4 pull requests Successful merges: - #127574 (elaborate unknowable goals) - #128141 (Set branch protection function attributes) - #128315 (Fix vita build of std and forbid unsafe in unsafe in the os/vita module) - #128339 ([rustdoc] Make the buttons remain when code example is clicked) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-30Auto merge of #128250 - Amanieu:select_unpredictable, r=nikicbors-0/+35
Add `select_unpredictable` to force LLVM to use CMOV Since https://reviews.llvm.org/D118118, LLVM will no longer turn CMOVs into branches if it comes from a `select` marked with an `unpredictable` metadata attribute. This PR introduces `core::intrinsics::select_unpredictable` which emits such a `select` and uses it in the implementation of `binary_search_by`.
2024-07-30Rollup merge of #128141 - nikic:aarch64-bti, r=DianQK,cuviperMatthias Krüger-0/+55
Set branch protection function attributes Since LLVM 19, it is necessary to set not only module flags, but also function attributes for branch protection on aarch64. See https://github.com/llvm/llvm-project/commit/e15d67cfc2e5775cc79281aa860f3ad3be628f39 for the relevant LLVM change. Fixes https://github.com/rust-lang/rust/issues/127829.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28Force LLVM to use CMOV for binary searchAmanieu d'Antras-0/+35
Since https://reviews.llvm.org/D118118, LLVM will no longer turn CMOVs into branches if it comes from a `select` marked with an `unpredictable` metadata attribute. This PR introduces `core::intrinsics::select_unpredictable` which emits such a `select` and uses it in the implementation of `binary_search_by`.
2024-07-27Rollup merge of #128262 - DianQK:remove-unused-tests, r=saethlinTrevor Gross-34/+0
Delete `SimplifyArmIdentity` and `SimplifyBranchSame` tests These two passes have already been deleted in #107256. I'm not sure why tidy didn't catch it. As regression tests, I didn't delete `tests/ui/mir/issue-66851.rs` and `tests/ui/mir/simplify-branch-same.rs`. r? compiler
2024-07-27Auto merge of #124905 - reitermarkus:u32-from-char-opt, r=scottmcmbors-0/+35
Allow optimizing `u32::from::<char>`. Extracted from https://github.com/rust-lang/rust/pull/124307. This allows optimizing the panicking branch in the `escape_unicode` function, see https://rust.godbolt.org/z/61YhKrhvP.
2024-07-27Delete `SimplifyArmIdentity` and `SimplifyBranchSame` testsDianQK-34/+0
2024-07-25Let InstCombine remove Clone shims inside Clone shimsBen Kimock-0/+20
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2024-07-24Set branch protection function attributesNikita Popov-0/+55
Since LLVM 19, it is necessary to set not only module flags, but also function attributes for branch protection on aarch64. See https://github.com/llvm/llvm-project/commit/e15d67cfc2e5775cc79281aa860f3ad3be628f39 for the relevant LLVM change.
2024-07-21Use `leading_zeros` instead of `ilog2` in tests.Markus Reiter-6/+6
2024-07-21Simplify test.Markus Reiter-6/+8
2024-07-21Add test for cast optimization.Markus Reiter-0/+33
2024-07-21Auto merge of #127715 - klensy:tests-w, r=Mark-Simulacrumbors-5/+0
reenable some windows tests Locally passing on `x86_64-pc-windows-msvc`, fingers crossed for `*-pc-windows-gnu`. try-job: x86_64-msvc try-job: x86_64-mingw
2024-07-15Use Option's discriminant as its size hintScott McMurray-1/+34
2024-07-14reenable some windows testsklensy-5/+0
2024-07-12Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubileebors-8/+34
Ensure floats are returned losslessly by the Rust ABI on 32-bit x86 Solves #115567 for the (default) `"Rust"` ABI. When compiling for 32-bit x86, this PR changes the `"Rust"` ABI to return floats indirectly instead of in x87 registers (with the exception of single `f32`s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the `"C"` ABI as that ABI requires x87 register usage and therefore will need a different solution.
2024-07-12Adjust tests for x86 "Rust" ABI changesbeetrees-8/+34
2024-07-02Use the aligned size for alloca at ret when the pass mode is cast.DianQK-11/+11
2024-07-02Use the aligned size for alloca at args when the pass mode is cast.DianQK-28/+11
The `load` and `store` instructions in LLVM access the aligned size.
2024-07-02Add the definition for `extern "C"` at `cast-target-abi.rs`.DianQK-24/+358
2024-06-25Updated code for changes to RFC, added additional error handling, addedFlorian Schmiderer-28/+169
tests
2024-06-25Support `#[patchable_function_entries]`Matthew Maurer-0/+20
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered) TODO before submission: * Needs an RFC * Improve error reporting for malformed attributes
2024-06-25Support for -Z patchable-function-entryMatthew Maurer-0/+8
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
2024-06-25Auto merge of #126852 - scottmcm:more-checked-math-tweaks, r=Amanieubors-0/+14
Also get `add nuw` from `uN::checked_add` When I was doing this for `checked_{sub,shl,shr}`, it was mentioned https://github.com/rust-lang/rust/pull/124114#issuecomment-2066173305 that it'd be worth trying for `checked_add` too. It makes a particularly-big difference for `x.checked_add(C)`, as doing this means that LLVM removes the intrinsic and does it as a normal `x <= MAX - C` instead. cc `@DianQK` who had commented about `checked_add` related to https://github.com/rust-lang/hashbrown/issues/509 before cc https://github.com/llvm/llvm-project/issues/80637 for how LLVM is unlikely to do this itself
2024-06-23Also get `add nuw` from `uN::checked_add`Scott McMurray-0/+14
2024-06-23test: ignore force-frame-pointers test on some targetsJubilee Young-0/+7
all of these currently force stronger frame pointers, and currently the CLI does not override the target