Skip to content

Commit 9b9335c

Browse files
committed
loongarch: Use intrinsics::simd for vfrintr{p,m,z}
1 parent 30595c7 commit 9b9335c

7 files changed

Lines changed: 36 additions & 108 deletions

File tree

crates/core_arch/src/loongarch64/lasx/generated.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,6 @@ unsafe extern "unadjusted" {
435435
fn __lasx_xvfrintrne_s(a: __v8f32) -> __v8f32;
436436
#[link_name = "llvm.loongarch.lasx.xvfrintrne.d"]
437437
fn __lasx_xvfrintrne_d(a: __v4f64) -> __v4f64;
438-
#[link_name = "llvm.loongarch.lasx.xvfrintrz.s"]
439-
fn __lasx_xvfrintrz_s(a: __v8f32) -> __v8f32;
440-
#[link_name = "llvm.loongarch.lasx.xvfrintrz.d"]
441-
fn __lasx_xvfrintrz_d(a: __v4f64) -> __v4f64;
442-
#[link_name = "llvm.loongarch.lasx.xvfrintrp.s"]
443-
fn __lasx_xvfrintrp_s(a: __v8f32) -> __v8f32;
444-
#[link_name = "llvm.loongarch.lasx.xvfrintrp.d"]
445-
fn __lasx_xvfrintrp_d(a: __v4f64) -> __v4f64;
446-
#[link_name = "llvm.loongarch.lasx.xvfrintrm.s"]
447-
fn __lasx_xvfrintrm_s(a: __v8f32) -> __v8f32;
448-
#[link_name = "llvm.loongarch.lasx.xvfrintrm.d"]
449-
fn __lasx_xvfrintrm_d(a: __v4f64) -> __v4f64;
450438
#[link_name = "llvm.loongarch.lasx.xvstelm.b"]
451439
fn __lasx_xvstelm_b(a: __v32i8, b: *mut i8, c: i32, d: u32);
452440
#[link_name = "llvm.loongarch.lasx.xvstelm.h"]
@@ -2563,48 +2551,6 @@ pub fn lasx_xvfrintrne_d(a: m256d) -> m256d {
25632551
unsafe { transmute(__lasx_xvfrintrne_d(transmute(a))) }
25642552
}
25652553

2566-
#[inline]
2567-
#[target_feature(enable = "lasx")]
2568-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2569-
pub fn lasx_xvfrintrz_s(a: m256) -> m256 {
2570-
unsafe { transmute(__lasx_xvfrintrz_s(transmute(a))) }
2571-
}
2572-
2573-
#[inline]
2574-
#[target_feature(enable = "lasx")]
2575-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2576-
pub fn lasx_xvfrintrz_d(a: m256d) -> m256d {
2577-
unsafe { transmute(__lasx_xvfrintrz_d(transmute(a))) }
2578-
}
2579-
2580-
#[inline]
2581-
#[target_feature(enable = "lasx")]
2582-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2583-
pub fn lasx_xvfrintrp_s(a: m256) -> m256 {
2584-
unsafe { transmute(__lasx_xvfrintrp_s(transmute(a))) }
2585-
}
2586-
2587-
#[inline]
2588-
#[target_feature(enable = "lasx")]
2589-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2590-
pub fn lasx_xvfrintrp_d(a: m256d) -> m256d {
2591-
unsafe { transmute(__lasx_xvfrintrp_d(transmute(a))) }
2592-
}
2593-
2594-
#[inline]
2595-
#[target_feature(enable = "lasx")]
2596-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2597-
pub fn lasx_xvfrintrm_s(a: m256) -> m256 {
2598-
unsafe { transmute(__lasx_xvfrintrm_s(transmute(a))) }
2599-
}
2600-
2601-
#[inline]
2602-
#[target_feature(enable = "lasx")]
2603-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2604-
pub fn lasx_xvfrintrm_d(a: m256d) -> m256d {
2605-
unsafe { transmute(__lasx_xvfrintrm_d(transmute(a))) }
2606-
}
2607-
26082554
#[inline]
26092555
#[target_feature(enable = "lasx")]
26102556
#[rustc_legacy_const_generics(2, 3)]

crates/core_arch/src/loongarch64/lasx/portable.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ impl_vv!("lasx", lasx_xvfrsqrt_s, ls::simd_frsqrt_s, m256, f32x8);
332332
impl_vv!("lasx", lasx_xvfrsqrt_d, ls::simd_frsqrt_d, m256d, f64x4);
333333
impl_vv!("lasx", lasx_xvfrecip_s, ls::simd_frecip_s, m256, f32x8);
334334
impl_vv!("lasx", lasx_xvfrecip_d, ls::simd_frecip_d, m256d, f64x4);
335+
impl_vv!("lasx", lasx_xvfrintrp_s, is::simd_ceil, m256, f32x8);
336+
impl_vv!("lasx", lasx_xvfrintrp_d, is::simd_ceil, m256d, f64x4);
337+
impl_vv!("lasx", lasx_xvfrintrm_s, is::simd_floor, m256, f32x8);
338+
impl_vv!("lasx", lasx_xvfrintrm_d, is::simd_floor, m256d, f64x4);
339+
impl_vv!("lasx", lasx_xvfrintrz_s, is::simd_trunc, m256, f32x8);
340+
impl_vv!("lasx", lasx_xvfrintrz_d, is::simd_trunc, m256d, f64x4);
335341
impl_vv!("lasx", lasx_xvreplve0_b, simd_replve0_b, m256i, i8x32);
336342
impl_vv!("lasx", lasx_xvreplve0_h, simd_replve0_h, m256i, i16x16);
337343
impl_vv!("lasx", lasx_xvreplve0_w, simd_replve0_w, m256i, i32x8);

crates/core_arch/src/loongarch64/lsx/generated.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,6 @@ unsafe extern "unadjusted" {
429429
fn __lsx_vfrintrne_s(a: __v4f32) -> __v4f32;
430430
#[link_name = "llvm.loongarch.lsx.vfrintrne.d"]
431431
fn __lsx_vfrintrne_d(a: __v2f64) -> __v2f64;
432-
#[link_name = "llvm.loongarch.lsx.vfrintrz.s"]
433-
fn __lsx_vfrintrz_s(a: __v4f32) -> __v4f32;
434-
#[link_name = "llvm.loongarch.lsx.vfrintrz.d"]
435-
fn __lsx_vfrintrz_d(a: __v2f64) -> __v2f64;
436-
#[link_name = "llvm.loongarch.lsx.vfrintrp.s"]
437-
fn __lsx_vfrintrp_s(a: __v4f32) -> __v4f32;
438-
#[link_name = "llvm.loongarch.lsx.vfrintrp.d"]
439-
fn __lsx_vfrintrp_d(a: __v2f64) -> __v2f64;
440-
#[link_name = "llvm.loongarch.lsx.vfrintrm.s"]
441-
fn __lsx_vfrintrm_s(a: __v4f32) -> __v4f32;
442-
#[link_name = "llvm.loongarch.lsx.vfrintrm.d"]
443-
fn __lsx_vfrintrm_d(a: __v2f64) -> __v2f64;
444432
#[link_name = "llvm.loongarch.lsx.vstelm.b"]
445433
fn __lsx_vstelm_b(a: __v16i8, b: *mut i8, c: i32, d: u32);
446434
#[link_name = "llvm.loongarch.lsx.vstelm.h"]
@@ -2458,48 +2446,6 @@ pub fn lsx_vfrintrne_d(a: m128d) -> m128d {
24582446
unsafe { transmute(__lsx_vfrintrne_d(transmute(a))) }
24592447
}
24602448

2461-
#[inline]
2462-
#[target_feature(enable = "lsx")]
2463-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2464-
pub fn lsx_vfrintrz_s(a: m128) -> m128 {
2465-
unsafe { transmute(__lsx_vfrintrz_s(transmute(a))) }
2466-
}
2467-
2468-
#[inline]
2469-
#[target_feature(enable = "lsx")]
2470-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2471-
pub fn lsx_vfrintrz_d(a: m128d) -> m128d {
2472-
unsafe { transmute(__lsx_vfrintrz_d(transmute(a))) }
2473-
}
2474-
2475-
#[inline]
2476-
#[target_feature(enable = "lsx")]
2477-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2478-
pub fn lsx_vfrintrp_s(a: m128) -> m128 {
2479-
unsafe { transmute(__lsx_vfrintrp_s(transmute(a))) }
2480-
}
2481-
2482-
#[inline]
2483-
#[target_feature(enable = "lsx")]
2484-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2485-
pub fn lsx_vfrintrp_d(a: m128d) -> m128d {
2486-
unsafe { transmute(__lsx_vfrintrp_d(transmute(a))) }
2487-
}
2488-
2489-
#[inline]
2490-
#[target_feature(enable = "lsx")]
2491-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2492-
pub fn lsx_vfrintrm_s(a: m128) -> m128 {
2493-
unsafe { transmute(__lsx_vfrintrm_s(transmute(a))) }
2494-
}
2495-
2496-
#[inline]
2497-
#[target_feature(enable = "lsx")]
2498-
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
2499-
pub fn lsx_vfrintrm_d(a: m128d) -> m128d {
2500-
unsafe { transmute(__lsx_vfrintrm_d(transmute(a))) }
2501-
}
2502-
25032449
#[inline]
25042450
#[target_feature(enable = "lsx")]
25052451
#[rustc_legacy_const_generics(2, 3)]

crates/core_arch/src/loongarch64/lsx/portable.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ impl_vv!("lsx", lsx_vfrsqrt_s, ls::simd_frsqrt_s, m128, f32x4);
231231
impl_vv!("lsx", lsx_vfrsqrt_d, ls::simd_frsqrt_d, m128d, f64x2);
232232
impl_vv!("lsx", lsx_vfrecip_s, ls::simd_frecip_s, m128, f32x4);
233233
impl_vv!("lsx", lsx_vfrecip_d, ls::simd_frecip_d, m128d, f64x2);
234+
impl_vv!("lsx", lsx_vfrintrp_s, is::simd_ceil, m128, f32x4);
235+
impl_vv!("lsx", lsx_vfrintrp_d, is::simd_ceil, m128d, f64x2);
236+
impl_vv!("lsx", lsx_vfrintrm_s, is::simd_floor, m128, f32x4);
237+
impl_vv!("lsx", lsx_vfrintrm_d, is::simd_floor, m128d, f64x2);
238+
impl_vv!("lsx", lsx_vfrintrz_s, is::simd_trunc, m128, f32x4);
239+
impl_vv!("lsx", lsx_vfrintrz_d, is::simd_trunc, m128d, f64x2);
234240

235241
impl_gv!("lsx", lsx_vreplgr2vr_b, ls::simd_splat, m128i, i8x16, i32);
236242
impl_gv!("lsx", lsx_vreplgr2vr_h, ls::simd_splat, m128i, i16x8, i32);

crates/stdarch-gen-loongarch/lasx.spec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,31 +2564,37 @@ asm-fmts = xd, xj
25642564
data-types = V4DF, V4DF
25652565

25662566
/// lasx_xvfrintrz_s
2567+
impl = portable
25672568
name = lasx_xvfrintrz_s
25682569
asm-fmts = xd, xj
25692570
data-types = V8SF, V8SF
25702571

25712572
/// lasx_xvfrintrz_d
2573+
impl = portable
25722574
name = lasx_xvfrintrz_d
25732575
asm-fmts = xd, xj
25742576
data-types = V4DF, V4DF
25752577

25762578
/// lasx_xvfrintrp_s
2579+
impl = portable
25772580
name = lasx_xvfrintrp_s
25782581
asm-fmts = xd, xj
25792582
data-types = V8SF, V8SF
25802583

25812584
/// lasx_xvfrintrp_d
2585+
impl = portable
25822586
name = lasx_xvfrintrp_d
25832587
asm-fmts = xd, xj
25842588
data-types = V4DF, V4DF
25852589

25862590
/// lasx_xvfrintrm_s
2591+
impl = portable
25872592
name = lasx_xvfrintrm_s
25882593
asm-fmts = xd, xj
25892594
data-types = V8SF, V8SF
25902595

25912596
/// lasx_xvfrintrm_d
2597+
impl = portable
25922598
name = lasx_xvfrintrm_d
25932599
asm-fmts = xd, xj
25942600
data-types = V4DF, V4DF

crates/stdarch-gen-loongarch/lsx.spec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,31 +2627,37 @@ asm-fmts = vd, vj
26272627
data-types = V2DF, V2DF
26282628

26292629
/// lsx_vfrintrz_s
2630+
impl = portable
26302631
name = lsx_vfrintrz_s
26312632
asm-fmts = vd, vj
26322633
data-types = V4SF, V4SF
26332634

26342635
/// lsx_vfrintrz_d
2636+
impl = portable
26352637
name = lsx_vfrintrz_d
26362638
asm-fmts = vd, vj
26372639
data-types = V2DF, V2DF
26382640

26392641
/// lsx_vfrintrp_s
2642+
impl = portable
26402643
name = lsx_vfrintrp_s
26412644
asm-fmts = vd, vj
26422645
data-types = V4SF, V4SF
26432646

26442647
/// lsx_vfrintrp_d
2648+
impl = portable
26452649
name = lsx_vfrintrp_d
26462650
asm-fmts = vd, vj
26472651
data-types = V2DF, V2DF
26482652

26492653
/// lsx_vfrintrm_s
2654+
impl = portable
26502655
name = lsx_vfrintrm_s
26512656
asm-fmts = vd, vj
26522657
data-types = V4SF, V4SF
26532658

26542659
/// lsx_vfrintrm_d
2660+
impl = portable
26552661
name = lsx_vfrintrm_d
26562662
asm-fmts = vd, vj
26572663
data-types = V2DF, V2DF

crates/stdarch-gen-loongarch/src/portable-intrinsics.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ lsx_vfrecip_s
279279
lsx_vfrecip_d
280280
lsx_vfrsqrt_s
281281
lsx_vfrsqrt_d
282+
lsx_vfrintrp_s
283+
lsx_vfrintrp_d
284+
lsx_vfrintrm_s
285+
lsx_vfrintrm_d
286+
lsx_vfrintrz_s
287+
lsx_vfrintrz_d
282288

283289
# LASX intrinsics
284290
lasx_xvsll_b
@@ -559,3 +565,9 @@ lasx_xvfrecip_s
559565
lasx_xvfrecip_d
560566
lasx_xvfrsqrt_s
561567
lasx_xvfrsqrt_d
568+
lasx_xvfrintrp_s
569+
lasx_xvfrintrp_d
570+
lasx_xvfrintrm_s
571+
lasx_xvfrintrm_d
572+
lasx_xvfrintrz_s
573+
lasx_xvfrintrz_d

0 commit comments

Comments
 (0)