1 ; RUN: llc -march=hexagon < %s | FileCheck %s
2 ; Check that we generate compare to predicate register.
4 define i32 @compare1(i32 %a, i32 %b) nounwind {
5 ; CHECK: p{{[0-3]}} = {{!?}}cmp.eq(r{{[0-9]+}},r{{[0-9]+}})
7 %cmp = icmp ne i32 %a, %b
8 %add = add nsw i32 %a, %b
9 %sub = sub nsw i32 %a, %b
10 %add.sub = select i1 %cmp, i32 %add, i32 %sub
14 define i32 @compare2(i32 %a) nounwind {
15 ; CHECK: p{{[0-3]}} = {{!?}}cmp.eq(r{{[0-9]+}},#10)
17 %cmp = icmp ne i32 %a, 10
18 %add = add nsw i32 %a, 10
19 %sub = sub nsw i32 %a, 10
20 %add.sub = select i1 %cmp, i32 %add, i32 %sub
24 define i32 @compare3(i32 %a, i32 %b) nounwind {
25 ; CHECK: p{{[0-3]}} = cmp.gt(r{{[0-9]+}},r{{[0-9]+}})
27 %cmp = icmp sgt i32 %a, %b
28 %sub = sub nsw i32 %a, %b
29 %add = add nsw i32 %a, %b
30 %sub.add = select i1 %cmp, i32 %sub, i32 %add
34 define i32 @compare4(i32 %a) nounwind {
35 ; CHECK: p{{[0-3]}} = cmp.gt(r{{[0-9]+}},#10)
37 %cmp = icmp sgt i32 %a, 10
38 %sub = sub nsw i32 %a, 10
39 %add = add nsw i32 %a, 10
40 %sub.add = select i1 %cmp, i32 %sub, i32 %add