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

AVX2 SAD has wrong return type #18

Closed
the8472 opened this issue Jul 23, 2017 · 2 comments
Closed

AVX2 SAD has wrong return type #18

the8472 opened this issue Jul 23, 2017 · 2 comments

Comments

@the8472
Copy link
Contributor

the8472 commented Jul 23, 2017

https://github.com/rust-lang-nursery/simd/blob/539247c63cd59dc3aac973c02a86845674ee3b6a/src/x86/avx2.rs#L45

fn x86_mm256_sad_epu8(x: u8x32, y: u8x32) -> u8x32
should be
fn x86_mm256_sad_epu8(x: u8x32, y: u8x32) -> u64x4

The intel intrinsics docs state that the result is packed into 4x 64bit values.

I tried fixing it myself but the compiler then complains

error[E0442]: intrinsic return value has wrong type: found vector with length 4, expected length 32
  --> src/x86/avx2.rs:45:5
   |
45 |     fn x86_mm256_sad_epu8(x: u8x32, y: u8x32) -> u64x4;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@BurntSushi
Copy link
Contributor

The intrinsic definition in LLVM is:

  def int_x86_avx2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw256">,
              Intrinsic<[llvm_v4i64_ty], [llvm_v32i8_ty,
                         llvm_v32i8_ty], [IntrNoMem, Commutative]>;

Which appears consistent with the Intel intrinsic docs. The next place I'd look is in rustc to see if there's a bug in the corresponding platform-intrinsic. Indeed, the definition appears incorrect, so I think this needs to be filed against rust-lang/rust.

@the8472
Copy link
Contributor Author

the8472 commented Jul 23, 2017

Filed rust-lang/rust#43439

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

No branches or pull requests

2 participants