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 .cpload $25 25 .set reorder 26 27 .cprestore 8 28 29 jal $25 30 jal $4, $25 31 jal foo 32 33 .end foo 34 35 # CHECK-FOR-STORE: sw $gp, 8($sp) 36 37 # CHECK: .cprestore 8 38 # CHECK: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 39 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 40 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 41 42 # CHECK: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09] 43 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 44 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 45 46 # CHECK: lw $25, %got(foo)($gp) # encoding: [0x8f,0x99,A,A] 47 # CHECK: # fixup A - offset: 0, value: %got(foo), kind: fixup_Mips_GOT 48 # CHECK: addiu $25, $25, %lo(foo) # encoding: [0x27,0x39,A,A] 49 # CHECK: # fixup A - offset: 0, value: %lo(foo), kind: fixup_Mips_LO16 50 # CHECK: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 51 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 52 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 53 # CHECK: .end foo 54 55 # MICROMIPS: .cprestore 8 56 # MICROMIPS: jalrs16 $25 # encoding: [0x45,0xf9] 57 # MICROMIPS: nop # encoding: [0x0c,0x00] 58 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08] 59 60 # MICROMIPS: jalrs $4, $25 # encoding: [0x00,0x99,0x4f,0x3c] 61 # MICROMIPS: nop # encoding: [0x0c,0x00] 62 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08] 63 64 # MICROMIPS: lw $25, %got(foo)($gp) # encoding: [0xff,0x3c,A,A] 65 # MICROMIPS: # fixup A - offset: 0, value: %got(foo), kind: fixup_MICROMIPS_GOT16 66 # MICROMIPS: addiu $25, $25, %lo(foo) # encoding: [0x33,0x39,A,A] 67 # MICROMIPS: # fixup A - offset: 0, value: %lo(foo), kind: fixup_MICROMIPS_LO16 68 # MICROMIPS: jalrs $ra, $25 # encoding: [0x03,0xf9,0x4f,0x3c] 69 # MICROMIPS: nop # encoding: [0x0c,0x00] 70 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08] 71 # MICROMIPS: .end foo 72 73 # NO-PIC: .cprestore 8 74 # NO-PIC: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 75 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 76 77 # NO-PIC: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09] 78 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 79 80 # NO-PIC: jal foo # encoding: [0b000011AA,A,A,A] 81 # NO-PIC: # fixup A - offset: 0, value: foo, kind: fixup_Mips_26 82 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 83 # NO-PIC: .end foo 84 85 # BAD-ABI: .cprestore 8 86 # BAD-ABI: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 87 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 88 89 # BAD-ABI: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09] 90 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 91 92 # BAD-ABI-N32: lw $25, %got_disp(foo)($gp) # encoding: [0x8f,0x99,A,A] 93 # BAD-ABI-N64: ld $25, %got_disp(foo)($gp) # encoding: [0xdf,0x99,A,A] 94 # BAD-ABI: # fixup A - offset: 0, value: %got_disp(foo), kind: fixup_Mips_GOT_DISP 95 # BAD-ABI: jalr $25 # encoding: [0x03,0x20,0xf8,0x09] 96 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08] 97 # BAD-ABI: .end foo 98