Commit graph

32 commits

Author SHA1 Message Date
Matthias Krüger
f417f55e62
Rollup merge of #150368 - minicore-ordering, r=workingjubilee
adding Ordering enum to minicore.rs, importing minicore in "tests/assembly-llvm/rust-abi-arg-attr.rs" test file

this adds the `Ordering` enum to `minicore.rs`.

consequently, this updates `tests/assembly-llvm/rust-abi-arg-attr.rs` to import `minicore` directly. previously, this test file contained traits like `Copy` `Clone` `PointeeSized`, which were giving a duplicate lang item error, so replace those by importing `minicore` completely.
2026-01-11 09:56:38 +01:00
paradoxicalguy
484ea769d3 adding minicore to test file to avoid duplicating lang error 2026-01-09 02:30:33 +00:00
kulst
630c7596e9 Ensure that static initializers are acyclic for NVPTX
NVPTX does not support cycles in static initializers. LLVM produces an error when attempting to codegen such constructs (like self referential structs).

To not produce LLVM UB we instead emit a post-monomorphization error on
Rust side before reaching codegen.

This is achieved by analysing a subgraph of the "mono item graph" that
only contains statics:
1. Calculate the strongly connected components (SCCs) of the graph
2. Check for cycles (more than one node in a SCC or exactly one node
   which references itself)
2026-01-06 17:00:21 +01:00
beetrees
f7b3c1d3c0
Rework c_variadic 2025-12-04 10:51:34 +01:00
Matthias Krüger
714f1cea15
Rollup merge of #147521 - sayantn:simd-const-intrinsics, r=madsmtm
Make SIMD intrinsics available in `const`-contexts

successor to rust-lang/rust#146568, this PR actually makes the SIMD intrinsics `const`, and modifies the tests to test the const-eval implementations

r? `@tgross35` ig (although feel free to reassign, this is not anything targeted really)
2025-11-19 09:48:07 +01:00
sayantn
82ff614b34
Enable const-testing for the ported SIMD intrinsics 2025-11-17 20:10:14 +05:30
Folkert de Vries
4fd0dc1050
move NonNull into minicore 2025-11-16 13:13:18 +01:00
Stuart Cook
c33d51b9d8
Rollup merge of #147355 - sayantn:masked-loads, r=RalfJung,bjorn3
Add alignment parameter to `simd_masked_{load,store}`

This PR adds an alignment parameter in `simd_masked_load` and `simd_masked_store`, in the form of a const-generic enum `core::intrinsics::simd::SimdAlign`. This represents the alignment of the `ptr` argument in these intrinsics as follows

 - `SimdAlign::Unaligned` - `ptr` is unaligned/1-byte aligned
 - `SimdAlign::Element` - `ptr` is aligned to the element type of the SIMD vector (default behavior in the old signature)
 - `SimdAlign::Vector` - `ptr` is aligned to the SIMD vector type

The main motive for this is stdarch - most vector loads are either fully aligned (to the vector size) or unaligned (byte-aligned), so the previous signature doesn't cut it.

Now, stdarch will mostly use `SimdAlign::Unaligned` and `SimdAlign::Vector`, whereas portable-simd will use `SimdAlign::Element`.

 - [x] `cg_llvm`
 - [x] `cg_clif`
 - [x] `miri`/`const_eval`

## Alternatives

Using a const-generic/"const" `u32` parameter as alignment (and we error during codegen if this argument is not a power of two). This, although more flexible than this, has a few drawbacks

 - If we use an const-generic argument, then portable-simd somehow needs to pass `align_of::<T>()` as the alignment, which isn't possible without GCE
 - "const" function parameters are just an ugly hack, and a pain to deal with in non-LLVM backends

