Skip to content

Autogenerate SIMD intrinsics for AArch64, ARM and x86 #28079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 31, 2015
Merged

Conversation

huonw
Copy link
Member

@huonw huonw commented Aug 29, 2015

This adds a new Python script (compatible with 2.7 and 3.x) that will consume some JSON files that define a platform's intrinsics. It can output a file that defines the intrinsics in the compiler, or an extern block that will import them.

The complexity of the generator is to be DRY: platforms (especially ARM and AArch64) have a lot of repetition with their intrinsics, for different versions with different types, so being able to write it once is nice.

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@huonw
Copy link
Member Author

huonw commented Aug 29, 2015

(I should do some more testing to make sure the definitions are correct before this lands, but if there are any mistakes, they'll probably just be local one-line changes to a JSON file.)

huonw added 9 commits August 29, 2015 15:36
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.
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.
This works better with the code generation approach.
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.
This means that each platform has total control over the formatting info
it needs.
huonw added 3 commits August 29, 2015 19:26
Some x86 C intrinsics are declared to take `int ...` (i.e. exposed in
Rust as `i32`), but LLVM implements them by taking `i8` instead.
@alexcrichton
Copy link
Member

Looks good to me, r=me once you're satisfied the JSON is right

@huonw
Copy link
Member Author

huonw commented Aug 31, 2015

@bors r=alexcrichton

@bors
Copy link
Collaborator

bors commented Aug 31, 2015

📌 Commit 29dcff3 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Aug 31, 2015

⌛ Testing commit 29dcff3 with merge aba9ae5...

@bors
Copy link
Collaborator

bors commented Aug 31, 2015

💔 Test failed - auto-linux-64-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Aug 31, 2015 at 12:31 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-linux-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/6221


Reply to this email directly or view it on GitHub
#28079 (comment).

@huonw
Copy link
Member Author

huonw commented Aug 31, 2015

@bors r=alexcrichton

@bors
Copy link
Collaborator

bors commented Aug 31, 2015

📌 Commit 14f9c97 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Aug 31, 2015

⌛ Testing commit 14f9c97 with merge 2d3e837...

bors added a commit that referenced this pull request Aug 31, 2015
This adds a new Python script (compatible with 2.7 and 3.x) that will consume some JSON files that define a platform's intrinsics. It can output a file that defines the intrinsics in the compiler, or an `extern` block that will import them.

The complexity of the generator is to be DRY: platforms (especially ARM and AArch64) have a lot of repetition with their intrinsics, for different versions with different types, so being able to write it once is nice.
@bors bors merged commit 14f9c97 into rust-lang:master Aug 31, 2015
@huonw huonw deleted the simd branch August 31, 2015 23:32
huonw added a commit to huonw/simd that referenced this pull request Sep 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants