blob: c819bf59ace6bb41a7647ca000a6987113014bff [file] [log] [blame]
Simon Dardis8d8f2f82016-05-17 10:21:43 +00001; Check that -mips-compact-branches={never,optimal,always} is accepted and honoured.
2; RUN: llc -march=mips -mcpu=mips32r6 -mips-compact-branches=never < %s | FileCheck %s -check-prefix=NEVER
3; RUN: llc -march=mips -mcpu=mips32r6 -mips-compact-branches=optimal < %s | FileCheck %s -check-prefix=OPTIMAL
4; RUN: llc -march=mips -mcpu=mips32r6 -mips-compact-branches=always < %s | FileCheck %s -check-prefix=ALWAYS
5
6define i32 @l(i32 signext %a, i32 signext %b) {
7entry:
8 %add = add nsw i32 %b, %a
9 %cmp = icmp slt i32 %add, 100
10; NEVER: beq
11; OPTIMAL: beq
12; ALWAYS: beqzc
13; This nop is required for correct as having (j|b)al as the instruction
14; immediately following beqzc would cause a forbidden slot hazard.
15; ALWAYS: nop
16 br i1 %cmp, label %if.then, label %if.end
17
18if.then: ; preds = %entry
19 %call = tail call i32 @k()
20 br label %if.end
21
22if.end: ; preds = %entry, %if.then
23 %call.pn = phi i32 [ %call, %if.then ], [ -1, %entry ]
24 %c.0 = add nsw i32 %call.pn, %add
25 ret i32 %c.0
26}
27
28declare i32 @k() #1