[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / test / MC / Mips / relocation-n64.s
blob155ac20653a9327540ca8bad55fcd4d0cb348203
1 // RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding \
2 // RUN: | FileCheck -check-prefixes=ENCBE,FIXUP %s
3 // RUN: llvm-mc -triple mips64el-unknown-linux < %s -show-encoding \
4 // RUN: | FileCheck -check-prefixes=ENCLE,FIXUP %s
5 // RUN: llvm-mc -filetype=obj -triple mips64el-unknown-linux < %s \
6 // RUN: | llvm-readobj -r | FileCheck -check-prefix=RELOC %s
7 // RUN: llvm-mc -filetype=obj -triple mips64-unknown-linux < %s \
8 // RUN: | llvm-readobj --sections --section-data \
9 // RUN: | FileCheck -check-prefix=DATA %s
11 // Test that we produce the correct relocation.
12 // FIXME: move more relocation only tests here.
14 // Check prefixes:
15 // RELOC - Check the relocation in the object.
16 // FIXUP - Check the fixup on the instruction.
17 // ENCBE - Check the big-endian encoding on the instruction.
18 // ENCLE - Check the little-endian encoding on the instruction.
19 // ????? - Placeholder. Relocation is defined but the way of generating it is
20 // unknown.
21 // FIXME - Placeholder. Generation method is known but doesn't work.
23 // DATA-LABEL: Name: .text
24 // DATA: SectionData (
26 // DATA-NEXT: 0000: 3C030000 24620000 3C030000 24620000
27 lui $3, %hi(%neg(%gp_rel(foo))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 foo
28 // ENCBE: lui $3, %hi(%neg(%gp_rel(foo))) # encoding: [0x3c,0x03,A,A]
29 // ENCLE: lui $3, %hi(%neg(%gp_rel(foo))) # encoding: [A,A,0x03,0x3c]
30 // FIXUP: # fixup A - offset: 0, value: %hi(%neg(%gp_rel(foo))), kind: fixup_Mips_GPOFF_HI
32 addiu $2, $3, %lo(%neg(%gp_rel(foo))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 foo
33 // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [0x24,0x62,A,A]
34 // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [A,A,0x62,0x24]
35 // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(foo))), kind: fixup_Mips_GPOFF_LO
37 lui $3, %hi(%neg(%gp_rel(bar))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 .data
38 // ENCBE: lui $3, %hi(%neg(%gp_rel(bar))) # encoding: [0x3c,0x03,A,A]
39 // ENCLE: lui $3, %hi(%neg(%gp_rel(bar))) # encoding: [A,A,0x03,0x3c]
40 // FIXUP: # fixup A - offset: 0, value: %hi(%neg(%gp_rel(bar))), kind: fixup_Mips_GPOFF_HI
42 addiu $2, $3, %lo(%neg(%gp_rel(bar))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 .data
43 // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [0x24,0x62,A,A]
44 // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [A,A,0x62,0x24]
45 // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(bar))), kind: fixup_Mips_GPOFF_LO
47 // DATA-NEXT: 0010: 41A30000 30430000 41A30000 30430000
48 .set micromips
49 lui $3, %hi(%neg(%gp_rel(foo))) // RELOC: R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_HI16 foo
50 // ENCBE: lui $3, %hi(%neg(%gp_rel(foo))) # encoding: [0x41,0xa3,A,A]
51 // ENCLE: lui $3, %hi(%neg(%gp_rel(foo))) # encoding: [0xa3'A',0x41'A',0x00,0x00]
52 // FIXUP: # fixup A - offset: 0, value: %hi(%neg(%gp_rel(foo))), kind: fixup_MICROMIPS_GPOFF_HI
54 addiu $2, $3, %lo(%neg(%gp_rel(foo))) // RELOC: R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_LO16 foo
55 // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [0x30,0x43,A,A]
56 // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [0x43'A',0x30'A',0x00,0x00]
57 // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(foo))), kind: fixup_MICROMIPS_GPOFF_LO
59 lui $3, %hi(%neg(%gp_rel(bar))) // RELOC: R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_HI16 bar
60 // ENCBE: lui $3, %hi(%neg(%gp_rel(bar))) # encoding: [0x41,0xa3,A,A]
61 // ENCLE: lui $3, %hi(%neg(%gp_rel(bar))) # encoding: [0xa3'A',0x41'A',0x00,0x00]
62 // FIXUP: # fixup A - offset: 0, value: %hi(%neg(%gp_rel(bar))), kind: fixup_MICROMIPS_GPOFF_HI
64 addiu $2, $3, %lo(%neg(%gp_rel(bar))) // RELOC: R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_LO16 bar
65 // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [0x30,0x43,A,A]
66 // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [0x43'A',0x30'A',0x00,0x00]
67 // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(bar))), kind: fixup_MICROMIPS_GPOFF_LO
69 .data
70 .word 0
71 bar:
72 .word 1
73 // DATA-LABEL: Section {