Home | History | Annotate | Download | only in Mips
      1 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 -show-encoding |\
      2 # RUN:   FileCheck %s -check-prefixes=ALL,NORMAL,O32
      3 
      4 # RUN: llvm-mc %s -arch=mips -mcpu=mips64 -target-abi n32 -show-encoding |\
      5 # RUN:   FileCheck %s -check-prefixes=ALL,NORMAL,N32
      6 
      7 # RUN: llvm-mc %s -arch=mips64 -mcpu=mips64 -target-abi n64 -show-encoding |\
      8 # RUN:   FileCheck %s -check-prefixes=ALL,NORMAL,N64
      9 
     10 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 -mattr=micromips -show-encoding |\
     11 # RUN:   FileCheck %s -check-prefixes=ALL,MICROMIPS,O32-MICROMIPS
     12 
     13 # RUN: llvm-mc %s -arch=mips -mcpu=mips64 -target-abi n32 -mattr=micromips -show-encoding |\
     14 # RUN:   FileCheck %s -check-prefixes=ALL,MICROMIPS,N32-MICROMIPS
     15 
     16 # RUN: llvm-mc %s -arch=mips64 -mcpu=mips64 -target-abi n64 -mattr=micromips -show-encoding |\
     17 # RUN:   FileCheck %s -check-prefixes=ALL,MICROMIPS,N64-MICROMIPS
     18 
     19   .weak weak_label
     20 
     21   .text
     22   .option pic2
     23 
     24   .ent local_label
     25 local_label:
     26   .frame  $sp, 0, $ra
     27   .set noreorder
     28 
     29   jal local_label
     30   nop
     31 
     32   jal weak_label
     33   nop
     34 
     35   jal global_label
     36   nop
     37 
     38   jal .text
     39   nop
     40 
     41   # local labels ($tmp symbols)
     42   jal 1f
     43   nop
     44 
     45   .end local_label
     46 
     47 1:
     48   nop
     49   add $8, $8, $8
     50   nop
     51 
     52 # Expanding "jal local_label":
     53 # O32: lw     $25, %got(local_label)($gp)   # encoding: [0x8f,0x99,A,A]
     54 # O32:                                      #   fixup A - offset: 0, value: %got(local_label), kind:   fixup_Mips_GOT
     55 # O32: addiu  $25, $25, %lo(local_label)    # encoding: [0x27,0x39,A,A]
     56 # O32:                                      #   fixup A - offset: 0, value: %lo(local_label), kind:   fixup_Mips_LO16
     57 
     58 # N32: lw  $25, %got_disp(local_label)($gp) # encoding: [0x8f,0x99,A,A]
     59 # N32:                                      #   fixup A - offset: 0, value: %got_disp(local_label), kind:   fixup_Mips_GOT_DISP
     60 
     61 # N64: ld  $25, %got_disp(local_label)($gp) # encoding: [0xdf,0x99,A,A]
     62 # N64:                                      #   fixup A - offset: 0, value: %got_disp(local_label), kind:   fixup_Mips_GOT_DISP
     63 
     64 # O32-MICROMIPS: lw    $25, %got(local_label)($gp)      # encoding: [0xff,0x3c,A,A]
     65 # O32-MICROMIPS:                                        #   fixup A - offset: 0, value: %got(local_label), kind:   fixup_MICROMIPS_GOT16
     66 # O32-MICROMIPS: addiu $25, $25, %lo(local_label)       # encoding: [0x33,0x39,A,A]
     67 # O32-MICROMIPS:                                        #   fixup A - offset: 0, value: %lo(local_label), kind:   fixup_MICROMIPS_LO16
     68 
     69 # N32-MICROMIPS: lw    $25, %got_disp(local_label)($gp) # encoding: [0xff,0x3c,A,A]
     70 # N32-MICROMIPS:                                        #   fixup A - offset: 0, value: %got_disp(local_label), kind: fixup_MICROMIPS_GOT_DISP
     71 
     72 # N64-MICROMIPS: ld    $25, %got_disp(local_label)($gp) # encoding: [0xdf,0x99,A,A]
     73 # N64-MICROMIPS:                                        #   fixup A - offset: 0, value: %got_disp(local_label), kind: fixup_MICROMIPS_GOT_DISP
     74 
     75 # NORMAL:    jalr $25      # encoding: [0x03,0x20,0xf8,0x09]
     76 # MICROMIPS: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
     77 # ALL:       nop           # encoding: [0x00,0x00,0x00,0x00]
     78 
     79 
     80 # Expanding "jal weak_label":
     81 # O32: lw  $25, %call16(weak_label)($gp) # encoding: [0x8f,0x99,A,A]
     82 # O32:                                   #   fixup A - offset: 0, value: %call16(weak_label), kind:   fixup_Mips_CALL16
     83 
     84 # N32: lw  $25, %call16(weak_label)($gp) # encoding: [0x8f,0x99,A,A]
     85 # N32:                                   #   fixup A - offset: 0, value: %call16(weak_label), kind:   fixup_Mips_CALL16
     86 
     87 # N64: ld  $25, %call16(weak_label)($gp) # encoding: [0xdf,0x99,A,A]
     88 # N64:                                   #   fixup A - offset: 0, value: %call16(weak_label), kind:   fixup_Mips_CALL16
     89 
     90 # O32-MICROMIPS: lw  $25, %call16(weak_label)($gp) # encoding: [0xff,0x3c,A,A]
     91 # O32-MICROMIPS:                                   #   fixup A - offset: 0, value: %call16(weak_label), kind:   fixup_MICROMIPS_CALL16
     92 
     93 # N32-MICROMIPS: lw  $25, %call16(weak_label)($gp) # encoding: [0xff,0x3c,A,A]
     94 # N32-MICROMIPS:                                   #   fixup A - offset: 0, value: %call16(weak_label), kind: fixup_MICROMIPS_CALL16
     95 
     96 # N64-MICROMIPS: ld  $25, %call16(weak_label)($gp) # encoding: [0xdf,0x99,A,A]
     97 # N64-MICROMIPS:                                   #   fixup A - offset: 0, value: %call16(weak_label), kind: fixup_MICROMIPS_CALL16
     98 
     99 # NORMAL:    jalr $25      # encoding: [0x03,0x20,0xf8,0x09]
    100 # MICROMIPS: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
    101 # ALL:       nop           # encoding: [0x00,0x00,0x00,0x00]
    102 
    103 
    104 # Expanding "jal global_label":
    105 # O32: lw  $25, %call16(global_label)($gp) # encoding: [0x8f,0x99,A,A]
    106 # O32:                                     #   fixup A - offset: 0, value: %call16(global_label), kind:   fixup_Mips_CALL16
    107 
    108 # N32: lw  $25, %call16(global_label)($gp) # encoding: [0x8f,0x99,A,A]
    109 # N32:                                     #   fixup A - offset: 0, value: %call16(global_label), kind:   fixup_Mips_CALL16
    110 
    111 # N64: ld  $25, %call16(global_label)($gp) # encoding: [0xdf,0x99,A,A]
    112 # N64:                                     #   fixup A - offset: 0, value: %call16(global_label), kind:   fixup_Mips_CALL16
    113 
    114 # O32-MICROMIPS: lw  $25, %call16(global_label)($gp) # encoding: [0xff,0x3c,A,A]
    115 # O32-MICROMIPS:                                     #   fixup A - offset: 0, value: %call16(global_label), kind: fixup_MICROMIPS_CALL16
    116 
    117 # N32-MICROMIPS: lw  $25, %call16(global_label)($gp) # encoding: [0xff,0x3c,A,A]
    118 # N32-MICROMIPS:                                     #   fixup A - offset: 0, value: %call16(global_label), kind: fixup_MICROMIPS_CALL16
    119 
    120 # N64-MICROMIPS: ld  $25, %call16(global_label)($gp) # encoding: [0xdf,0x99,A,A]
    121 # N64-MICROMIPS:                                     #   fixup A - offset: 0, value: %call16(global_label), kind: fixup_MICROMIPS_CALL16
    122 
    123 # NORMAL:    jalr $25      # encoding: [0x03,0x20,0xf8,0x09]
    124 # MICROMIPS: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
    125 # ALL:       nop           # encoding: [0x00,0x00,0x00,0x00]
    126 
    127 
    128 # FIXME: The .text section MCSymbol isn't created when printing assembly. However,
    129 # it is created when generating an ELF object file.
    130 # Expanding "jal .text":
    131 # O32-FIXME: lw    $25, %got(.text)($gp)           # encoding: [0x8f,0x99,A,A]
    132 # O32-FIXME:                                       #   fixup A - offset: 0, value: %got(.text), kind: fixup_Mips_GOT
    133 # O32-FIXME: addiu $25, $25, %lo(.text)            # encoding: [0x27,0x39,A,A]
    134 # O32-FIXME:                                       #   fixup A - offset: 0, value: %lo(.text), kind: fixup_Mips_LO16
    135 
    136 # N32-FIXME: lw  $25, %got_disp(.text)($gp)        # encoding: [0x8f,0x99,A,A]
    137 # N32-FIXME:                                       #   fixup A - offset: 0, value: %got_disp(.text), kind: fixup_Mips_GOT_DISP
    138 
    139 # N64-FIXME: ld  $25, %got_disp(.text)($gp)        # encoding: [0xdf,0x99,A,A]
    140 # N64-FIXME:                                       #   fixup A - offset: 0, value: %got_disp(.text), kind: fixup_Mips_GOT_DISP
    141 
    142 # O32-MICROMIPS-FIXME: lw    $25, %got(.text)($gp)      # encoding: [0xff,0x3c,A,A]
    143 # O32-MICROMIPS-FIXME:                                  #   fixup A - offset: 0, value: %got(.text), kind: fixup_MICROMIPS_GOT16
    144 # O32-MICROMIPS-FIXME: addiu $25, $25, %lo(.text)       # encoding: [0x33,0x39,A,A]
    145 # O32-MICROMIPS-FIXME:                                  #   fixup A - offset: 0, value: %lo(.text), kind: fixup_MICROMIPS_LO16
    146 
    147 # N32-MICROMIPS-FIXME: lw    $25, %got_disp(.text)($gp) # encoding: [0xff,0x3c,A,A]
    148 # N32-MICROMIPS-FIXME:                                  #   fixup A - offset: 0, value: %got_disp(.text), kind: fixup_MICROMIPS_GOT_DISP
    149 
    150 # N64-MICROMIPS-FIXME: ld    $25, %got_disp(.text)($gp) # encoding: [0xdf,0x99,A,A]
    151 # N64-MICROMIPS-FIXME:                                  #   fixup A - offset: 0, value: %got_disp(.text), kind: fixup_MICROMIPS_GOT_DISP
    152 
    153 # NORMAL:    jalr $25      # encoding: [0x03,0x20,0xf8,0x09]
    154 # MICROMIPS: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
    155 # ALL:       nop           # encoding: [0x00,0x00,0x00,0x00]
    156 
    157 
    158 # Expanding "jal 1f":
    159 # O32: lw     $25, %got($tmp0)($gp)   # encoding: [0x8f,0x99,A,A]
    160 # O32:                                #   fixup A - offset: 0, value: %got($tmp0), kind:   fixup_Mips_GOT
    161 # O32: addiu  $25, $25, %lo($tmp0)    # encoding: [0x27,0x39,A,A]
    162 # O32:                                #   fixup A - offset: 0, value: %lo($tmp0), kind:   fixup_Mips_LO16
    163 
    164 # N32: lw  $25, %got_disp($tmp0)($gp) # encoding: [0x8f,0x99,A,A]
    165 # N32:                                #   fixup A - offset: 0, value: %got_disp($tmp0), kind:   fixup_Mips_GOT_DISP
    166 
    167 # N64: ld  $25, %got_disp($tmp0)($gp) # encoding: [0xdf,0x99,A,A]
    168 # N64:                                #   fixup A - offset: 0, value: %got_disp($tmp0), kind:   fixup_Mips_GOT_DISP
    169 
    170 # O32-MICROMIPS: lw    $25, %got($tmp0)($gp)    # encoding: [0xff,0x3c,A,A]
    171 # O32-MICROMIPS:                                #   fixup A - offset: 0, value: %got($tmp0), kind: fixup_MICROMIPS_GOT16
    172 # O32-MICROMIPS: addiu $25, $25, %lo($tmp0)     # encoding: [0x33,0x39,A,A]
    173 # O32-MICROMIPS:                                #   fixup A - offset: 0, value: %lo($tmp0), kind: fixup_MICROMIPS_LO16
    174 
    175 # N32-MICROMIPS: lw  $25, %got_disp($tmp0)($gp) # encoding: [0xff,0x3c,A,A]
    176 # N32-MICROMIPS:                                #   fixup A - offset: 0, value: %got_disp($tmp0), kind: fixup_MICROMIPS_GOT_DISP
    177 
    178 # N64-MICROMIPS: ld  $25, %got_disp($tmp0)($gp) # encoding: [0xdf,0x99,A,A]
    179 # N64-MICROMIPS:                                #   fixup A - offset: 0, value: %got_disp($tmp0), kind: fixup_MICROMIPS_GOT_DISP
    180 
    181 # NORMAL:    jalr $25      # encoding: [0x03,0x20,0xf8,0x09]
    182 # MICROMIPS: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
    183 # ALL:       nop           # encoding: [0x00,0x00,0x00,0x00]
    184