mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
loongarch: Remove unnecessary transmute calls
This commit removes unnecessary `transmute` calls to resolve clippy warnings.
This commit is contained in:
@@ -5044,7 +5044,7 @@ pub unsafe fn lasx_xvld<const IMM_S12: i32>(mem_addr: *const i8) -> m256i {
|
||||
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
|
||||
pub unsafe fn lasx_xvst<const IMM_S12: i32>(a: m256i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S12, 12);
|
||||
transmute(__lasx_xvst(transmute(a), mem_addr, IMM_S12))
|
||||
__lasx_xvst(transmute(a), mem_addr, IMM_S12)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5054,7 +5054,7 @@ pub unsafe fn lasx_xvst<const IMM_S12: i32>(a: m256i, mem_addr: *mut i8) {
|
||||
pub unsafe fn lasx_xvstelm_b<const IMM_S8: i32, const IMM4: u32>(a: m256i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM4, 4);
|
||||
transmute(__lasx_xvstelm_b(transmute(a), mem_addr, IMM_S8, IMM4))
|
||||
__lasx_xvstelm_b(transmute(a), mem_addr, IMM_S8, IMM4)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5064,7 +5064,7 @@ pub unsafe fn lasx_xvstelm_b<const IMM_S8: i32, const IMM4: u32>(a: m256i, mem_a
|
||||
pub unsafe fn lasx_xvstelm_h<const IMM_S8: i32, const IMM3: u32>(a: m256i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM3, 3);
|
||||
transmute(__lasx_xvstelm_h(transmute(a), mem_addr, IMM_S8, IMM3))
|
||||
__lasx_xvstelm_h(transmute(a), mem_addr, IMM_S8, IMM3)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5074,7 +5074,7 @@ pub unsafe fn lasx_xvstelm_h<const IMM_S8: i32, const IMM3: u32>(a: m256i, mem_a
|
||||
pub unsafe fn lasx_xvstelm_w<const IMM_S8: i32, const IMM2: u32>(a: m256i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM2, 2);
|
||||
transmute(__lasx_xvstelm_w(transmute(a), mem_addr, IMM_S8, IMM2))
|
||||
__lasx_xvstelm_w(transmute(a), mem_addr, IMM_S8, IMM2)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5084,7 +5084,7 @@ pub unsafe fn lasx_xvstelm_w<const IMM_S8: i32, const IMM2: u32>(a: m256i, mem_a
|
||||
pub unsafe fn lasx_xvstelm_d<const IMM_S8: i32, const IMM1: u32>(a: m256i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM1, 1);
|
||||
transmute(__lasx_xvstelm_d(transmute(a), mem_addr, IMM_S8, IMM1))
|
||||
__lasx_xvstelm_d(transmute(a), mem_addr, IMM_S8, IMM1)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5192,7 +5192,7 @@ pub unsafe fn lasx_xvldx(mem_addr: *const i8, b: i64) -> m256i {
|
||||
#[target_feature(enable = "lasx")]
|
||||
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
|
||||
pub unsafe fn lasx_xvstx(a: m256i, mem_addr: *mut i8, b: i64) {
|
||||
transmute(__lasx_xvstx(transmute(a), mem_addr, transmute(b)))
|
||||
__lasx_xvstx(transmute(a), mem_addr, transmute(b))
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
||||
@@ -5052,7 +5052,7 @@ pub fn lsx_vfrintrm_d(a: m128d) -> m128d {
|
||||
pub unsafe fn lsx_vstelm_b<const IMM_S8: i32, const IMM4: u32>(a: m128i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM4, 4);
|
||||
transmute(__lsx_vstelm_b(transmute(a), mem_addr, IMM_S8, IMM4))
|
||||
__lsx_vstelm_b(transmute(a), mem_addr, IMM_S8, IMM4)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5062,7 +5062,7 @@ pub unsafe fn lsx_vstelm_b<const IMM_S8: i32, const IMM4: u32>(a: m128i, mem_add
|
||||
pub unsafe fn lsx_vstelm_h<const IMM_S8: i32, const IMM3: u32>(a: m128i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM3, 3);
|
||||
transmute(__lsx_vstelm_h(transmute(a), mem_addr, IMM_S8, IMM3))
|
||||
__lsx_vstelm_h(transmute(a), mem_addr, IMM_S8, IMM3)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5072,7 +5072,7 @@ pub unsafe fn lsx_vstelm_h<const IMM_S8: i32, const IMM3: u32>(a: m128i, mem_add
|
||||
pub unsafe fn lsx_vstelm_w<const IMM_S8: i32, const IMM2: u32>(a: m128i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM2, 2);
|
||||
transmute(__lsx_vstelm_w(transmute(a), mem_addr, IMM_S8, IMM2))
|
||||
__lsx_vstelm_w(transmute(a), mem_addr, IMM_S8, IMM2)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -5082,7 +5082,7 @@ pub unsafe fn lsx_vstelm_w<const IMM_S8: i32, const IMM2: u32>(a: m128i, mem_add
|
||||
pub unsafe fn lsx_vstelm_d<const IMM_S8: i32, const IMM1: u32>(a: m128i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S8, 8);
|
||||
static_assert_uimm_bits!(IMM1, 1);
|
||||
transmute(__lsx_vstelm_d(transmute(a), mem_addr, IMM_S8, IMM1))
|
||||
__lsx_vstelm_d(transmute(a), mem_addr, IMM_S8, IMM1)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -6376,7 +6376,7 @@ pub unsafe fn lsx_vld<const IMM_S12: i32>(mem_addr: *const i8) -> m128i {
|
||||
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
|
||||
pub unsafe fn lsx_vst<const IMM_S12: i32>(a: m128i, mem_addr: *mut i8) {
|
||||
static_assert_simm_bits!(IMM_S12, 12);
|
||||
transmute(__lsx_vst(transmute(a), mem_addr, IMM_S12))
|
||||
__lsx_vst(transmute(a), mem_addr, IMM_S12)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -6455,7 +6455,7 @@ pub unsafe fn lsx_vldx(mem_addr: *const i8, b: i64) -> m128i {
|
||||
#[target_feature(enable = "lsx")]
|
||||
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
|
||||
pub unsafe fn lsx_vstx(a: m128i, mem_addr: *mut i8, b: i64) {
|
||||
transmute(__lsx_vstx(transmute(a), mem_addr, transmute(b)))
|
||||
__lsx_vstx(transmute(a), mem_addr, transmute(b))
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
||||
@@ -571,21 +571,21 @@ enum TypeKind {
|
||||
} else if para_num == 3 && in_t[1] == "CVPOINTER" && in_t[2] == "SI" {
|
||||
call_params = match asm_fmts[2].as_str() {
|
||||
"si12" => format!(
|
||||
"static_assert_simm_bits!(IMM_S12, 12);\n {unsafe_start}transmute(__{current_name}(transmute(a), mem_addr, IMM_S12)){unsafe_end}"
|
||||
"static_assert_simm_bits!(IMM_S12, 12);\n {unsafe_start}__{current_name}(transmute(a), mem_addr, IMM_S12){unsafe_end}"
|
||||
),
|
||||
_ => panic!("unsupported assembly format: {}", asm_fmts[2]),
|
||||
};
|
||||
} else if para_num == 3 && in_t[1] == "CVPOINTER" && in_t[2] == "DI" {
|
||||
call_params = match asm_fmts[2].as_str() {
|
||||
"rk" => format!(
|
||||
"{unsafe_start}transmute(__{current_name}(transmute(a), mem_addr, transmute(b))){unsafe_end}"
|
||||
"{unsafe_start}__{current_name}(transmute(a), mem_addr, transmute(b)){unsafe_end}"
|
||||
),
|
||||
_ => panic!("unsupported assembly format: {}", asm_fmts[2]),
|
||||
};
|
||||
} else if para_num == 4 {
|
||||
call_params = match (asm_fmts[2].as_str(), current_name.chars().last().unwrap()) {
|
||||
("si8", t) => format!(
|
||||
"static_assert_simm_bits!(IMM_S8, 8);\n static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}transmute(__{current_name}(transmute(a), mem_addr, IMM_S8, IMM{0})){unsafe_end}",
|
||||
"static_assert_simm_bits!(IMM_S8, 8);\n static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(transmute(a), mem_addr, IMM_S8, IMM{0}){unsafe_end}",
|
||||
type_to_imm(t)
|
||||
),
|
||||
(_, _) => panic!(
|
||||
|
||||
Reference in New Issue
Block a user