Some fixes for aarch64
This commit is contained in:
parent
41839175b0
commit
65e8717e45
@ -128,6 +128,12 @@ pub fn from_fn_attrs<'gcc, 'tcx>(
|
|||||||
.join(",");
|
.join(",");
|
||||||
if !target_features.is_empty() {
|
if !target_features.is_empty() {
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
func.add_attribute(FnAttribute::Target(&target_features));
|
match cx.sess().target.arch.as_ref() {
|
||||||
|
"x86" | "x86_64" | "powerpc" => {
|
||||||
|
func.add_attribute(FnAttribute::Target(&target_features))
|
||||||
|
}
|
||||||
|
// The target attribute is not supported on other targets in GCC.
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1129,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||||||
// the following cast is required to avoid this error:
|
// the following cast is required to avoid this error:
|
||||||
// gcc_jit_context_new_call: mismatching types for argument 2 of function "__atomic_store_4": assignment to param arg1 (type: int) from loadedValue3577 (type: unsigned int __attribute__((aligned(4))))
|
// gcc_jit_context_new_call: mismatching types for argument 2 of function "__atomic_store_4": assignment to param arg1 (type: int) from loadedValue3577 (type: unsigned int __attribute__((aligned(4))))
|
||||||
let int_type = atomic_store.get_param(1).to_rvalue().get_type();
|
let int_type = atomic_store.get_param(1).to_rvalue().get_type();
|
||||||
let value = self.context.new_cast(self.location, value, int_type);
|
let value = self.context.new_bitcast(self.location, value, int_type);
|
||||||
self.llbb().add_eval(
|
self.llbb().add_eval(
|
||||||
self.location,
|
self.location,
|
||||||
self.context.new_call(self.location, atomic_store, &[ptr, value, ordering]),
|
self.context.new_call(self.location, atomic_store, &[ptr, value, ordering]),
|
||||||
|
@ -629,14 +629,22 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
|
|||||||
|
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
|
pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
|
||||||
if name == "llvm.prefetch" {
|
let gcc_name = match name {
|
||||||
|
"llvm.prefetch" => {
|
||||||
let gcc_name = "__builtin_prefetch";
|
let gcc_name = "__builtin_prefetch";
|
||||||
let func = cx.context.get_builtin_function(gcc_name);
|
let func = cx.context.get_builtin_function(gcc_name);
|
||||||
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
|
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
let gcc_name = match name {
|
"llvm.aarch64.isb" => {
|
||||||
|
// FIXME: GCC doesn't support __builtin_arm_isb yet, check if this builtin is OK.
|
||||||
|
let gcc_name = "__atomic_thread_fence";
|
||||||
|
let func = cx.context.get_builtin_function(gcc_name);
|
||||||
|
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
|
||||||
|
return func;
|
||||||
|
}
|
||||||
|
|
||||||
"llvm.x86.xgetbv" => "__builtin_ia32_xgetbv",
|
"llvm.x86.xgetbv" => "__builtin_ia32_xgetbv",
|
||||||
// NOTE: this doc specifies the equivalent GCC builtins: http://huonw.github.io/llvmint/llvmint/x86/index.html
|
// NOTE: this doc specifies the equivalent GCC builtins: http://huonw.github.io/llvmint/llvmint/x86/index.html
|
||||||
"llvm.sqrt.v2f64" => "__builtin_ia32_sqrtpd",
|
"llvm.sqrt.v2f64" => "__builtin_ia32_sqrtpd",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user