1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding \ 2# RUN: -mattr=micromips | FileCheck %s -check-prefix=CHECK-FIXUP 3# RUN: llvm-mc %s -filetype=obj -triple=mipsel-unknown-linux \ 4# RUN: -mattr=micromips | llvm-readobj -r \ 5# RUN: | FileCheck %s -check-prefix=CHECK-ELF 6#------------------------------------------------------------------------------ 7# Check that the assembler can handle the documented syntax 8# for relocations. 9#------------------------------------------------------------------------------ 10# CHECK-FIXUP: beqz16 $6, bar # encoding: [0b0AAAAAAA,0x8f] 11# CHECK-FIXUP: # fixup A - offset: 0, 12# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC7_S1 13# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 14# CHECK-FIXUP: bnez16 $6, bar # encoding: [0b0AAAAAAA,0xaf] 15# CHECK-FIXUP: # fixup A - offset: 0, 16# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC7_S1 17# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 18# CHECK-FIXUP: b16 bar # encoding: [A,0b110011AA] 19# CHECK-FIXUP: # fixup A - offset: 0, 20# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC10_S1 21# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 22# CHECK-FIXUP: b bar # encoding: [A,0x94'A',0x00,0x00] 23# CHECK-FIXUP: # fixup A - offset: 0, 24# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 25# CHECK-FIXUP: nop # encoding: [0x00,0x0c] 26# CHECK-FIXUP: beq $3, $4, bar # encoding: [0x83'A',0x94'A',0x00,0x00] 27# CHECK-FIXUP: # fixup A - offset: 0, 28# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 29# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 30# CHECK-FIXUP: bne $3, $4, bar # encoding: [0x83'A',0xb4'A',0x00,0x00] 31# CHECK-FIXUP: # fixup A - offset: 0, 32# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 33# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 34# CHECK-FIXUP: bgez $4, bar # encoding: [0x44'A',0x40'A',0x00,0x00] 35# CHECK-FIXUP: # fixup A - offset: 0, 36# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 37# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 38# CHECK-FIXUP: bgtz $4, bar # encoding: [0xc4'A',0x40'A',0x00,0x00] 39# CHECK-FIXUP: # fixup A - offset: 0, 40# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 41# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 42# CHECK-FIXUP: blez $4, bar # encoding: [0x84'A',0x40'A',0x00,0x00] 43# CHECK-FIXUP: # fixup A - offset: 0, 44# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 45# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 46# CHECK-FIXUP: bltz $4, bar # encoding: [0x04'A',0x40'A',0x00,0x00] 47# CHECK-FIXUP: # fixup A - offset: 0, 48# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 49# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 50# CHECK-FIXUP: bgezal $4, bar # encoding: [0x64'A',0x40'A',0x00,0x00] 51# CHECK-FIXUP: # fixup A - offset: 0, 52# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 53# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 54# CHECK-FIXUP: bltzal $4, bar # encoding: [0x24'A',0x40'A',0x00,0x00] 55# CHECK-FIXUP: # fixup A - offset: 0, 56# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 57# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] 58#------------------------------------------------------------------------------ 59# Check that the appropriate relocations were created. 60#------------------------------------------------------------------------------ 61# CHECK-ELF: Relocations [ 62# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC7_S1 63# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC7_S1 64# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC10_S1 65# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 66# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 67# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 68# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 69# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 70# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 71# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 72# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 73# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 74# CHECK-ELF: ] 75 76 .text 77 .type main, @function 78 .set micromips 79main: 80 beqz16 $6, bar 81 bnez16 $6, bar 82 b16 bar 83 b bar 84 beq $3, $4, bar 85 bne $3, $4, bar 86 bgez $4, bar 87 bgtz $4, bar 88 blez $4, bar 89 bltz $4, bar 90 bgezal $4, bar 91 bltzal $4, bar 92