Commit Graph

45644 Commits

Author SHA1 Message Date
Huon Wilson
bea3f096ee Add support for arbitrary metadata for numbers and widths.
This means that each platform has total control over the formatting info
it needs.
2015-08-29 15:36:16 -07:00
Huon Wilson
083f613044 Autogenerate most ARM platform intrinsics. 2015-08-29 15:36:16 -07:00
Huon Wilson
3ef610b627 Autogenerate most AArch64 platform intrinsics. 2015-08-29 15:36:16 -07:00
Huon Wilson
73811917f4 Add the platform intrinsic generator script.
This python script will consume an appropriately formatted JSON file and
output either a Rust file for use in librustc_platform_intrinsics, or an
extern block for importing the intrinsics in an external library.

The --help flag has details.
2015-08-29 15:36:16 -07:00
Huon Wilson
72382d247a Avoid eagerly stripping the common platform prefix.
This works better with the code generation approach.
2015-08-29 15:36:16 -07:00
Huon Wilson
ee2de27996 Add support for aggregates in platform intrinsics.
This adds support for flattened intrinsics, which are called in Rust
with tuples but in LLVM without them (e.g. `foo((a, b))` becomes `foo(a,
b)`). Unflattened ones could be supported, but are not yet.
2015-08-29 15:36:16 -07:00
Huon Wilson
b03ca7f805 Separate integers into signed and unsigned.
This is necessary to reflect the ARM APIs accurately, since some
functions explicitly take an unsigned parameter and a signed one, of the
same integer shape, so the no-duplicates check will fail unless we
distinguish.
2015-08-29 15:36:16 -07:00
Huon Wilson
f578735750 Tweak aarch64 SIMD intrinsics.
The definitions of the rsqrte and recpe had typos, and vqtbl1q is useful
for a benchmark (fannkuch-redux).
2015-08-19 14:21:21 -07:00
Huon Wilson
02e97342c1 Add AArch64 vrecpeq_... intrinsic (necessary for minimal API). 2015-08-17 14:48:44 -07:00
Huon Wilson
b067e4464b Clean up simd_cast translation. 2015-08-17 14:48:44 -07:00
Huon Wilson
502f9acbe9 Revamp SIMD intrinsic trans error handling.
Factor out common pieces, follow `expected ..., found ...` convention
everywhere.
2015-08-17 14:48:44 -07:00
Huon Wilson
891c91438d simd_shuffleNNN returns its type parameter directly.
I.e. the signature now must be

    fn simd_shuffleNNN<T, U>(x: T, y: T, idx: [u32; NNN]) -> U;

(modulo names.)
2015-08-17 14:48:44 -07:00
Huon Wilson
d792925b4d Shim some of the old std::simd functionality.
Overload the operators using the traits so that things mostly keep
working during the deprecation period.
2015-08-17 14:48:43 -07:00
Huon Wilson
62ba85b7aa Rebase cleanup: is_simd lost its parameter. 2015-08-17 14:41:40 -07:00
Huon Wilson
4b242497d3 Code style tweaks. 2015-08-17 14:41:40 -07:00
Huon Wilson
84de8caa87 Add tests for various intrinsic behaviours. 2015-08-17 14:41:40 -07:00
Huon Wilson
926b8351cf Tweak intrinsic error handling.
Better error messages, US spelling, more real checks.
2015-08-17 14:41:40 -07:00
Huon Wilson
3e500673cc Fix existing tests for new #[repr(simd)]. 2015-08-17 14:41:40 -07:00
Huon Wilson
8b68f58fef Allow generic repr(simd) types.
Absolute correctness is checked at monomorphisation time.
2015-08-17 14:41:40 -07:00
Huon Wilson
1f5739fb3c Switch shuffle intrinsics to arrays of indices.
Format:

    fn shuffle_simdNNN<T, U>(x: T, y: T, idx: [u32; NNN]) -> U;
