diff --git a/llvm/lib/Target/Z80/MCTargetDesc/Z80MCAsmInfo.cpp b/llvm/lib/Target/Z80/MCTargetDesc/Z80MCAsmInfo.cpp index f2d0f6f8b32e2..d389876208ad2 100644 --- a/llvm/lib/Target/Z80/MCTargetDesc/Z80MCAsmInfo.cpp +++ b/llvm/lib/Target/Z80/MCTargetDesc/Z80MCAsmInfo.cpp @@ -38,20 +38,28 @@ Z80MCAsmInfoELF::Z80MCAsmInfoELF(const Triple &T) { // Common to both GAS and fasmg CommentString = ";"; + AscizDirective = nullptr; Code32Directive = Code64Directive = nullptr; UseIntegratedAssembler = false; AssemblerDialect = !Is16Bit; HasFunctionAlignment = false; ExceptionsType = ExceptionHandling::SjLj; - if (!Z80GasStyle) { + if (Z80GasStyle) { + Code16Directive = ".assume\tADL = 0"; + Code24Directive = ".assume\tADL = 1"; + AsciiDirective = ByteListDirective = Data8bitsDirective = "\tdb\t"; + Data16bitsDirective = "\tdw\t"; + Data24bitsDirective = "\td24\t"; + Data32bitsDirective = "\td32\t"; + } else { Code16Directive = "assume\tadl = 0"; Code24Directive = "assume\tadl = 1"; DollarIsPC = true; SeparatorString = nullptr; PrivateGlobalPrefix = PrivateLabelPrefix = ""; SupportsQuotedNames = false; - ZeroDirective = AscizDirective = nullptr; + ZeroDirective = nullptr; BlockSeparator = " dup "; AsciiDirective = ByteListDirective = Data8bitsDirective = "\tdb\t"; NumberLiteralSyntax = ANLS_PlainDecimal; diff --git a/llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp b/llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp index 6f63a3ed47817..388beede31684 100644 --- a/llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp +++ b/llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp @@ -34,8 +34,13 @@ void Z80TargetAsmStreamer::emitLabel(MCSymbol *Symbol) { } void Z80TargetAsmStreamer::emitAlign(Align Alignment) { - if (auto Mask = Alignment.value() - 1) - Z80GasStyle ? OS << "\t.skip\t($$ - $) and " << Mask << '\n' : OS << "\trb\t($$ - $) and " << Mask << '\n'; + if (auto Mask = Alignment.value() - 1) { + if (Z80GasStyle) { + OS << "\t.balign\t" << Alignment.value() << '\n'; + } else { + OS << "\trb\t($$ - $) and " << Mask << '\n'; + } + } } void Z80TargetAsmStreamer::emitBlock(uint64_t NumBytes) {