Home | History | Annotate | Download | only in Mips
      1 # RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | FileCheck %s
      2 # Check that the assembler can handle the documented syntax
      3 # for macro instructions
      4 #------------------------------------------------------------------------------
      5 # Load immediate instructions
      6 #------------------------------------------------------------------------------
      7 # CHECK: ori     $5, $zero, 123      # encoding: [0x7b,0x00,0x05,0x34]
      8 # CHECK: addiu   $6, $zero, -2345    # encoding: [0xd7,0xf6,0x06,0x24]
      9 # CHECK: lui     $7, 1               # encoding: [0x01,0x00,0x07,0x3c]
     10 # CHECK: ori     $7, $7, 2           # encoding: [0x02,0x00,0xe7,0x34]
     11 # CHECK: addiu   $8, $zero, -8       # encoding: [0xf8,0xff,0x08,0x24]
     12 
     13 # CHECK: addiu   $4, $zero, 20       # encoding: [0x14,0x00,0x04,0x24]
     14 # CHECK: lui     $7, 1               # encoding: [0x01,0x00,0x07,0x3c]
     15 # CHECK: ori     $7, $7, 2           # encoding: [0x02,0x00,0xe7,0x34]
     16 # CHECK: addiu   $4, $5, 20          # encoding: [0x14,0x00,0xa4,0x24]
     17 # CHECK: lui     $7, 1               # encoding: [0x01,0x00,0x07,0x3c]
     18 # CHECK: ori     $7, $7, 2           # encoding: [0x02,0x00,0xe7,0x34]
     19 # CHECK: addu    $7, $7, $8          # encoding: [0x21,0x38,0xe8,0x00]
     20 # CHECK: lui     $8, %hi(symbol)     # encoding: [A,A,0x08,0x3c]
     21                                      #   fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
     22 # CHECK: ori     $8, $8, %lo(symbol) # encoding: [A,A,0x08,0x35]
     23                                      #   fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
     24 # CHECK: .set    mips64
     25 # CHECK: lui     $8, %highest(symbol)    # encoding: [A,A,0x08,0x3c]
     26                                          #   fixup A - offset: 0, value: symbol@HIGHEST, kind: fixup_Mips_HIGHEST
     27 # CHECK: ori     $8, $8, %higher(symbol) # encoding: [A,A,0x08,0x35]
     28                                          #   fixup A - offset: 0, value: symbol@HIGHER, kind: fixup_Mips_HIGHER
     29 # CHECK: dsll    $8, $8, 16              # encoding: [0x38,0x44,0x08,0x00]
     30 # CHECK: ori     $8, $8, %hi(symbol)     # encoding: [A,A,0x08,0x35]
     31                                          #   fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
     32 # CHECK: dsll    $8, $8, 16              # encoding: [0x38,0x44,0x08,0x00]
     33 # CHECK: ori     $8, $8, %lo(symbol)     # encoding: [A,A,0x08,0x35]
     34                                          #   fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
     35 # CHECK: .set    mips32r2
     36 # CHECK: lui     $10, %hi(symbol)        # encoding: [A,A,0x0a,0x3c]
     37 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
     38 # CHECK: addu    $10, $10, $4            # encoding: [0x21,0x50,0x44,0x01]
     39 # CHECK: lw      $10, %lo(symbol)($10)   # encoding: [A,A,0x4a,0x8d]
     40 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
     41 # CHECK: lui     $1, %hi(symbol)         # encoding: [A,A,0x01,0x3c]
     42 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
     43 # CHECK: addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
     44 # CHECK: sw      $10, %lo(symbol)($1)    # encoding: [A,A,0x2a,0xac]
     45 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
     46 # CHECK: lui     $10, 10                 # encoding: [0x0a,0x00,0x0a,0x3c]
     47 # CHECK: addu    $10, $10, $4            # encoding: [0x21,0x50,0x44,0x01]
     48 # CHECK: lw      $10, 123($10)           # encoding: [0x7b,0x00,0x4a,0x8d]
     49 # CHECK: lui     $1, 2                   # encoding: [0x02,0x00,0x01,0x3c]
     50 # CHECK: addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
     51 # CHECK: sw      $10, 57920($1)          # encoding: [0x40,0xe2,0x2a,0xac]
     52 
     53 # CHECK:     lui     $8, %hi(symbol)     # encoding: [A,A,0x08,0x3c]
     54 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
     55 # CHECK-NOT: move    $8, $8              # encoding: [0x21,0x40,0x00,0x01]
     56 # CHECK:     lw      $8, %lo(symbol)($8) # encoding: [A,A,0x08,0x8d]
     57 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
     58 # CHECK:     lui     $1, %hi(symbol)     # encoding: [A,A,0x01,0x3c]
     59 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
     60 # CHECK-NOT: move    $1, $1              # encoding: [0x21,0x08,0x20,0x00]
     61 # CHECK:     sw      $8, %lo(symbol)($1) # encoding: [A,A,0x28,0xac]
     62 # CHECK:                                 #   fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
     63 
     64 # CHECK: lui     $1, %hi(symbol)
     65 # CHECK: ldc1    $f0, %lo(symbol)($1)
     66 # CHECK: lui     $1, %hi(symbol)
     67 # CHECK: sdc1    $f0, %lo(symbol)($1)
     68 
     69     li $5,123
     70     li $6,-2345
     71     li $7,65538
     72     li $8, ~7
     73 
     74     la $a0, 20
     75     la $7,65538
     76     la $a0, 20($a1)
     77     la $7,65538($8)
     78     la $t0, symbol
     79     .set mips64
     80     la $t0, symbol
     81     .set mips32r2
     82 
     83     .set noat
     84     lw  $t2, symbol($a0)
     85     .set at
     86     sw  $t2, symbol($t1)
     87 
     88     lw  $t2, 655483($a0)
     89     sw  $t2, 123456($t1)
     90 
     91     lw  $8, symbol
     92     sw  $8, symbol
     93 
     94     ldc1 $f0, symbol
     95     sdc1 $f0, symbol
     96