diff options
-rw-r--r-- | llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp | 6 | ||||
-rw-r--r-- | llvm/test/CodeGen/Mips/mcount.ll | 22 |
2 files changed, 17 insertions, 11 deletions
diff --git a/llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp b/llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp index 65afb3650f8..c8313240a67 100644 --- a/llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp +++ b/llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp @@ -129,9 +129,9 @@ void MipsSEDAGToDAGISel::emitMCountABI(MachineInstr &MI, MachineBasicBlock &MBB, MachineInstrBuilder MIB(MF, &MI); if (!Subtarget->isABI_O32()) { // N32, N64 // Save current return address. - BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::OR)) + BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::OR64)) .addDef(Mips::AT_64) - .addUse(Mips::RA_64) + .addUse(Mips::RA_64, RegState::Undef) .addUse(Mips::ZERO_64); // Stops instruction above from being removed later on. MIB.addUse(Mips::AT_64, RegState::Implicit); @@ -139,7 +139,7 @@ void MipsSEDAGToDAGISel::emitMCountABI(MachineInstr &MI, MachineBasicBlock &MBB, // Save current return address. BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::OR)) .addDef(Mips::AT) - .addUse(Mips::RA) + .addUse(Mips::RA, RegState::Undef) .addUse(Mips::ZERO); // _mcount pops 2 words from stack. BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::ADDiu)) diff --git a/llvm/test/CodeGen/Mips/mcount.ll b/llvm/test/CodeGen/Mips/mcount.ll index e136ae03da5..fe8cee9d78d 100644 --- a/llvm/test/CodeGen/Mips/mcount.ll +++ b/llvm/test/CodeGen/Mips/mcount.ll @@ -1,11 +1,17 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -march=mips < %s | FileCheck %s -check-prefix=MIPS32 -; RUN: llc -march=mips -relocation-model=pic < %s | FileCheck %s -check-prefix=MIPS32-PIC -; RUN: llc -march=mips64 < %s | FileCheck %s -check-prefix=MIPS64 -; RUN: llc -march=mips64 -relocation-model=pic < %s | FileCheck %s -check-prefix=MIPS64-PIC -; RUN: llc -march=mips -mattr=+micromips < %s | FileCheck %s -check-prefix=MIPS32-MM -; RUN: llc -march=mips -relocation-model=pic -mattr=+micromips < %s | FileCheck %s -check-prefix=MIPS32-MM-PIC +; RUN: llc -march=mips -verify-machineinstrs \ +; RUN: < %s | FileCheck %s -check-prefix=MIPS32 +; RUN: llc -march=mips -verify-machineinstrs -relocation-model=pic \ +; RUN: < %s | FileCheck %s -check-prefix=MIPS32-PIC +; RUN: llc -march=mips64 -verify-machineinstrs \ +; RUN: < %s | FileCheck %s -check-prefix=MIPS64 +; RUN: llc -march=mips64 -verify-machineinstrs -relocation-model=pic \ +; RUN: < %s | FileCheck %s -check-prefix=MIPS64-PIC +; RUN: llc -march=mips -verify-machineinstrs -mattr=+micromips \ +; RUN: < %s | FileCheck %s -check-prefix=MIPS32-MM +; RUN: llc -march=mips -verify-machineinstrs -relocation-model=pic -mattr=+micromips \ +; RUN: < %s | FileCheck %s -check-prefix=MIPS32-MM-PIC ; Test that checks ABI for _mcount calls. @@ -49,7 +55,7 @@ define void @foo() #0 { ; MIPS64-NEXT: .cfi_def_cfa_offset 16 ; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill ; MIPS64-NEXT: .cfi_offset 31, -8 -; MIPS64-NEXT: or $1, $ra, $zero +; MIPS64-NEXT: move $1, $ra ; MIPS64-NEXT: jal _mcount ; MIPS64-NEXT: nop ; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload @@ -68,7 +74,7 @@ define void @foo() #0 { ; MIPS64-PIC-NEXT: daddu $1, $1, $25 ; MIPS64-PIC-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(foo))) ; MIPS64-PIC-NEXT: ld $25, %call16(_mcount)($gp) -; MIPS64-PIC-NEXT: or $1, $ra, $zero +; MIPS64-PIC-NEXT: move $1, $ra ; MIPS64-PIC-NEXT: .reloc .Ltmp0, R_MIPS_JALR, _mcount ; MIPS64-PIC-NEXT: .Ltmp0: ; MIPS64-PIC-NEXT: jalr $25 |