Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

No i8x16.mul? #524

Closed
Cyborus04 opened this issue Oct 7, 2021 · 4 comments
Closed

No i8x16.mul? #524

Cyborus04 opened this issue Oct 7, 2021 · 4 comments

Comments

@Cyborus04
Copy link

Is there a reason why i8x16.mul is not included? I find it a bit odd, since i16x8.mul, i32x4.mul, and i64x2.mul exist. Is there something I'm missing?

@penzn
Copy link
Contributor

penzn commented Oct 7, 2021

This is instruction was dropped (#98), because result of i8 multiplication isn't likely to fit into an i8: #28 (comment)

Do you have code where you would need it?

@Cyborus04
Copy link
Author

I was making a toy SIMD library in Rust which only operates on 128 bits (like in WebAssembly), where each type for the lanes would implement a trait for their associated instructions. I hit the roadblock of mul as I didn't see a way to implement this trait for i8/u8 (except maybe extracting each lane and multiplying them manually, but that kinda defeats the point)

@ngzhian
Copy link
Member

ngzhian commented Oct 7, 2021

You can try using i16x8.extmul_low_i8x16 + i16x8.extmul_high_i8x16 + i8x16.narrow_i16x8_{s,u}, that's 3 instructions, which will be better than extracting individual lanes.

@Cyborus04
Copy link
Author

Oh, that works. Thank you!

@ngzhian ngzhian closed this as completed Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants