Skip to content

SIMD comparison operators are always signed. #21719

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

Closed
eddyb opened this issue Jan 28, 2015 · 0 comments · Fixed by #21720
Closed

SIMD comparison operators are always signed. #21719

eddyb opened this issue Jan 28, 2015 · 0 comments · Fixed by #21720
Assignees
Labels
A-codegen Area: Code generation

Comments

@eddyb
Copy link
Member

eddyb commented Jan 28, 2015

The compiler always emits signed SIMD comparison instructions, even for unsigned element types:

use std::simd::u32x4;
u32x4(1, 2, 3, 1 << 31) < u32x4(2, 3, 4, 0)
// => u32x4(4294967295, 4294967295, 4294967295, 4294967295)
// i.e. <true, true, true, true>. expected <true, true, true, false>
@eddyb eddyb added I-wrong A-codegen Area: Code generation labels Jan 28, 2015
@huonw huonw self-assigned this Jan 28, 2015
huonw added a commit to huonw/rust that referenced this issue Jan 28, 2015
Previously comparisons of SIMD types were always signed, even unsigned
comparisons, meaning 0xFFFF_FFFF_u32 < 0 inside a SIMD vector.

Fixes rust-lang#21719.
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 30, 2015
Previously comparisons of SIMD types were always signed, even unsigned
comparisons, meaning 0xFFFF_FFFF_u32 < 0 inside a SIMD vector.

Fixes rust-lang#21719.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants