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.
18 ; Function Attrs: noinline nounwind optnone
19 define void @foo() #0 {
21 ; MIPS32: # %bb.0: # %entry
22 ; MIPS32-NEXT: addiu $sp, $sp, -24
23 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
24 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
25 ; MIPS32-NEXT: .cfi_offset 31, -4
26 ; MIPS32-NEXT: move $1, $ra
27 ; MIPS32-NEXT: jal _mcount
28 ; MIPS32-NEXT: addiu $sp, $sp, -8
29 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
31 ; MIPS32-NEXT: addiu $sp, $sp, 24
33 ; MIPS32-PIC-LABEL: foo:
34 ; MIPS32-PIC: # %bb.0: # %entry
35 ; MIPS32-PIC-NEXT: lui $2, %hi(_gp_disp)
36 ; MIPS32-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
37 ; MIPS32-PIC-NEXT: addiu $sp, $sp, -24
38 ; MIPS32-PIC-NEXT: .cfi_def_cfa_offset 24
39 ; MIPS32-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
40 ; MIPS32-PIC-NEXT: .cfi_offset 31, -4
41 ; MIPS32-PIC-NEXT: addu $gp, $2, $25
42 ; MIPS32-PIC-NEXT: lw $25, %call16(_mcount)($gp)
43 ; MIPS32-PIC-NEXT: move $1, $ra
44 ; MIPS32-PIC-NEXT: .reloc ($tmp0), R_MIPS_JALR, _mcount
45 ; MIPS32-PIC-NEXT: $tmp0:
46 ; MIPS32-PIC-NEXT: jalr $25
47 ; MIPS32-PIC-NEXT: addiu $sp, $sp, -8
48 ; MIPS32-PIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
49 ; MIPS32-PIC-NEXT: jr $ra
50 ; MIPS32-PIC-NEXT: addiu $sp, $sp, 24
53 ; MIPS64: # %bb.0: # %entry
54 ; MIPS64-NEXT: daddiu $sp, $sp, -16
55 ; MIPS64-NEXT: .cfi_def_cfa_offset 16
56 ; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
57 ; MIPS64-NEXT: .cfi_offset 31, -8
58 ; MIPS64-NEXT: move $1, $ra
59 ; MIPS64-NEXT: jal _mcount
61 ; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
63 ; MIPS64-NEXT: daddiu $sp, $sp, 16
65 ; MIPS64-PIC-LABEL: foo:
66 ; MIPS64-PIC: # %bb.0: # %entry
67 ; MIPS64-PIC-NEXT: daddiu $sp, $sp, -16
68 ; MIPS64-PIC-NEXT: .cfi_def_cfa_offset 16
69 ; MIPS64-PIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
70 ; MIPS64-PIC-NEXT: sd $gp, 0($sp) # 8-byte Folded Spill
71 ; MIPS64-PIC-NEXT: .cfi_offset 31, -8
72 ; MIPS64-PIC-NEXT: .cfi_offset 28, -16
73 ; MIPS64-PIC-NEXT: lui $1, %hi(%neg(%gp_rel(foo)))
74 ; MIPS64-PIC-NEXT: daddu $1, $1, $25
75 ; MIPS64-PIC-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(foo)))
76 ; MIPS64-PIC-NEXT: ld $25, %call16(_mcount)($gp)
77 ; MIPS64-PIC-NEXT: move $1, $ra
78 ; MIPS64-PIC-NEXT: .reloc .Ltmp0, R_MIPS_JALR, _mcount
79 ; MIPS64-PIC-NEXT: .Ltmp0:
80 ; MIPS64-PIC-NEXT: jalr $25
81 ; MIPS64-PIC-NEXT: nop
82 ; MIPS64-PIC-NEXT: ld $gp, 0($sp) # 8-byte Folded Reload
83 ; MIPS64-PIC-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
84 ; MIPS64-PIC-NEXT: jr $ra
85 ; MIPS64-PIC-NEXT: daddiu $sp, $sp, 16
87 ; MIPS32-MM-LABEL: foo:
88 ; MIPS32-MM: # %bb.0: # %entry
89 ; MIPS32-MM-NEXT: addiu $sp, $sp, -24
90 ; MIPS32-MM-NEXT: .cfi_def_cfa_offset 24
91 ; MIPS32-MM-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
92 ; MIPS32-MM-NEXT: .cfi_offset 31, -4
93 ; MIPS32-MM-NEXT: move $1, $ra
94 ; MIPS32-MM-NEXT: jal _mcount
95 ; MIPS32-MM-NEXT: addiu $sp, $sp, -8
96 ; MIPS32-MM-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
97 ; MIPS32-MM-NEXT: jr $ra
98 ; MIPS32-MM-NEXT: addiu $sp, $sp, 24
100 ; MIPS32-MM-PIC-LABEL: foo:
101 ; MIPS32-MM-PIC: # %bb.0: # %entry
102 ; MIPS32-MM-PIC-NEXT: lui $2, %hi(_gp_disp)
103 ; MIPS32-MM-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
104 ; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, -24
105 ; MIPS32-MM-PIC-NEXT: .cfi_def_cfa_offset 24
106 ; MIPS32-MM-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
107 ; MIPS32-MM-PIC-NEXT: .cfi_offset 31, -4
108 ; MIPS32-MM-PIC-NEXT: addu $2, $2, $25
109 ; MIPS32-MM-PIC-NEXT: lw $25, %call16(_mcount)($2)
110 ; MIPS32-MM-PIC-NEXT: move $gp, $2
111 ; MIPS32-MM-PIC-NEXT: move $1, $ra
112 ; MIPS32-MM-PIC-NEXT: .reloc ($tmp0), R_MICROMIPS_JALR, _mcount
113 ; MIPS32-MM-PIC-NEXT: $tmp0:
114 ; MIPS32-MM-PIC-NEXT: jalr $25
115 ; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, -8
116 ; MIPS32-MM-PIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
117 ; MIPS32-MM-PIC-NEXT: jr $ra
118 ; MIPS32-MM-PIC-NEXT: addiu $sp, $sp, 24
123 attributes #0 = { "instrument-function-entry-inlined"="_mcount" }