Daniel Sanders 8ce13cfc08 [mips] Add tests for the 'ret', 'call', and 'indirectbr' LLVM IR instruction.
Summary:
The tests in this directory are intended to test a single IR instruction
with as few dependencies on other instructions as possible. The aim is to
be very confident that each LLVM-IR instruction is implemented correctly and
with the optimal sequence of instructions, as well as to make it easy to tell
what is tested, and make it easier to bring up new ISA revisions in the
future. This gives us a good foundation on which to test bigger things.

These particular tests will allow testing that MIPS32r6/MIPS64r6 generate
the correct return instruction for returns, calls, and indirect branches.
This will be a bit tricky since the assembly text is identical but the
instruction is actually different. On MIPS32r6/MIPS64r6 'jr $rs' has been
removed in favour of the equivalent 'jalr $zero, $rs'. 'jr $rs' remains as
an alias for 'jalr $zero, $rs'.

Differential Revision: http://reviews.llvm.org/D4266


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212345 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-04 15:16:14 +00:00

28 lines
782 B
LLVM

; Test all important variants of the unconditional 'br' instruction.
; RUN: llc -march=mips -mcpu=mips32 < %s | FileCheck %s -check-prefix=ALL
; RUN: llc -march=mips -mcpu=mips32r2 < %s | FileCheck %s -check-prefix=ALL
; RUN: llc -march=mips64 -mcpu=mips4 < %s | FileCheck %s -check-prefix=ALL
; RUN: llc -march=mips64 -mcpu=mips64 < %s | FileCheck %s -check-prefix=ALL
; RUN: llc -march=mips64 -mcpu=mips64r2 < %s | FileCheck %s -check-prefix=ALL
define i32 @br(i8 *%addr) {
; ALL-LABEL: br:
; ALL: jr $4
; ALL: $BB0_1: # %L1
; ALL: jr $ra
; ALL: addiu $2, $zero, 0
; ALL: $BB0_2: # %L2
; ALL: jr $ra
; ALL: addiu $2, $zero, 1
entry:
indirectbr i8* %addr, [label %L1, label %L2]
L1:
ret i32 0
L2:
ret i32 1
}