1
Fork 0
This commit is contained in:
bjorn3 2025-02-01 16:43:56 +00:00
parent 42271d452c
commit c8f0f36d66
8 changed files with 61 additions and 36 deletions

View file

@ -241,9 +241,10 @@ unsafe fn test_simd() {
let (zero0, zero1) = std::mem::transmute::<_, (u64, u64)>(x);
assert_eq!((zero0, zero1), (0, 0));
assert_eq!(std::mem::transmute::<_, [u16; 8]>(or), [7, 7, 7, 7, 7, 7, 7, 7]);
assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_eq), [
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
]);
assert_eq!(
std::mem::transmute::<_, [u16; 8]>(cmp_eq),
[0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff]
);
assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_lt), [0, 0, 0, 0, 0, 0, 0, 0]);
test_mm_slli_si128();

View file

@ -96,9 +96,12 @@ pub(crate) fn clif_int_or_float_cast(
},
);
fx.lib_call(&name, vec![AbiParam::new(from_ty)], vec![AbiParam::new(types::I128)], &[
from,
])[0]
fx.lib_call(
&name,
vec![AbiParam::new(from_ty)],
vec![AbiParam::new(types::I128)],
&[from],
)[0]
} else if to_ty == types::I8 || to_ty == types::I16 {
// FIXME implement fcvt_to_*int_sat.i8/i16
let val = if to_signed {

View file

@ -73,16 +73,19 @@ impl WriteDebugInfo for ObjectProduct {
}
};
self.object
.add_relocation(from.0, Relocation {
offset: u64::from(reloc.offset),
symbol,
flags: RelocationFlags::Generic {
kind: reloc.kind,
encoding: RelocationEncoding::Generic,
size: reloc.size * 8,
.add_relocation(
from.0,
Relocation {
offset: u64::from(reloc.offset),
symbol,
flags: RelocationFlags::Generic {
kind: reloc.kind,
encoding: RelocationEncoding::Generic,
size: reloc.size * 8,
},
addend: i64::try_from(symbol_offset).unwrap() + reloc.addend,
},
addend: i64::try_from(symbol_offset).unwrap() + reloc.addend,
})
)
.unwrap();
}
}

View file

@ -342,11 +342,15 @@ fn codegen_shim<'tcx>(
let instance_ptr = Box::into_raw(Box::new(inst));
let jit_fn = module
.declare_function("__clif_jit_fn", Linkage::Import, &Signature {
call_conv: module.target_config().default_call_conv,
params: vec![AbiParam::new(pointer_type), AbiParam::new(pointer_type)],
returns: vec![AbiParam::new(pointer_type)],
})
.declare_function(
"__clif_jit_fn",
Linkage::Import,
&Signature {
call_conv: module.target_config().default_call_conv,
params: vec![AbiParam::new(pointer_type), AbiParam::new(pointer_type)],
returns: vec![AbiParam::new(pointer_type)],
},
)
.unwrap();
let context = cached_context;

View file

@ -875,11 +875,15 @@ fn call_inline_asm<'tcx>(
let inline_asm_func = fx
.module
.declare_function(asm_name, Linkage::Import, &Signature {
call_conv: CallConv::SystemV,
params: vec![AbiParam::new(fx.pointer_type)],
returns: vec![],
})
.declare_function(
asm_name,
Linkage::Import,
&Signature {
call_conv: CallConv::SystemV,
params: vec![AbiParam::new(fx.pointer_type)],
returns: vec![],
},
)
.unwrap();
let inline_asm_func = fx.module.declare_func_in_func(inline_asm_func, fx.bcx.func);
if fx.clif_comments.enabled() {

View file

@ -558,9 +558,12 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
(sym::simd_round, types::F64) => "round",
_ => unreachable!("{:?}", intrinsic),
};
fx.lib_call(name, vec![AbiParam::new(lane_ty)], vec![AbiParam::new(lane_ty)], &[
lane,
])[0]
fx.lib_call(
name,
vec![AbiParam::new(lane_ty)],
vec![AbiParam::new(lane_ty)],
&[lane],
)[0]
});
}

View file

@ -15,9 +15,12 @@ pub(crate) fn maybe_create_entry_wrapper(
is_primary_cgu: bool,
) {
let (main_def_id, sigpipe) = match tcx.entry_fn(()) {
Some((def_id, entry_ty)) => (def_id, match entry_ty {
EntryFnType::Main { sigpipe } => sigpipe,
}),
Some((def_id, entry_ty)) => (
def_id,
match entry_ty {
EntryFnType::Main { sigpipe } => sigpipe,
},
),
None => return,
};

View file

@ -5,11 +5,15 @@ use crate::prelude::*;
fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) {
let puts = fx
.module
.declare_function("puts", Linkage::Import, &Signature {
call_conv: fx.target_config.default_call_conv,
params: vec![AbiParam::new(fx.pointer_type)],
returns: vec![AbiParam::new(types::I32)],
})
.declare_function(
"puts",
Linkage::Import,
&Signature {
call_conv: fx.target_config.default_call_conv,
params: vec![AbiParam::new(fx.pointer_type)],
returns: vec![AbiParam::new(types::I32)],
},
)
.unwrap();
let puts = fx.module.declare_func_in_func(puts, &mut fx.bcx.func);
if fx.clif_comments.enabled() {