Skip to content

Commit 8364234

Browse files
authored
Merge pull request rust-lang#1566 from rust-lang/arm64_fixes
Fix the half and bytecount crates on arm64
2 parents 1875905 + ce57133 commit 8364234

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/inline_asm.rs

+18
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,15 @@ impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> {
612612
generated_asm.push_str(".att_syntax\n");
613613
}
614614

615+
if self.arch == InlineAsmArch::AArch64 {
616+
for feature in &self.tcx.codegen_fn_attrs(self.enclosing_def_id).target_features {
617+
if feature.name == sym::neon {
618+
continue;
619+
}
620+
writeln!(generated_asm, ".arch_extension {}", feature.name).unwrap();
621+
}
622+
}
623+
615624
// The actual inline asm
616625
for piece in self.template {
617626
match piece {
@@ -679,6 +688,15 @@ impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> {
679688
}
680689
generated_asm.push('\n');
681690

691+
if self.arch == InlineAsmArch::AArch64 {
692+
for feature in &self.tcx.codegen_fn_attrs(self.enclosing_def_id).target_features {
693+
if feature.name == sym::neon {
694+
continue;
695+
}
696+
writeln!(generated_asm, ".arch_extension no{}", feature.name).unwrap();
697+
}
698+
}
699+
682700
if is_x86 && self.options.contains(InlineAsmOptions::ATT_SYNTAX) {
683701
generated_asm.push_str(".intel_syntax noprefix\n");
684702
}

src/intrinsics/llvm_aarch64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(crate) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
2121
fx.bcx.ins().fence();
2222
}
2323

24-
"llvm.aarch64.neon.ld1x4.v16i8.p0i8" => {
24+
"llvm.aarch64.neon.ld1x4.v16i8.p0" => {
2525
intrinsic_args!(fx, args => (ptr); intrinsic);
2626

2727
let ptr = ptr.load_scalar(fx);
@@ -253,7 +253,7 @@ pub(crate) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
253253
}
254254
let res = CValue::by_val(
255255
fx.bcx.ins().uextend(types::I32, res_val),
256-
fx.layout_of(fx.tcx.types.u32),
256+
fx.layout_of(fx.tcx.types.i32),
257257
);
258258
ret.write_cvalue(fx, res);
259259
}

0 commit comments

Comments
 (0)