1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 ; RUN: llc -march=mips -verify-machineinstrs \
4 ; RUN: < %s | FileCheck %s -check-prefix=MIPS32
5 ; RUN: llc -march=mips -verify-machineinstrs -relocation-model=pic \
6 ; RUN: < %s | FileCheck %s -check-prefix=MIPS32-PIC
7 ; RUN: llc -march=mips64 -verify-machineinstrs \
8 ; RUN: < %s | FileCheck %s -check-prefix=MIPS64
9 ; RUN: llc -march=mips64 -verify-machineinstrs -relocation-model=pic \
10 ; RUN: < %s | FileCheck %s -check-prefix=MIPS64-PIC
11 ; RUN: llc -march=mips -verify-machineinstrs -mattr=+micromips \
12 ; RUN: < %s | FileCheck %s -check-prefix=MIPS32-MM
13 ; RUN: llc -march=mips -verify-machineinstrs -relocation-model=pic -mattr=+micromips \
14 ; RUN: < %s | FileCheck %s -check-prefix=MIPS32-MM-PIC
16 ; Test that checks ABI for _mcount calls.
20 ; MIPS32: # %bb.0: # %entry
21 ; MIPS32-NEXT: addiu $sp, $sp, -24
22 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
23 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
24 ; MIPS32-NEXT: .cfi_offset 31, -4
25 ; MIPS32-NEXT: move $1, $ra
26 ; MIPS32-NEXT: jal _mcount
27 ; MIPS32-NEXT: addiu $sp, $sp, -8
28 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
30 ; MIPS32-NEXT: addiu $sp, $sp, 24
32 ; MIPS32-PIC-LABEL: foo:
33 ; MIPS32-PIC: # %bb.0: # %entry
34 ; MIPS32-PIC-NEXT: lui $2, %hi(_gp_disp)
35 ; MIPS32-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
36 ; MIPS32-PIC-NEXT: addiu $sp, $sp, -24
37 ; MIPS32-PIC-NEXT: .cfi_def_cfa_offset 24
38 ; MIPS32-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
39 ; MIPS32-PIC-NEXT: .cfi_offset 31, -4
40 ; MIPS32-PIC-NEXT: addu $gp, $2, $25
41 ; MIPS32-PIC-NEXT: lw $25, %call16(_mcount)($gp)
42 ; MIPS32-PIC-NEXT: move $1, $ra
43 ; MIPS32-PIC-NEXT: .reloc ($tmp0), R_MIPS_JALR, _mcount
44 ; MIPS32-PIC-NEXT: $tmp0:
45 ; MIPS32-PIC-NEXT: jalr $25
46 ; MIPS32-PIC-NEXT: addiu $sp, $sp, -8
47 ; MIPS32-PIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
48 ; MIPS32-PIC-NEXT: jr $ra
49 ; MIPS32-PIC-NEXT: addiu $sp, $sp, 24
52 ; MIPS64: # %bb.0: # %entry
53 ; MIPS64-NEXT: daddiu $sp, $sp, -16
54 ; MIPS64-NEXT: .cfi_def_cfa_offset 16
55 ; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
56 ; MIPS64-NEXT: .cfi_offset 31, -8
57 ; MIPS64-NEXT: move $1, $ra
58 ; MIPS64-NEXT: jal _mcount
60 ; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
62 ; MIPS64-NEXT: daddiu $sp, $sp, 16
64 ; MIPS64-PIC-LABEL: foo:
65 ; MIPS64-PIC: # %bb.0: # %entry
66 ; MIPS64-PIC-NEXT: daddiu $sp, $sp, -16
67 ; MIPS64-PIC-NEXT: .cfi_def_cfa_offset 16
68 ; MIPS64-PIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
69 ; MIPS64-PIC-NEXT: sd $gp, 0($sp) # 8-byte Folded Spill
70 ; MIPS64-PIC-NEXT: .cfi_offset 31, -8
71 ; MIPS64-PIC-NEXT: .cfi_offset 28, -16
72 ; MIPS64-PIC-NEXT: lui $1, %hi(%neg(%gp_rel(foo)))
73 ; MIPS64-PIC-NEXT: daddu $1, $1, $25
74 ; MIPS64-PIC-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(foo)))
75 ; MIPS64-PIC-NEXT: ld $25, %call16(_mcount)($gp)
76 ; MIPS64-PIC-NEXT: move $1, $ra
77 ; MIPS64-PIC-NEXT: .reloc .Ltmp0, R_MIPS_JALR, _mcount
78 ; MIPS64-PIC-NEXT: .Ltmp0:
79 ; MIPS64-PIC-NEXT: jalr $25
80 ; MIPS64-PIC-NEXT: nop
81 ; MIPS64-PIC-NEXT: ld $gp, 0($sp) # 8-byte Folded Reload
82 ; MIPS64-PIC-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
83 ; MIPS64-PIC-NEXT: jr $ra
84 ; MIPS64-PIC-NEXT: daddiu $sp, $sp, 16
86 ; MIPS32-MM-LABEL: foo:
87 ; MIPS32-MM: # %bb.0: # %entry
88 ; MIPS32-MM-NEXT: addiu $sp, $sp, -24
89 ; MIPS32-MM-NEXT: .cfi_def_cfa_offset 24
90 ; MIPS32-MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
91 ; MIPS32-MM-NEXT: .cfi_offset 31, -4
92 ; MIPS32-MM-NEXT: move $1, $ra
93 ; MIPS32-MM-NEXT: jal _mcount
94 ; MIPS32-MM-NEXT: addiu $sp, $sp, -8
95 ; MIPS32-MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
96 ; MIPS32-MM-NEXT: jr $ra
97 ; MIPS32-MM-NEXT: addiu $sp, $sp, 24
99 ; MIPS32-MM-PIC-LABEL: foo:
100 ; MIPS32-MM-PIC: # %bb.0: # %entry
101 ; MIPS32-MM-PIC-NEXT: lui $2, %hi(_gp_disp)
102 ; MIPS32-MM-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
103 ; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, -24
104 ; MIPS32-MM-PIC-NEXT: .cfi_def_cfa_offset 24
105 ; MIPS32-MM-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
106 ; MIPS32-MM-PIC-NEXT: .cfi_offset 31, -4
107 ; MIPS32-MM-PIC-NEXT: addu $gp, $2, $25
108 ; MIPS32-MM-PIC-NEXT: lw $25, %call16(_mcount)($gp)
109 ; MIPS32-MM-PIC-NEXT: move $1, $ra
110 ; MIPS32-MM-PIC-NEXT: .reloc ($tmp0), R_MICROMIPS_JALR, _mcount
111 ; MIPS32-MM-PIC-NEXT: $tmp0:
112 ; MIPS32-MM-PIC-NEXT: jalr $25
113 ; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, -8
114 ; MIPS32-MM-PIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
115 ; MIPS32-MM-PIC-NEXT: jr $ra
116 ; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, 24
122 declare void @_mcount()