Home | History | Annotate | Download | only in Mips
      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
     10 
     11 // Test that we produce the correct relocation.
     12 // FIXME: move more relocation only tests here.
     13 
     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.
     22 
     23 // DATA-LABEL: Name: .text
     24 // DATA:       SectionData (
     25 
     26 // DATA-NEXT:  0000: 24620000 24620000
     27         addiu $2, $3, %lo(%neg(%gp_rel(foo))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 foo
     28                                               // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [0x24,0x62,A,A]
     29                                               // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(foo))) # encoding: [A,A,0x62,0x24]
     30                                               // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(foo))), kind: fixup_Mips_GPOFF_LO
     31 
     32         addiu $2, $3, %lo(%neg(%gp_rel(bar))) // RELOC: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 .data
     33                                               // ENCBE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [0x24,0x62,A,A]
     34                                               // ENCLE: addiu $2, $3, %lo(%neg(%gp_rel(bar))) # encoding: [A,A,0x62,0x24]
     35                                               // FIXUP: # fixup A - offset: 0, value: %lo(%neg(%gp_rel(bar))), kind: fixup_Mips_GPOFF_LO
     36 
     37         .data
     38         .word 0
     39 bar:
     40         .word 1
     41 // DATA-LABEL: Section {
     42