Skip to content
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

Allow SIMD types in generics. Closes #10604 #11717

Merged
merged 3 commits into from
Feb 4, 2014

Conversation

DiamondLovesYou
Copy link
Contributor

Note that it still doesn't allow generic types to be marked with #[simd].

@@ -424,19 +425,22 @@ fn generic_type_of(cx: &CrateContext, r: &Repr, name: Option<&str>, sizing: bool
let align = most_aligned.align;
let discr_ty = ll_inttype(cx, ity);
let discr_size = machine::llsize_of_alloc(cx, discr_ty) as u64;
let align_units = (size + align - 1) / align - 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if size == n * align? Doesn't this give n - 1? (Is this correct?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be (n * align - 1) / align. Either way, all that was changed was I moved that line from 435 to 428 and added the minus one from 439. That was so I could use it in the match arms.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is n - 1, which is right — this patch also changes align_units from being the size of the entire object to the size of the padding.

@alexcrichton
Copy link
Member

cc @jdm, I think you're quite familiar with the adt module

@alexcrichton
Copy link
Member

Ah, not @jdm, @jld, my bad :(

@huonw
Copy link
Member

huonw commented Jan 31, 2014

cc @sanxiyn too

@jld
Copy link
Contributor

jld commented Feb 4, 2014

Looks good to me.

// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be pub fn main to pass the check-fast target on windows.

@DiamondLovesYou
Copy link
Contributor Author

Updated the tests based on your comments, @alexcrichton; barring other issues, this PR should be good to go.

@alexcrichton
Copy link
Member

Ah, I forgot, but these need an xfail-fast directive at the top of the file in order to prevent running on the check-fast suite on windows/bsd.

@DiamondLovesYou
Copy link
Contributor Author

Ah kk, I was greatly confused.

@DiamondLovesYou
Copy link
Contributor Author

Both need xfail-fast?

@DiamondLovesYou
Copy link
Contributor Author

Updated both to include xfail-fast.

bors added a commit that referenced this pull request Feb 4, 2014
Note that it still doesn't allow generic types to be marked with #[simd].
@bors bors merged commit 7becc0f into rust-lang:master Feb 4, 2014
luqmana added a commit to luqmana/rust that referenced this pull request Nov 11, 2016
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.

5 participants