2015-08-17 14:41:40 -07:00
Huon Wilson
2115468f33 Add most ARM intrinsics. 2015-08-17 14:41:40 -07:00
Huon Wilson
d598bddc98 Reorganise ARM intrinsic definitions. 2015-08-17 14:41:40 -07:00
Huon Wilson
2a408ef6ee Add most AVX2 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
29b79aabd8 Add most AVX intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
67d56db16f Rearrange x86 intrinsics to prepare for AVX. 2015-08-17 14:41:39 -07:00
Huon Wilson
627784b186 Add most SSE4.1 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
f6275b760c Add most SSSE3 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
9d78efbd60 Add most SSE3 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
907bbac40f Reorganise x86 intrinsic definitions.
- factor out redundant mm prefix
- group methods by instruction set
2015-08-17 14:41:39 -07:00
Huon Wilson
e61f5397db Add most SSE2 intrinsics. 2015-08-17 14:41:39 -07:00
Huon Wilson
9b26895346 Generalise SIMD casting to unequal bitwidths. 2015-08-17 14:41:39 -07:00
Huon Wilson
4fe138cac0 Add _mm_shuffle_epi8 intrinsic. 2015-08-17 14:41:39 -07:00
Huon Wilson
bef1828d42 Rename simd_basics feature gate to repr_simd. 2015-08-17 14:41:39 -07:00
Huon Wilson
48f3507763 Use error codes for platform-intrinsic typeck errors. 2015-08-17 14:41:39 -07:00
Huon Wilson
dbcd9f00d1 Create separate module for intrinsic typechecking. 2015-08-17 14:41:38 -07:00
Huon Wilson
717da9513f Create "platform-intrinsic" ABI for SIMD/platform intrinsics.
This is purposely separate to the "rust-intrinsic" ABI, because these
intrinsics are theoretically going to become stable, and should be fine
to be independent of the compiler/language internals since they're
intimately to the platform.
2015-08-17 14:41:38 -07:00
Huon Wilson
58891278a3 Type check platform-intrinsics in typeck. 2015-08-17 14:41:38 -07:00
Huon Wilson
cb1eb9d0c4 Remove automatic built-in SIMD operators.
These should now go via the intrinsics, and implement the standard traits.
2015-08-17 14:41:38 -07:00
Huon Wilson
8d8b489bc9 Add intrinsics for SIMD arithmetic. 2015-08-17 14:41:38 -07:00
Huon Wilson
ecb3df5a91 Add simd_cast intrinsic. 2015-08-17 14:41:38 -07:00
Huon Wilson
f1d3b0271e Add x86 & arm reciprocal approximation intrinsics. 2015-08-17 14:41:38 -07:00
Huon Wilson
78eead63fa Implement the simd_insert/simd_extract intrinsics. 2015-08-17 14:41:38 -07:00
Huon Wilson
9af385bddb Add rustc_platform_intrinsics & some arm/x86 intrs.
These are enough to implement a cross-platform SIMD single-precision
mandelbrot renderer.
2015-08-17 14:41:38 -07:00
Huon Wilson
1bfbde6778 Add comparison and shuffle SIMD intrinsics.
- simd_eq, simd_ne, simd_lt, simd_le, simd_gt, simd_ge
- simd_shuffleNNN
2015-08-17 14:41:37 -07:00
Huon Wilson
4f4425840d Add some SIMD target_feature cfg's when appropriate.
NB. this may not be 100% perfect.
2015-08-17 14:41:37 -07:00
Huon Wilson
e364f0eb5a feature gate cfg(target_feature).
This is theoretically a breaking change, but GitHub search turns up no
uses of it, and most non-built-in cfg's are passed via cargo features,
which look like `feature = "..."`, and hence can't overlap.
2015-08-17 14:41:37 -07:00
Huon Wilson
c66554cab3 switch core::simd to repr(simd) and deprecate it.
This functionality will be available out of tree in the `simd` crate on
crates.io.

[breaking-change]
2015-08-17 14:41:37 -07:00
Huon Wilson
c8b6d5b23c Implement repr(simd) as an alias for #[simd]. 2015-08-17 10:57:18 -07:00
bors
e822a18ae7 Auto merge of #27858 - rkruppe:rustdoc-codespans, r=alexcrichton
Fixes #24746
2015-08-16 17:17:43 +00:00
bors
2f60268f54 Auto merge of #27689 - dotdash:die_odr, r=michaelwoerister
When using a generic enum type that was defined in an external crate,
our debuginfo currently claims that the concrete type (e.g. Option<i32>)
was defined in the current crate, where it was first used.

This means that if there are multiple crates that all use, for example,
Option<i32> values, they'll have conflicting debuginfo, each crate
claiming to have defined that type. This doesn't cause problems in
regular builds, but with LTO enabled, LLVM complains because it tries to
merge the debuginfo for those types and sees the ODR violations.

Since I couldn't find a way to get the file info for the external crate
that actually defined the enum, I'm working around the issue by using
"<unknown>" as the file for enum types. We'll want to re-visit and fix
this later, but this at least this fixes the ICE. And with the file
being unknown instead of wrong, the debuginfo isn't really worse than
before either.

Fixes #26447
2015-08-16 14:50:52 +00:00