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

Fix the '-0.0' issue of blendv_ps and blendv_pd. #7

Merged
merged 1 commit into from
Jul 23, 2020

Conversation

lowintelligence
Copy link
Contributor

For '_mm256_blendv_ps' and '_mm256_blendv_pd', the selector is
controlled by the highest flag of each unit, while the mask is
presented as a float or double SIMD register. For the case of
'-0.0', which is intepreted as 0x8000..00 in register, digits
in the 'b' input should be selected.
Previous implementation used 'vcgeq_f32' and 'vcgeq_f64' to get
flags of selector. These intrinsics won't think '-0.0 < 0.0',
thus digits in 'a' should be selected and an incorrect result
would be returned.
This fix convert the comparing from float intrinsics to integer
ones and preserve the correction of '-0.0' case.

For '_mm256_blendv_ps' and '_mm256_blendv_pd', the selector is
controlled by the highest flag of each unit, while the mask is
presented as a float or double SIMD register. For the case of
'-0.0', which is intepreted as 0x8000..00 in register, digits
in the 'b' input should be selected.
Previous implementation used 'vcgeq_f32' and 'vcgeq_f64' to get
flags of selector. These intrinsics won't think '-0.0 < 0.0',
thus digits in 'a' should be selected and an incorrect result
would be returned.
This fix convert the comparing from float intrinsics to integer
ones and preserve the correction of '-0.0' case.
@derekpush derekpush requested a review from gd321 April 21, 2020 08:36
Copy link
Collaborator

@gd321 gd321 left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@gd321 gd321 left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@gd321 gd321 left a comment

Choose a reason for hiding this comment

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

looks great

@gd321 gd321 merged commit 9f651e7 into kunpengcompute:master Jul 23, 2020
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.

2 participants