llvm.org GIT mirror llvm / 4f04548
Revert and accidentally committed revert commit This reverts commit r320245. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320247 91177308-0d34-0410-b5e6-96231b3b80d8 Dylan McKay 1 year, 11 months ago
15 changed file(s) with 357 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
3232 ELF_RELOC(R_AVR_8_LO8, 27)
3333 ELF_RELOC(R_AVR_8_HI8, 28)
3434 ELF_RELOC(R_AVR_8_HLO8, 29)
35 ELF_RELOC(R_AVR_SYM_DIFF, 30)
36 ELF_RELOC(R_AVR_16_LDST, 31)
35 ELF_RELOC(R_AVR_DIFF8, 30)
36 ELF_RELOC(R_AVR_DIFF16, 31)
37 ELF_RELOC(R_AVR_DIFF32, 32)
3738 ELF_RELOC(R_AVR_LDS_STS_16, 33)
3839 ELF_RELOC(R_AVR_PORT6, 34)
3940 ELF_RELOC(R_AVR_PORT5, 35)
204204 VK_ARM_SBREL, // symbol(sbrel)
205205 VK_ARM_TLSLDO, // symbol(tlsldo)
206206 VK_ARM_TLSDESCSEQ,
207
208 VK_AVR_NONE,
209 VK_AVR_LO8,
210 VK_AVR_HI8,
211 VK_AVR_HLO8,
212 VK_AVR_DIFF8,
213 VK_AVR_DIFF16,
214 VK_AVR_DIFF32,
207215
208216 VK_PPC_LO, // symbol@l
209217 VK_PPC_HI, // symbol@h
223223 case VK_ARM_SBREL: return "sbrel";
224224 case VK_ARM_TLSLDO: return "tlsldo";
225225 case VK_ARM_TLSDESCSEQ: return "tlsdescseq";
226 case VK_AVR_NONE: return "none";
227 case VK_AVR_LO8: return "lo8";
228 case VK_AVR_HI8: return "hi8";
229 case VK_AVR_HLO8: return "hlo8";
230 case VK_AVR_DIFF8: return "diff8";
231 case VK_AVR_DIFF16: return "diff16";
232 case VK_AVR_DIFF32: return "diff32";
226233 case VK_PPC_LO: return "l";
227234 case VK_PPC_HI: return "h";
228235 case VK_PPC_HA: return "ha";
388395 .Case("prel31", VK_ARM_PREL31)
389396 .Case("sbrel", VK_ARM_SBREL)
390397 .Case("tlsldo", VK_ARM_TLSLDO)
398 .Case("lo8", VK_AVR_LO8)
399 .Case("hi8", VK_AVR_HI8)
400 .Case("hlo8", VK_AVR_HLO8)
391401 .Case("gotpcrel32@lo", VK_AMDGPU_GOTPCREL32_LO)
392402 .Case("gotpcrel32@hi", VK_AMDGPU_GOTPCREL32_HI)
393403 .Case("rel32@lo", VK_AMDGPU_REL32_LO)
88
99 #include "AVR.h"
1010 #include "AVRRegisterInfo.h"
11 #include "MCTargetDesc/AVRMCELFStreamer.h"
1112 #include "MCTargetDesc/AVRMCExpr.h"
1213 #include "MCTargetDesc/AVRMCTargetDesc.h"
1314
3940 const MCSubtargetInfo &STI;
4041 MCAsmParser &Parser;
4142 const MCRegisterInfo *MRI;
43 const std::string GENERATE_STUBS = "gs";
4244
4345 #define GET_ASSEMBLER_HEADER
4446 #include "AVRGenAsmMatcher.inc"
5355 bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
5456 SMLoc NameLoc, OperandVector &Operands) override;
5557
56 bool ParseDirective(AsmToken directiveID) override;
58 bool ParseDirective(AsmToken DirectiveID) override;
5759
5860 OperandMatchResultTy parseMemriOperand(OperandVector &Operands);
5961
7880 bool invalidOperand(SMLoc const &Loc, OperandVector const &Operands,
7981 uint64_t const &ErrorInfo);
8082 bool missingFeature(SMLoc const &Loc, uint64_t const &ErrorInfo);
83
84 bool parseLiteralValues(unsigned SizeInBytes, SMLoc L);
8185
8286 public:
8387 AVRAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser,
403407 size_t ReadCount = Parser.getLexer().peekTokens(tokens);
404408
405409 if (ReadCount == 2) {
406 if (tokens[0].getKind() == AsmToken::Identifier &&
407 tokens[1].getKind() == AsmToken::LParen) {
410 if ((tokens[0].getKind() == AsmToken::Identifier &&
411 tokens[1].getKind() == AsmToken::LParen) ||
412 (tokens[0].getKind() == AsmToken::LParen &&
413 tokens[1].getKind() == AsmToken::Minus)) {
408414
409415 AsmToken::TokenKind CurTok = Parser.getLexer().getKind();
410 if (CurTok == AsmToken::Minus) {
416 if (CurTok == AsmToken::Minus ||
417 tokens[1].getKind() == AsmToken::Minus) {
411418 isNegated = true;
412419 } else {
413420 assert(CurTok == AsmToken::Plus);
415422 }
416423
417424 // Eat the sign
418 Parser.Lex();
425 if (CurTok == AsmToken::Minus || CurTok == AsmToken::Plus)
426 Parser.Lex();
419427 }
420428 }
421429
431439 if (ModifierKind != AVRMCExpr::VK_AVR_None) {
432440 Parser.Lex();
433441 Parser.Lex(); // Eat modifier name and parenthesis
442 if (Parser.getTok().getString() == GENERATE_STUBS &&
443 Parser.getTok().getKind() == AsmToken::Identifier) {
444 std::string GSModName = ModifierName.str() + "_" + GENERATE_STUBS;
445 ModifierKind = AVRMCExpr::getKindByName(GSModName.c_str());
446 if (ModifierKind != AVRMCExpr::VK_AVR_None)
447 Parser.Lex(); // Eat gs modifier name
448 }
434449 } else {
435450 return Error(Parser.getTok().getLoc(), "unknown modifier");
451 }
452
453 if (tokens[1].getKind() == AsmToken::Minus ||
454 tokens[1].getKind() == AsmToken::Plus) {
455 Parser.Lex();
456 assert(Parser.getTok().getKind() == AsmToken::LParen);
457 Parser.Lex(); // Eat the sign and parenthesis
436458 }
437459
438460 MCExpr const *InnerExpression;
439461 if (getParser().parseExpression(InnerExpression))
440462 return true;
463
464 if (tokens[1].getKind() == AsmToken::Minus ||
465 tokens[1].getKind() == AsmToken::Plus) {
466 assert(Parser.getTok().getKind() == AsmToken::RParen);
467 Parser.Lex(); // Eat closing parenthesis
468 }
441469
442470 // If we have a modifier wrap the inner expression
443471 assert(Parser.getTok().getKind() == AsmToken::RParen);
579607 return false;
580608 }
581609
582 bool AVRAsmParser::ParseDirective(llvm::AsmToken DirectiveID) { return true; }
610 bool AVRAsmParser::ParseDirective(llvm::AsmToken DirectiveID) {
611 StringRef IDVal = DirectiveID.getIdentifier();
612 if (IDVal.lower() == ".long") {
613 parseLiteralValues(SIZE_LONG, DirectiveID.getLoc());
614 } else if (IDVal.lower() == ".word" || IDVal.lower() == ".short") {
615 parseLiteralValues(SIZE_WORD, DirectiveID.getLoc());
616 } else if (IDVal.lower() == ".byte") {
617 parseLiteralValues(1, DirectiveID.getLoc());
618 }
619 return true;
620 }
621
622 bool AVRAsmParser::parseLiteralValues(unsigned SizeInBytes, SMLoc L) {
623 MCAsmParser &Parser = getParser();
624 AVRMCELFStreamer &AVRStreamer =
625 static_cast(Parser.getStreamer());
626 AsmToken Tokens[2];
627 size_t ReadCount = Parser.getLexer().peekTokens(Tokens);
628 if (ReadCount == 2 && Parser.getTok().getKind() == AsmToken::Identifier &&
629 Tokens[0].getKind() == AsmToken::Minus &&
630 Tokens[1].getKind() == AsmToken::Identifier) {
631 MCSymbol *Symbol = getContext().getOrCreateSymbol(".text");
632 AVRStreamer.EmitValueForModiferKind(Symbol, SizeInBytes, L,
633 AVRMCExpr::VK_AVR_None);
634 return false;
635 }
636
637 if (Parser.getTok().getKind() == AsmToken::Identifier &&
638 Parser.getLexer().peekTok().getKind() == AsmToken::LParen) {
639 StringRef ModifierName = Parser.getTok().getString();
640 AVRMCExpr::VariantKind ModifierKind =
641 AVRMCExpr::getKindByName(ModifierName.str().c_str());
642 if (ModifierKind != AVRMCExpr::VK_AVR_None) {
643 Parser.Lex();
644 Parser.Lex(); // Eat the modifier and parenthesis
645 } else {
646 return Error(Parser.getTok().getLoc(), "unknown modifier");
647 }
648 MCSymbol *Symbol =
649 getContext().getOrCreateSymbol(Parser.getTok().getString());
650 AVRStreamer.EmitValueForModiferKind(Symbol, SizeInBytes, L, ModifierKind);
651 return false;
652 }
653
654 auto parseOne = [&]() -> bool {
655 const MCExpr *Value;
656 if (Parser.parseExpression(Value))
657 return true;
658 Parser.getStreamer().EmitValue(Value, SizeInBytes, L);
659 return false;
660 };
661 return (parseMany(parseOne));
662 }
583663
584664 extern "C" void LLVMInitializeAVRAsmParser() {
585665 RegisterMCAsmParser X(getTheAVRTarget());
421421 {"fixup_8_hi8", 0, 8, 0},
422422 {"fixup_8_hlo8", 0, 8, 0},
423423
424 {"fixup_sym_diff", 0, 32, 0},
425 {"fixup_16_ldst", 0, 16, 0},
424 {"fixup_diff8", 0, 8, 0},
425 {"fixup_diff16", 0, 16, 0},
426 {"fixup_diff32", 0, 32, 0},
426427
427428 {"fixup_lds_sts_16", 0, 16, 0},
428429
3939 const MCValue &Target,
4040 const MCFixup &Fixup,
4141 bool IsPCRel) const {
42 MCSymbolRefExpr::VariantKind Modifier = Target.getAccessVariant();
4243 switch ((unsigned) Fixup.getKind()) {
4344 case FK_Data_1:
45 switch (Modifier) {
46 default:
47 llvm_unreachable("Unsupported Modifier");
48 case MCSymbolRefExpr::VK_None:
49 return ELF::R_AVR_8;
50 case MCSymbolRefExpr::VK_AVR_DIFF8:
51 return ELF::R_AVR_DIFF8;
52 case MCSymbolRefExpr::VK_AVR_LO8:
53 return ELF::R_AVR_8_LO8;
54 case MCSymbolRefExpr::VK_AVR_HI8:
55 return ELF::R_AVR_8_HI8;
56 case MCSymbolRefExpr::VK_AVR_HLO8:
57 return ELF::R_AVR_8_HLO8;
58 }
4459 case FK_Data_4:
45 llvm_unreachable("unsupported relocation type");
60 switch (Modifier) {
61 default:
62 llvm_unreachable("Unsupported Modifier");
63 case MCSymbolRefExpr::VK_None:
64 return ELF::R_AVR_32;
65 case MCSymbolRefExpr::VK_AVR_DIFF32:
66 return ELF::R_AVR_DIFF32;
67 }
4668 case FK_Data_2:
47 return ELF::R_AVR_16_PM;
69 switch (Modifier) {
70 default:
71 llvm_unreachable("Unsupported Modifier");
72 case MCSymbolRefExpr::VK_None:
73 return ELF::R_AVR_16;
74 case MCSymbolRefExpr::VK_AVR_NONE:
75 return ELF::R_AVR_16_PM;
76 case MCSymbolRefExpr::VK_AVR_DIFF16:
77 return ELF::R_AVR_DIFF16;
78 }
4879 case AVR::fixup_32:
4980 return ELF::R_AVR_32;
5081 case AVR::fixup_7_pcrel:
103134 return ELF::R_AVR_8_HI8;
104135 case AVR::fixup_8_hlo8:
105136 return ELF::R_AVR_8_HLO8;
106 case AVR::fixup_sym_diff:
107 return ELF::R_AVR_SYM_DIFF;
108 case AVR::fixup_16_ldst:
109 return ELF::R_AVR_16_LDST;
137 case AVR::fixup_diff8:
138 return ELF::R_AVR_DIFF8;
139 case AVR::fixup_diff16:
140 return ELF::R_AVR_DIFF16;
141 case AVR::fixup_diff32:
142 return ELF::R_AVR_DIFF32;
110143 case AVR::fixup_lds_sts_16:
111144 return ELF::R_AVR_LDS_STS_16;
112145 case AVR::fixup_port6:
114114 fixup_8_hi8,
115115 fixup_8_hlo8,
116116
117 /// Fixup to calculate the difference between two symbols.
118 /// Is the only stateful fixup. We do not support it yet.
119 fixup_sym_diff,
120 fixup_16_ldst,
117 fixup_diff8,
118 fixup_diff16,
119 fixup_diff32,
121120
122121 fixup_lds_sts_16,
123122
0 //===--------- AVRMCELFStreamer.cpp - AVR subclass of MCELFStreamer -------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a stub that parses a MCInst bundle and passes the
10 // instructions on to the real streamer.
11 //
12 //===----------------------------------------------------------------------===//
13 #define DEBUG_TYPE "avrmcelfstreamer"
14
15 #include "MCTargetDesc/AVRMCELFStreamer.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCExpr.h"
18 #include "llvm/MC/MCSymbol.h"
19
20 using namespace llvm;
21
22 void AVRMCELFStreamer::EmitValueForModiferKind(
23 const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc,
24 AVRMCExpr::VariantKind ModifierKind) {
25 MCSymbolRefExpr::VariantKind Kind = MCSymbolRefExpr::VK_AVR_NONE;
26 if (ModifierKind == AVRMCExpr::VK_AVR_None) {
27 Kind = MCSymbolRefExpr::VK_AVR_DIFF8;
28 if (SizeInBytes == SIZE_LONG)
29 Kind = MCSymbolRefExpr::VK_AVR_DIFF32;
30 else if (SizeInBytes == SIZE_WORD)
31 Kind = MCSymbolRefExpr::VK_AVR_DIFF16;
32 } else if (ModifierKind == AVRMCExpr::VK_AVR_LO8)
33 Kind = MCSymbolRefExpr::VK_AVR_LO8;
34 else if (ModifierKind == AVRMCExpr::VK_AVR_HI8)
35 Kind = MCSymbolRefExpr::VK_AVR_HI8;
36 else if (ModifierKind == AVRMCExpr::VK_AVR_HH8)
37 Kind = MCSymbolRefExpr::VK_AVR_HLO8;
38 MCELFStreamer::EmitValue(MCSymbolRefExpr::create(Sym, Kind, getContext()),
39 SizeInBytes, Loc);
40 }
41
42 namespace llvm {
43 MCStreamer *createAVRELFStreamer(Triple const &TT, MCContext &Context,
44 std::unique_ptr MAB,
45 raw_pwrite_stream &OS,
46 std::unique_ptr CE) {
47 return new AVRMCELFStreamer(Context, std::move(MAB), OS, std::move(CE));
48 }
49
50 } // end namespace llvm
0 //===--------- AVRMCELFStreamer.h - AVR subclass of MCELFStreamer ---------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_LIB_TARGET_AVR_MCTARGETDESC_AVRMCELFSTREAMER_H
10 #define LLVM_LIB_TARGET_AVR_MCTARGETDESC_AVRMCELFSTREAMER_H
11
12 #include "MCTargetDesc/AVRMCExpr.h"
13 #include "MCTargetDesc/AVRMCTargetDesc.h"
14 #include "llvm/MC/MCAsmBackend.h"
15 #include "llvm/MC/MCCodeEmitter.h"
16 #include "llvm/MC/MCELFStreamer.h"
17 #include "llvm/MC/MCInstrInfo.h"
18
19 namespace llvm {
20
21 const int SIZE_LONG = 4;
22 const int SIZE_WORD = 2;
23
24 class AVRMCELFStreamer : public MCELFStreamer {
25 std::unique_ptr MCII;
26
27 public:
28 AVRMCELFStreamer(MCContext &Context, std::unique_ptr TAB,
29 raw_pwrite_stream &OS,
30 std::unique_ptr Emitter)
31 : MCELFStreamer(Context, std::move(TAB), OS, std::move(Emitter)),
32 MCII(createAVRMCInstrInfo()) {}
33
34 AVRMCELFStreamer(MCContext &Context, std::unique_ptr TAB,
35 raw_pwrite_stream &OS,
36 std::unique_ptr Emitter,
37 MCAssembler *Assembler)
38 : MCELFStreamer(Context, std::move(TAB), OS, std::move(Emitter)),
39 MCII(createAVRMCInstrInfo()) {}
40
41 void EmitValueForModiferKind(
42 const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc = SMLoc(),
43 AVRMCExpr::VariantKind ModifierKind = AVRMCExpr::VK_AVR_None);
44 };
45
46 MCStreamer *createAVRELFStreamer(Triple const &TT, MCContext &Context,
47 std::unique_ptr MAB,
48 raw_pwrite_stream &OS,
49 std::unique_ptr CE);
50
51 } // end namespace llvm
52
53 #endif // LLVM_LIB_TARGET_AVR_MCTARGETDESC_AVRMCELFSTREAMER_H
2828
2929 {"pm_lo8", AVRMCExpr::VK_AVR_PM_LO8}, {"pm_hi8", AVRMCExpr::VK_AVR_PM_HI8},
3030 {"pm_hh8", AVRMCExpr::VK_AVR_PM_HH8},
31
32 {"lo8_gs", AVRMCExpr::VK_AVR_LO8_GS}, {"hi8_gs", AVRMCExpr::VK_AVR_HI8_GS},
33 {"gs", AVRMCExpr::VK_AVR_GS},
3134 };
3235
3336 } // end of anonymous namespace
100103 case AVRMCExpr::VK_AVR_LO8:
101104 break;
102105 case AVRMCExpr::VK_AVR_HI8:
106 Value &= 0xff00;
103107 Value >>= 8;
104108 break;
105109 case AVRMCExpr::VK_AVR_HH8:
110 Value &= 0xff0000;
106111 Value >>= 16;
107112 break;
108113 case AVRMCExpr::VK_AVR_HHI8:
114 Value &= 0xff000000;
109115 Value >>= 24;
110116 break;
111117 case AVRMCExpr::VK_AVR_PM_LO8:
118 Value &= 0xff;
112119 Value >>= 1;
113120 break;
114121 case AVRMCExpr::VK_AVR_PM_HI8:
122 Value &= 0xff00;
115123 Value >>= 9;
116124 break;
117125 case AVRMCExpr::VK_AVR_PM_HH8:
126 Value &= 0xff0000;
118127 Value >>= 17;
128 break;
129 case AVRMCExpr::VK_AVR_LO8_GS:
130 Value &= 0xff;
131 Value >>= 1;
132 break;
133 case AVRMCExpr::VK_AVR_HI8_GS:
134 Value &= 0xff00;
135 Value >>= 9;
136 break;
137 case AVRMCExpr::VK_AVR_GS:
138 Value >>= 1;
119139 break;
120140
121141 case AVRMCExpr::VK_AVR_None:
149169 break;
150170 case VK_AVR_PM_HH8:
151171 Kind = isNegated() ? AVR::fixup_hh8_ldi_pm_neg : AVR::fixup_hh8_ldi_pm;
172 break;
173 case VK_AVR_LO8_GS:
174 Kind = AVR::fixup_lo8_ldi_gs;
175 break;
176 case VK_AVR_HI8_GS:
177 Kind = AVR::fixup_hi8_ldi_gs;
152178 break;
153179
154180 case VK_AVR_None:
2929
3030 VK_AVR_PM_LO8, ///< Corresponds to `pm_lo8()`.
3131 VK_AVR_PM_HI8, ///< Corresponds to `pm_hi8()`.
32 VK_AVR_PM_HH8 ///< Corresponds to `pm_hh8()`.
32 VK_AVR_PM_HH8, ///< Corresponds to `pm_hh8()`.
33
34 VK_AVR_LO8_GS, ///< Corresponds to `lo8(gs())`.
35 VK_AVR_HI8_GS, ///< Corresponds to `hi8(gs())`.
36 VK_AVR_GS, ///< Corresponds to `gs()`.
3337 };
3438
3539 public:
1010 //
1111 //===----------------------------------------------------------------------===//
1212
13 #include "AVRMCTargetDesc.h"
1413 #include "AVRELFStreamer.h"
1514 #include "AVRMCAsmInfo.h"
15 #include "AVRMCELFStreamer.h"
16 #include "AVRMCTargetDesc.h"
1617 #include "AVRTargetStreamer.h"
1718 #include "InstPrinter/AVRInstPrinter.h"
1819
20 #include "llvm/MC/MCAsmBackend.h"
1921 #include "llvm/MC/MCELFStreamer.h"
2022 #include "llvm/MC/MCCodeEmitter.h"
2123 #include "llvm/MC/MCInstrInfo.h"
3436
3537 using namespace llvm;
3638
37 static MCInstrInfo *createAVRMCInstrInfo() {
39 MCInstrInfo *llvm::createAVRMCInstrInfo() {
3840 MCInstrInfo *X = new MCInstrInfo();
3941 InitAVRMCInstrInfo(X);
4042
107109 // Register the MC Code Emitter
108110 TargetRegistry::RegisterMCCodeEmitter(getTheAVRTarget(), createAVRMCCodeEmitter);
109111
110 // Register the ELF streamer
112 // Register the obj streamer
111113 TargetRegistry::RegisterELFStreamer(getTheAVRTarget(), createMCStreamer);
112114
113115 // Register the obj target streamer.
3333
3434 Target &getTheAVRTarget();
3535
36 MCInstrInfo *createAVRMCInstrInfo();
37
3638 /// Creates a machine code emitter for AVR.
3739 MCCodeEmitter *createAVRMCCodeEmitter(const MCInstrInfo &MCII,
3840 const MCRegisterInfo &MRI,
33 AVRELFStreamer.cpp
44 AVRMCAsmInfo.cpp
55 AVRMCCodeEmitter.cpp
6 AVRMCELFStreamer.cpp
67 AVRMCExpr.cpp
78 AVRMCTargetDesc.cpp
89 AVRTargetStreamer.cpp
0 ; RUN: llvm-mc -filetype=obj -triple=avr %s -mattr=avr6 | llvm-objdump -r - | FileCheck %s
11
22 ; CHECK: RELOCATION RECORDS FOR
3
4 ; CHECK: RELOCATION RECORDS BAR
5 bar:
6 jmp bar
37
48 ; CHECK-NEXT: R_AVR_LDI SYMBOL+3
59 ldi r21, SYMBOL+3
2731
2832 ; CHECK-NEXT: R_AVR_LO8_LDI bar+3
2933 ldi r24, lo8(bar+3)
34 ldi r16, +lo8(abc)
35 ldi r16, lo8(+(abc))
3036
3137 ; CHECK-NEXT: R_AVR_HI8_LDI abc
3238 ldi r30, hi8(abc)
39 ldi r16, +hi8(abc)
40 ldi r16, hi8(+(abc))
3341
3442 ; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
3543 ldi r16, -lo8(abc)
44 ldi r16, lo8(-(abc))
3645
3746 ; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
3847 ldi r16, -hi8(abc)
48 ldi r16, hi8(-(abc))
3949
4050 ; CHECK-NEXT: R_AVR_HH8_LDI foo
4151 ldi r16, hh8(foo)
52 ldi r16, +hh8(foo)
53 ldi r16, hh8(+(foo))
4254
4355 ; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
4456 ldi r16, -hh8(foo)
57 ldi r16, hh8(-(foo))
4558
4659 ; CHECK-NEXT: R_AVR_HH8_LDI foo
4760 ldi r24, hlo8(foo)
61 ldi r24, +hlo8(foo)
62 ldi r24, hlo8(+(foo))
4863
4964 ; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
5065 ldi r24, -hlo8(foo)
66 ldi r24, hlo8(-(foo))
5167
5268 ; CHECK-NEXT: R_AVR_MS8_LDI bar
5369 ldi r24, hhi8(bar)
70 ldi r24, +hhi8(bar)
71 ldi r24, hhi8(+(bar))
5472
5573 ; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
5674 ldi r24, -hhi8(bar)
75 ldi r24, hhi8(-(bar))
5776
5877 ; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
5978 ldi r17, pm_lo8(foo)
79 ldi r25, +pm_lo8(foo)
80 ldi r25, pm_lo8(+(foo))
6081
6182 ; CHECK-NEXT: R_AVR_HI8_LDI_PM bar
6283 ldi r22, pm_hi8(bar)
84 ldi r25, +pm_hi8(foo)
85 ldi r25, pm_hi8(+(foo))
6386
6487 ; CHECK-NEXT: R_AVR_HH8_LDI_PM baz
6588 ldi r25, pm_hh8(baz)
89 ldi r25, +pm_hh8(foo)
90 ldi r25, pm_hh8(+(foo))
6691
6792 ; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG
6893 ldi r25, -pm_lo8(foo)
94 ldi r25, pm_lo8(-(foo))
6995
7096 ; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG
7197 ldi r25, -pm_hi8(foo)
98 ldi r25, pm_hi8(-(foo))
7299
73100 ; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG
74101 ldi r25, -pm_hh8(foo)
102 ldi r25, pm_hh8(-(foo))
103
104 ; CHECK-NEXT: R_AVR_LO8_LDI_GS
105 ldi r17, lo8(gs(foo))
106
107 ; CHECK-NEXT: R_AVR_HI8_LDI_GS
108 ldi r18, hi8(gs(foo))
109
110 ; CHECK-NEXT: R_AVR_16
111 .short foo
112
113 ; CHECK-NEXT: R_AVR_16_PM
114 .short gs(foo)
115
116 ; CHECK-NEXT: R_AVR_8
117 .byte foo
118
119 ; CHECK-NEXT: R_AVR_8_LO8
120 .byte lo8(foo)
121
122 ; CHECK-NEXT: R_AVR_8_HI8
123 .byte hi8(foo)
124
125 ; CHECK-NEXT: R_AVR_8_HLO8
126 .byte hlo8(foo)
127
128 ; CHECK-NEXT: R_AVR_DIFF8
129 .byte foo - bar
130
131 ; CHECK-NEXT: R_AVR_DIFF16
132 .short foo - bar
133
134 ; CHECK-NEXT: R_AVR_DIFF32
135 .long foo - bar