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

Winch: packed integer basic arithmetic for x64 #10147

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

MarinPostma
Copy link
Contributor

@MarinPostma MarinPostma commented Jan 29, 2025

implements the following instructions for winch x64:

  • i8x16.add
  • i8x16.add_sat_u
  • i8x16.add_sat_s
  • i16x8.add
  • i16x8.add_sat_u
  • i16x8.add_sat_s
  • i32x4.add
  • i64x2.add
  • i8x16.sub
  • i8x16.sub_sat_u
  • i8x16.sub_sat_s
  • i16x8.sub
  • i16x8.sub_sat_u
  • i16x8.sub_sat_s
  • i32x4.sub
  • i64x2.sub
  • i16x8.mul
  • i32x4.mul
  • i64x2.mul

#8093

@MarinPostma MarinPostma requested review from a team as code owners January 29, 2025 13:03
@MarinPostma MarinPostma requested review from fitzgen and removed request for a team January 29, 2025 13:03

/// Perform a vector add between `lsh` and `rhs`, placing the result in `dst`, where each lane
/// is interpreted to be `size` long.
fn v128_add(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

naming-wise, I'm completely sure what to call those. Maybe vector_add is more appropriate?

Copy link
Member

Choose a reason for hiding this comment

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

I think the naming is fine here, as far as I can tell, we don't have any other vector naming convention.

@saulecabrera
Copy link
Member

I can take this review.

@saulecabrera saulecabrera requested review from saulecabrera and removed request for a team and fitzgen January 29, 2025 17:19
Comment on lines +1751 to +1755
let mul_avx512 = |this: &mut Self, op| {
this.ensure_has_avx512vl()?;
this.ensure_has_avx512dq()?;
this.asm.xmm_rm_rvex3(op, lhs, rhs, dst);
Ok(())
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should make this a hard requirement, given that our baseline is AVX.

Given that Intel suggests that there's no penalty on mixing AVX with AVX512 instructions , we could emit AVX512 if they are available, however in case they aren't we still need to emit a fallback to avoid bumping our baseline for this operation. For reference: https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/src/isa/x64/lower.isle#L1121


/// Perform a vector add between `lsh` and `rhs`, placing the result in `dst`, where each lane
/// is interpreted to be `size` long.
fn v128_add(
Copy link
Member

Choose a reason for hiding this comment

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

I think the naming is fine here, as far as I can tell, we don't have any other vector naming convention.

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