1# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips64r6 \
2# RUN:   -mattr=micromips | FileCheck %s -check-prefix=CHECK-FIXUP
3# RUN: llvm-mc %s -filetype=obj -triple=mips-unknown-linux -mcpu=mips64r6 \
4# RUN:   -mattr=micromips | llvm-readobj -r | FileCheck %s -check-prefix=CHECK-ELF
5#------------------------------------------------------------------------------
6# Check that the assembler can handle the documented syntax for fixups.
7#------------------------------------------------------------------------------
8# CHECK-FIXUP: balc  bar        # encoding: [0b101101AA,A,A,A]
9# CHECK-FIXUP:                  #   fixup A - offset: 0,
10# CHECK-FIXUP:                      value: bar-4, kind: fixup_MICROMIPS_PC26_S1
11# CHECK-FIXUP: bc    bar        # encoding: [0b100101AA,A,A,A]
12# CHECK-FIXUP:                  #   fixup A - offset: 0,
13# CHECK-FIXUP:                      value: bar-4, kind: fixup_MICROMIPS_PC26_S1
14# CHECK-FIXUP: addiupc $2, bar  # encoding: [0x78,0b01000AAA,A,A]
15# CHECK-FIXUP:                  #   fixup A - offset: 0,
16# CHECK-FIXUP:                      value: bar, kind: fixup_MICROMIPS_PC19_S2
17# CHECK-FIXUP: lwpc    $2,  bar # encoding: [0x78,0b01001AAA,A,A]
18# CHECK-FIXUP:                  #   fixup A - offset: 0,
19# CHECK-FIXUP:                      value: bar, kind: fixup_MICROMIPS_PC19_S2
20# CHECK-FIXUP: ldpc  $2, bar    # encoding: [0x78,0b010110AA,A,A]
21# CHECK-FIXUP:                  #   fixup A - offset: 0,
22# CHECK-FIXUP:                      value: bar, kind: fixup_MICROMIPS_PC18_S3
23# CHECK-FIXUP: beqzc $3, bar        # encoding: [0x80,0b011AAAAA,A,A]
24# CHECK-FIXUP:                      #   fixup A - offset: 0,
25# CHECK-FIXUP:                          value: bar-4, kind: fixup_MICROMIPS_PC21_S1
26# CHECK-FIXUP: bnezc $3, bar        # encoding: [0xa0,0b011AAAAA,A,A]
27# CHECK-FIXUP:                      #   fixup A - offset: 0,
28# CHECK-FIXUP:                          value: bar-4, kind: fixup_MICROMIPS_PC21_S1
29#------------------------------------------------------------------------------
30# Check that the appropriate relocations were created.
31#------------------------------------------------------------------------------
32# CHECK-ELF: Relocations [
33# CHECK-ELF:     0x0 R_MICROMIPS_PC26_S1 bar 0x0
34# CHECK-ELF:     0x4 R_MICROMIPS_PC26_S1 bar 0x0
35# CHECK-ELF:     0x8 R_MICROMIPS_PC19_S2 bar 0x0
36# CHECK-ELF:     0xC R_MICROMIPS_PC19_S2 bar 0x0
37# CHECK-ELF:     0x10 R_MICROMIPS_PC18_S3 bar 0x0
38# CHECK-ELF:     0x14 R_MICROMIPS_PC21_S1 bar 0x0
39# CHECK-ELF:     0x18 R_MICROMIPS_PC21_S1 bar 0x0
40# CHECK-ELF: ]
41
42  balc  bar
43  bc    bar
44  addiupc $2,bar
45  lwpc    $2,bar
46  ldpc  $2, bar
47  beqzc  $3, bar
48  bnezc  $3, bar
49