We can remedy the problem with the const-generic `u32` parameter by adding a special rule for the element alignment case (e.g. `0` can mean "use the alignment of the element type), but I feel like this is not as expressive as the enum approach, although I am open to suggestions

cc `@workingjubilee` `@RalfJung` `@BoxyUwU`
2025-11-05 10:59:18 +11:00
Ralf Jung
8b96fbecb6 FCW for repr(C) enums whose discriminant values do not fit into a c_int 2025-11-04 11:44:55 +01:00
sayantn
75de619159
Add alignment parameter to simd_masked_{load,store} 2025-11-04 02:30:59 +05:30
Flakebi
485bdafdcf
Add test for addrspacecasting global vars
Global variables are casted to the default address space works,
as the amdgpu target is now merged, a test can be added.
2025-09-03 08:40:51 +02:00
winstonallo
04ff1444bb
Set NumRegisterParameters LLVM module flag to N when -Zregparm=N is
set

* Enforce the `-Zregparm=N` flag by setting the NumRegisterParameters
LLVM module flag * Add assembly tests verifying that the parameters are
passed in registers for reparm values 1, 2, and 3, for both LLVM
intrinsics and non-builtin functions * Add c_void type to minicore
2025-08-13 17:37:30 +02:00
Scott McMurray
08b816ff18 So many test updates x_x 2025-07-20 10:15:14 -07:00
Folkert de Vries
3689b80b75
make cfg_select a builtin macro 2025-07-13 14:34:40 +02:00
Folkert de Vries
8512e39769
minicore: use core's diagnostic::on_unimplemented messages 2025-07-03 10:22:40 +02:00
Jubilee Young
7632fab668 tests: Adopt ABI transmute tests from crashtests 2025-06-23 09:40:00 -07:00
David Wood
c162328d30
aux: add {Meta,Pointee}Sized bounds to minicore
With `MetaSized` bounds replacing `?Sized` and being added as a
supertrait, the same relaxations applied to the standard library must be
applied to minicore.
2025-06-16 23:04:33 +00:00
David Wood
c6d88a1892
aux: add {Meta,Pointee}Sized to minicore
Add `MetaSized` and `PointeeSized` to minicore so that fewer tests fail
from missing language items.
2025-06-16 15:00:22 +00:00
Folkert de Vries
df8a3d5f1d
stabilize naked_functions 2025-04-20 11:18:38 +02:00
David Wood
92eb4450fa
tests: use minicore more
minicore makes it much easier to add new language items to all of the
existing `no_core` tests.
2025-02-24 09:26:54 +00:00
Ralf Jung
4a4207a650 use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
Michael Goulet
516afd557c Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validity 2025-02-13 03:45:04 +00:00
Taiki Endo
bd7213ff89 tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore 2024-12-18 02:59:07 +09:00
Taiki Endo
86e0eabc8d tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore 2024-12-17 01:12:36 +09:00
Taiki Endo
2c8f6de1ba Support input/output in vector registers of s390x inline assembly 2024-11-22 04:18:14 +09:00
Taiki Endo
a7520adc29
Fix typo in tests/auxiliary/minicore.rs
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2024-11-03 17:32:33 +09:00
Jieyou Xu
89a107740c Add more core stubs to minicore
`f32`, `f64` and `asm!` macro.
2024-11-02 21:59:27 +08:00
许杰友 Jieyou Xu (Joe)
adb6d4752f tests: use minicore in tests/ui/abi/compatibility.rs as an example 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
82c2e42894 minicore: add minimal minicore test auxiliary
The initial `minicore` is intentionally super minimal and contains an
incomplete subset of `core` items, and explicitly not items from `alloc`
or `std`-only items.
2024-10-31 18:20:11 +08:00
Ben Kimock
b91c1aafec Clean up users of rust_dbg_call 2024-04-17 15:08:08 -04:00
Erik Desjardins
4498cd6a8d extend extern tests to include FiveU16s
As described in the code, this extends just beyond a 64bit reg, but
isn't a round number, so it triggers some edge cases in the cast ABI.
2024-03-17 00:07:42 -04:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00