1 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 --position-independent -show-encoding | \ 2 # RUN: FileCheck %s 3 4 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 --position-independent -filetype=obj -o -| \ 5 # RUN: llvm-objdump -d -r - | FileCheck %s -check-prefix=CHECK-FOR-STORE 6 7 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 -mattr=+micromips --position-independent -show-encoding | \ 8 # RUN: FileCheck %s -check-prefix=MICROMIPS 9 10 # RUN: llvm-mc %s -arch=mips -mcpu=mips32 -show-encoding | \ 11 # RUN: FileCheck %s -check-prefix=NO-PIC 12 13 # RUN: llvm-mc %s -arch=mips -mcpu=mips64 -target-abi n32 --position-independent -show-encoding | \ 14 # RUN: FileCheck %s -check-prefixes=BAD-ABI,BAD-ABI-N32 15 16 # RUN: llvm-mc %s -arch=mips64 -mcpu=mips64 -target-abi n64 --position-independent -show-encoding | \ 17 # RUN: FileCheck %s -check-prefixes=BAD-ABI,BAD-ABI-N64 18 19 .text 20 .ent foo 21 foo: 22 .frame $sp, 0, $ra 23 .set noreorder 24 25 .cpload $25 26 .cprestore 8 27 28 jal $25 29 jal $4, $25 30 jal foo 31 32 .end foo 33 34 # CHECK-FOR-STORE: sw $gp, 8($sp) 35 36 # CHECK: .cprestore 8 37 # CHECK: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 38 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 39 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 40 41 # CHECK: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09] 42 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 43 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 44 45 # CHECK: lw $25, %got(foo)($gp) # encoding: [0x8f,0x99,A,A] 46 # CHECK: # fixup A - offset: 0, value: %got(foo), kind: fixup_Mips_GOT 47 # CHECK: addiu $25, $25, %lo(foo) # encoding: [0x27,0x39,A,A] 48 # CHECK: # fixup A - offset: 0, value: %lo(foo), kind: fixup_Mips_LO16 49 # CHECK: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 50 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 51 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 52 # CHECK: .end foo 53 54 # MICROMIPS: .cprestore 8 55 # MICROMIPS: jalrs16 $25 # encoding: [0x45,0xf9] 56 # MICROMIPS: nop # encoding: [0x00,0x00,0x00,0x00] 57 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08] 58 59 # MICROMIPS: jalrs $4, $25 # encoding: [0x00,0x99,0x4f,0x3c] 60 # MICROMIPS: nop # encoding: [0x00,0x00,0x00,0x00] 61 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08] 62 63 # MICROMIPS: lw $25, %got(foo)($gp) # encoding: [0xff,0x3c,A,A] 64 # MICROMIPS: # fixup A - offset: 0, value: %got(foo), kind: fixup_MICROMIPS_GOT16 65 # MICROMIPS: addiu $25, $25, %lo(foo) # encoding: [0x33,0x39,A,A] 66 # MICROMIPS: # fixup A - offset: 0, value: %lo(foo), kind: fixup_MICROMIPS_LO16 67 # MICROMIPS: jalrs $ra, $25 # encoding: [0x03,0xf9,0x4f,0x3c] 68 # MICROMIPS: nop # encoding: [0x0c,0x00] 69 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08] 70 # MICROMIPS: .end foo 71 72 # NO-PIC: .cprestore 8 73 # NO-PIC: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 74 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 75 76 # NO-PIC: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09] 77 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 78 79 # NO-PIC: jal foo # encoding: [0b000011AA,A,A,A] 80 # NO-PIC: # fixup A - offset: 0, value: foo, kind: fixup_Mips_26 81 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 82 # NO-PIC: .end foo 83 84 # BAD-ABI: .cprestore 8 85 # BAD-ABI: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 86 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 87 88 # BAD-ABI: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09] 89 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 90 91 # BAD-ABI-N32: lw $25, %got_disp(foo)($gp) # encoding: [0x8f,0x99,A,A] 92 # BAD-ABI-N64: ld $25, %got_disp(foo)($gp) # encoding: [0xdf,0x99,A,A] 93 # BAD-ABI: # fixup A - offset: 0, value: %got_disp(foo), kind: fixup_Mips_GOT_DISP 94 # BAD-ABI: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 95 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 96 # BAD-ABI: .end foo 97