Skip to content

Commit b9e67a2

Browse files
committed
Enable target features in inline asm on arm64
1 parent cb4a25c commit b9e67a2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/inline_asm.rs

Lines changed: 18 additions & 0 deletions
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
}

0 commit comments

Comments
 (0)