• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test 64-bit unsigned comparisons in which the second operand is constant.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Check a value near the low end of the range.  We use signed forms for
6; comparisons with zero, or things that are equivalent to them.
7define double @f1(double %a, double %b, i64 %i1) {
8; CHECK-LABEL: f1:
9; CHECK: clgijh %r2, 1
10; CHECK: ldr %f0, %f2
11; CHECK: br %r14
12  %cond = icmp ugt i64 %i1, 1
13  %res = select i1 %cond, double %a, double %b
14  ret double %res
15}
16
17; Check the top of the CLGIJ range.
18define double @f2(double %a, double %b, i64 %i1) {
19; CHECK-LABEL: f2:
20; CHECK: clgijl %r2, 255
21; CHECK: ldr %f0, %f2
22; CHECK: br %r14
23  %cond = icmp ult i64 %i1, 255
24  %res = select i1 %cond, double %a, double %b
25  ret double %res
26}
27
28; Check the next value up, which needs a separate comparison.
29define double @f3(double %a, double %b, i64 %i1) {
30; CHECK-LABEL: f3:
31; CHECK: clgfi %r2, 256
32; CHECK: jl
33; CHECK: ldr %f0, %f2
34; CHECK: br %r14
35  %cond = icmp ult i64 %i1, 256
36  %res = select i1 %cond, double %a, double %b
37  ret double %res
38}
39
40; Check the high end of the CLGFI range.
41define double @f4(double %a, double %b, i64 %i1) {
42; CHECK-LABEL: f4:
43; CHECK: clgfi %r2, 4294967295
44; CHECK-NEXT: jl
45; CHECK: ldr %f0, %f2
46; CHECK: br %r14
47  %cond = icmp ult i64 %i1, 4294967295
48  %res = select i1 %cond, double %a, double %b
49  ret double %res
50}
51
52; Check the next value up, which can use a shifted comparison
53define double @f5(double %a, double %b, i64 %i1) {
54; CHECK-LABEL: f5:
55; CHECK: srlg [[REG:%r[0-5]]], %r2, 32
56; CHECK: cgije [[REG]], 0
57; CHECK: ldr %f0, %f2
58; CHECK: br %r14
59  %cond = icmp ult i64 %i1, 4294967296
60  %res = select i1 %cond, double %a, double %b
61  ret double %res
62}
63; Check the next value up, which must use a register comparison.
64define double @f6(double %a, double %b, i64 %i1) {
65; CHECK-LABEL: f6:
66; CHECK: clgrjl %r2,
67; CHECK: ldr %f0, %f2
68; CHECK: br %r14
69  %cond = icmp ult i64 %i1, 4294967297
70  %res = select i1 %cond, double %a, double %b
71  ret double %res
72}
73