• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc -show-encoding -triple mips-unknown-unknown %s \
2# RUN:  | FileCheck %s -check-prefix=CHECK-ENC
3
4# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s \
5# RUN:  | llvm-objdump -disassemble - | FileCheck %s -check-prefix=CHECK-INSTR
6
7# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s \
8# RUN:  | llvm-readobj -r | FileCheck %s -check-prefix=CHECK-REL
9
10
11# Check that 1 is added to the high 16 bits if bit 15 of the low part is 1.
12
13        .equ    addr, 0xdeadbeef
14        lui     $4, %hi(addr)
15        lb      $2, %lo(addr)($4)
16# CHECK-ENC: # encoding: [0x3c,0x04,0xde,0xae]
17# CHECK-ENC: # encoding: [0x80,0x82,0xbe,0xef]
18
19
20# Check that assembler can handle %hi(label1 - label2) and %lo(label1 - label2)
21# expressions.
22
23$L1:
24        # Emit zeros so that difference between $L3 and $L1 is 0x30124 bytes.
25        .fill 0x30124-8
26$L2:
27        lui     $4, %hi($L3-$L1)
28        addiu   $4, $4, %lo($L3-$L1)
29# CHECK-INSTR:    lui     $4, 3
30# CHECK-INSTR:    addiu   $4, $4, 292
31
32$L3:
33        lui     $5, %hi($L2-$L3)
34        lw      $5, %lo($L2-$L3)($5)
35# CHECK-INSTR:    lui     $5, 0
36# CHECK-INSTR:    lw      $5, -8($5)
37
38
39# Check that relocation isn't emitted for %hi(label1 - label2) and
40# %lo(label1 - label2) expressions.
41
42# CHECK-REL-NOT:    R_MIPS
43