1; RUN: llc -march=mips -mcpu=mips32   < %s | FileCheck %s -check-prefix=ALL -check-prefix=FCC
2; RUN: llc -march=mips -mcpu=mips32r2 < %s | FileCheck %s -check-prefix=ALL -check-prefix=FCC
3; RUN: llc -march=mips -mcpu=mips32r6 < %s | FileCheck %s -check-prefix=ALL -check-prefix=GPR -check-prefix=32-GPR
4; RUN: llc -march=mips64 -mcpu=mips4    < %s | FileCheck %s -check-prefix=ALL -check-prefix=FCC
5; RUN: llc -march=mips64 -mcpu=mips64   < %s | FileCheck %s -check-prefix=ALL -check-prefix=FCC
6; RUN: llc -march=mips64 -mcpu=mips64r2 < %s | FileCheck %s -check-prefix=ALL -check-prefix=FCC
7; RUN: llc -march=mips64 -mcpu=mips64r6 < %s | FileCheck %s -check-prefix=ALL -check-prefix=GPR -check-prefix=64-GPR
8
9define double @foo(double %a, double %b) nounwind readnone {
10entry:
11; ALL-LABEL: foo:
12
13; FCC:           bc1f $BB
14; FCC:           nop
15
16; 32-GPR:        mtc1      $zero, $[[Z:f[0-9]]]
17; 32-GPR:        mthc1     $zero, $[[Z:f[0-9]]]
18; 64-GPR:        dmtc1     $zero, $[[Z:f[0-9]]]
19; GPR:           cmp.lt.d  $[[FGRCC:f[0-9]+]], $[[Z]], $f12
20; GPR:           mfc1      $[[GPRCC:[0-9]+]], $[[FGRCC]]
21; GPR-NOT:       not       $[[GPRCC]], $[[GPRCC]]
22; GPR:           bnez      $[[GPRCC]], $BB
23
24  %cmp = fcmp ogt double %a, 0.000000e+00
25  br i1 %cmp, label %if.end6, label %if.else
26
27if.else:                                          ; preds = %entry
28  %cmp3 = fcmp ogt double %b, 0.000000e+00
29  br i1 %cmp3, label %if.end6, label %return
30
31if.end6:                                          ; preds = %if.else, %entry
32  %c.0 = phi double [ %a, %entry ], [ 0.000000e+00, %if.else ]
33  %sub = fsub double %b, %c.0
34  %mul = fmul double %sub, 2.000000e+00
35  br label %return
36
37return:                                           ; preds = %if.else, %if.end6
38  %retval.0 = phi double [ %mul, %if.end6 ], [ 0.000000e+00, %if.else ]
39  ret double %retval.0
40}
41
42define void @f1(float %f) nounwind {
43entry:
44; ALL-LABEL: f1:
45
46; FCC:           bc1f $BB
47; FCC:           nop
48
49; GPR:           mtc1     $zero, $[[Z:f[0-9]]]
50; GPR:           cmp.eq.s $[[FGRCC:f[0-9]+]], $f12, $[[Z]]
51; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC]]
52; GPR-NOT:       not      $[[GPRCC]], $[[GPRCC]]
53; GPR:           beqz     $[[GPRCC]], $BB
54
55  %cmp = fcmp une float %f, 0.000000e+00
56  br i1 %cmp, label %if.then, label %if.end
57
58if.then:                                          ; preds = %entry
59  tail call void @abort() noreturn
60  unreachable
61
62if.end:                                           ; preds = %entry
63  tail call void (...)* @f2() nounwind
64  ret void
65}
66
67declare void @abort() noreturn nounwind
68
69declare void @f2(...)
70