1 ; RUN: llc < %s -mtriple=sparc64-pc-openbsd -disable-sparc-leaf-proc | FileCheck %s
2 ; Testing 64-bit conditionals. The sparc64 triple is an alias for sparcv9.
7 define void @cmpri(i64* %p, i64 %x) {
9 %tobool = icmp eq i64 %x, 1
10 br i1 %tobool, label %if.end, label %if.then
13 store i64 %x, i64* %p, align 8
23 define void @cmprr(i64* %p, i64 %x, i64 %y) {
25 %tobool = icmp ugt i64 %x, %y
26 br i1 %tobool, label %if.end, label %if.then
29 store i64 %x, i64* %p, align 8
36 ; CHECK: selecti32_xcc
38 ; CHECK: movg %xcc, %i2, %i3
39 ; CHECK: restore %g0, %i3, %o0
40 define i32 @selecti32_xcc(i64 %x, i64 %y, i32 %a, i32 %b) {
42 %tobool = icmp sgt i64 %x, %y
43 %rv = select i1 %tobool, i32 %a, i32 %b
47 ; CHECK: selecti64_xcc
49 ; CHECK: movg %xcc, %i2, %i3
50 ; CHECK: restore %g0, %i3, %o0
51 define i64 @selecti64_xcc(i64 %x, i64 %y, i64 %a, i64 %b) {
53 %tobool = icmp sgt i64 %x, %y
54 %rv = select i1 %tobool, i64 %a, i64 %b
58 ; CHECK: selecti64_icc
60 ; CHECK: movg %icc, %i2, %i3
61 ; CHECK: restore %g0, %i3, %o0
62 define i64 @selecti64_icc(i32 %x, i32 %y, i64 %a, i64 %b) {
64 %tobool = icmp sgt i32 %x, %y
65 %rv = select i1 %tobool, i64 %a, i64 %b
69 ; CHECK: selecti64_fcc
71 ; CHECK: fcmps %f1, %f3
72 ; CHECK: movul %fcc0, %i2, %i0
74 define i64 @selecti64_fcc(float %x, float %y, i64 %a, i64 %b) {
76 %tobool = fcmp ult float %x, %y
77 %rv = select i1 %tobool, i64 %a, i64 %b
81 ; CHECK: selectf32_xcc
82 ; CHECK: fmovs %f7, %f0
84 ; CHECK: fmovsg %xcc, %f5, %f0
85 define float @selectf32_xcc(i64 %x, i64 %y, float %a, float %b) {
87 %tobool = icmp sgt i64 %x, %y
88 %rv = select i1 %tobool, float %a, float %b
92 ; CHECK: selectf64_xcc
93 ; CHECK: fmovd %f6, %f0
95 ; CHECK: fmovdg %xcc, %f4, %f0
96 define double @selectf64_xcc(i64 %x, i64 %y, double %a, double %b) {
98 %tobool = icmp sgt i64 %x, %y
99 %rv = select i1 %tobool, double %a, double %b
103 ; The MOVXCC instruction can't use %g0 for its tied operand.
104 ; CHECK: select_consti64_xcc
106 ; CHECK: movg %xcc, 123, %i{{[0-2]}}
107 define i64 @select_consti64_xcc(i64 %x, i64 %y) {
109 %tobool = icmp sgt i64 %x, %y
110 %rv = select i1 %tobool, i64 123, i64 0
114 ; CHECK-LABEL: setcc_resultty
115 ; CHECK-DAG: srax %i0, 63, %o0
116 ; CHECK-DAG: mov %i0, %o1
117 ; CHECK-DAG: mov 0, %o2
118 ; CHECK-DAG: mov 32, %o3
119 ; CHECK-DAG: call __multi3
121 ; CHECK: movne %xcc, 1, [[R:%[gilo][0-7]]]
122 ; CHECK: or [[R]], %i1, %i0
124 define i1 @setcc_resultty(i64 %a, i1 %b) {
125 %a0 = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 32)
126 %a1 = extractvalue { i64, i1 } %a0, 1
131 declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64)