blob: 26c02edee5124f3f1376c1c97bd0e934c4640432 [file] [log] [blame]
Daniel Sanders20c82ee42014-07-04 15:16:14 +00001; Test all important variants of the unconditional 'br' instruction.
2
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +00003; RUN: llc -march=mips -mcpu=mips32 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
4; RUN: llc -march=mips -mcpu=mips32r2 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
Daniel Sanders17793142015-02-18 16:24:50 +00005; RUN: llc -march=mips -mcpu=mips32r3 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
6; RUN: llc -march=mips -mcpu=mips32r5 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
Simon Dardisd9d41f52016-04-05 12:50:29 +00007; RUN: llc -march=mips -mcpu=mips32r6 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=R6C
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +00008; RUN: llc -march=mips64 -mcpu=mips4 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
9; RUN: llc -march=mips64 -mcpu=mips64 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
10; RUN: llc -march=mips64 -mcpu=mips64r2 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
Daniel Sanders17793142015-02-18 16:24:50 +000011; RUN: llc -march=mips64 -mcpu=mips64r3 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
12; RUN: llc -march=mips64 -mcpu=mips64r5 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=NOT-R6
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +000013; RUN: llc -march=mips64 -mcpu=mips64r6 -asm-show-inst < %s | FileCheck %s -check-prefix=ALL -check-prefix=R6
Daniel Sanders20c82ee42014-07-04 15:16:14 +000014
15define i32 @br(i8 *%addr) {
16; ALL-LABEL: br:
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +000017; NOT-R6: jr $4 # <MCInst #{{[0-9]+}} JR
Simon Dardis53a34922016-04-14 13:43:17 +000018; R6C: jrc $4 # <MCInst #{{[0-9]+}} JIC
Simon Dardisd9d41f52016-04-05 12:50:29 +000019
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +000020
Daniel Sanders69c60082015-05-20 14:18:59 +000021; ALL: $BB0_1: # %L1
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +000022; NOT-R6: jr $ra # <MCInst #{{[0-9]+}} JR
23; R6: jr $ra # <MCInst #{{[0-9]+}} JALR
Simon Dardisd9d41f52016-04-05 12:50:29 +000024; R6C: jr $ra # <MCInst #{{[0-9]+}} JALR
Daniel Sanders20c82ee42014-07-04 15:16:14 +000025; ALL: addiu $2, $zero, 0
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +000026
Daniel Sanders69c60082015-05-20 14:18:59 +000027; ALL: $BB0_2: # %L2
Daniel Sandersf5a5fbd2014-07-09 10:21:59 +000028; NOT-R6: jr $ra # <MCInst #{{[0-9]+}} JR
29; R6: jr $ra # <MCInst #{{[0-9]+}} JALR
Simon Dardisd9d41f52016-04-05 12:50:29 +000030; R6C: jr $ra # <MCInst #{{[0-9]+}} JALR
Daniel Sanders20c82ee42014-07-04 15:16:14 +000031; ALL: addiu $2, $zero, 1
32
33entry:
34 indirectbr i8* %addr, [label %L1, label %L2]
35
36L1:
37 ret i32 0
38
39L2:
40 ret i32 1
41}