Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions crates/core_arch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
rustc_attrs,
staged_api,
doc_cfg,
tbm_target_feature,
sse4a_target_feature,
riscv_target_feature,
arm_target_feature,
mips_target_feature,
Expand Down
13 changes: 10 additions & 3 deletions crates/core_arch/src/s390x/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ unsafe extern "unadjusted" {
#[link_name = "llvm.s390.vsumqf"] fn vsumqf(a: vector_unsigned_int, b: vector_unsigned_int) -> u128;
#[link_name = "llvm.s390.vsumqg"] fn vsumqg(a: vector_unsigned_long_long, b: vector_unsigned_long_long) -> u128;

#[link_name = "llvm.s390.vaccq"] fn vaccq(a: u128, b: u128) -> u128;
#[link_name = "llvm.s390.vacccq"] fn vacccq(a: u128, b: u128, c: u128) -> u128;

Comment on lines +117 to +119
Copy link
Contributor

Choose a reason for hiding this comment

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

a fix was merged for this s390x issue. Is that just not on the version of LLVM that rustc uses yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix is currently in LLVM 22 only. I wasn't planning to backport it, as it's just an optimization improvement.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, it kind of looks like a regression from our perspective given that it worked before, but I can see how from LLVM's perspective this is sort of OK.

#[link_name = "llvm.s390.vscbiq"] fn vscbiq(a: u128, b: u128) -> u128;
#[link_name = "llvm.s390.vsbiq"] fn vsbiq(a: u128, b: u128, c: u128) -> u128;
#[link_name = "llvm.s390.vsbcbiq"] fn vsbcbiq(a: u128, b: u128, c: u128) -> u128;
Expand Down Expand Up @@ -4694,7 +4697,9 @@ pub unsafe fn vec_addc_u128(
) -> vector_unsigned_char {
let a: u128 = transmute(a);
let b: u128 = transmute(b);
transmute(a.overflowing_add(b).1 as u128)
// FIXME(llvm) https://github.com/llvm/llvm-project/pull/153557
// transmute(a.overflowing_add(b).1 as u128)
transmute(vaccq(a, b))
}

/// Vector Add With Carry unsigned 128-bits
Expand Down Expand Up @@ -4729,8 +4734,10 @@ pub unsafe fn vec_addec_u128(
let a: u128 = transmute(a);
let b: u128 = transmute(b);
let c: u128 = transmute(c);
let (_d, carry) = a.carrying_add(b, c & 1 != 0);
transmute(carry as u128)
// FIXME(llvm) https://github.com/llvm/llvm-project/pull/153557
// let (_d, carry) = a.carrying_add(b, c & 1 != 0);
// transmute(carry as u128)
transmute(vacccq(a, b, c))
}

/// Vector Subtract with Carryout
Expand Down
12 changes: 8 additions & 4 deletions crates/core_arch/src/x86/avx512f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5823,7 +5823,7 @@ pub fn _mm512_maskz_roundscale_pd<const IMM8: i32>(k: __mmask8, a: __m512d) -> _
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
#[cfg_attr(test, assert_instr(vrndscalepd, IMM8 = 0))]
#[cfg_attr(test, assert_instr(vrndscalepd, IMM8 = 16))]
#[rustc_legacy_const_generics(1)]
pub fn _mm256_roundscale_pd<const IMM8: i32>(a: __m256d) -> __m256d {
unsafe {
Expand Down Expand Up @@ -5897,7 +5897,7 @@ pub fn _mm256_maskz_roundscale_pd<const IMM8: i32>(k: __mmask8, a: __m256d) -> _
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
#[cfg_attr(test, assert_instr(vrndscalepd, IMM8 = 0))]
#[cfg_attr(test, assert_instr(vrndscalepd, IMM8 = 16))]
#[rustc_legacy_const_generics(1)]
pub fn _mm_roundscale_pd<const IMM8: i32>(a: __m128d) -> __m128d {
unsafe {
Expand Down Expand Up @@ -49621,7 +49621,9 @@ mod tests {
assert_eq_m512i(r, e);
}

#[simd_test(enable = "avx512f")]
// FIXME(llvm): https://github.com/llvm/llvm-project/issues/154492
//#[simd_test(enable = "avx512f")]
#[simd_test(enable = "avx512f,avx512vl")]
unsafe fn test_mm512_mask_cvttps_epu32() {
let a = _mm512_setr_ps(
0., -1.5, 2., -3.5, 4., -5.5, 6., -7.5, 8., 9.5, 10., 11.5, 12., 13.5, 14., 15.5,
Expand All @@ -49634,7 +49636,9 @@ mod tests {
assert_eq_m512i(r, e);
}

#[simd_test(enable = "avx512f")]
// FIXME(llvm): https://github.com/llvm/llvm-project/issues/154492
//#[simd_test(enable = "avx512f")]
#[simd_test(enable = "avx512f,avx512vl")]
unsafe fn test_mm512_maskz_cvttps_epu32() {
let a = _mm512_setr_ps(
0., -1.5, 2., -3.5, 4., -5.5, 6., -7.5, 8., 9.5, 10., 11.5, 12., 13.5, 14., 15.5,
Expand Down
Loading
Loading