blob: e2a0c1aa69488595cf981b9161a9ee1e015237c2 [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 32-bit unsigned comparisons in which the second operand is constant.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
Richard Sandiford93183ee2013-09-18 09:56:40 +00005; 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.
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00007define double @f1(double %a, double %b, i32 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +00008; CHECK-LABEL: f1:
Richard Sandiford93183ee2013-09-18 09:56:40 +00009; CHECK: clijh %r2, 1
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000010; CHECK: ldr %f0, %f2
11; CHECK: br %r14
12 %cond = icmp ugt i32 %i1, 1
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000013 %tmp = select i1 %cond, double %a, double %b
14 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000015 ret double %res
16}
17
Richard Sandiford93183ee2013-09-18 09:56:40 +000018; Check the top of the CLIJ range.
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000019define double @f2(double %a, double %b, i32 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000020; CHECK-LABEL: f2:
Richard Sandiford93183ee2013-09-18 09:56:40 +000021; CHECK: clijl %r2, 255
22; CHECK: ldr %f0, %f2
23; CHECK: br %r14
24 %cond = icmp ult i32 %i1, 255
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000025 %tmp = select i1 %cond, double %a, double %b
26 %res = fadd double %tmp, 1.0
Richard Sandiford93183ee2013-09-18 09:56:40 +000027 ret double %res
28}
29
30; Check the next value up, which needs a separate comparison.
31define double @f3(double %a, double %b, i32 %i1) {
32; CHECK-LABEL: f3:
33; CHECK: clfi %r2, 256
34; CHECK: jl
35; CHECK: ldr %f0, %f2
36; CHECK: br %r14
37 %cond = icmp ult i32 %i1, 256
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000038 %tmp = select i1 %cond, double %a, double %b
39 %res = fadd double %tmp, 1.0
Richard Sandiford93183ee2013-09-18 09:56:40 +000040 ret double %res
41}
42
43; Check a value near the high end of the range.
44define double @f4(double %a, double %b, i32 %i1) {
45; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000046; CHECK: clfi %r2, 4294967280
Richard Sandiford586f4172013-05-21 08:53:17 +000047; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000048; CHECK: ldr %f0, %f2
49; CHECK: br %r14
50 %cond = icmp ult i32 %i1, 4294967280
Ulrich Weigand2eb027d2016-04-07 16:11:44 +000051 %tmp = select i1 %cond, double %a, double %b
52 %res = fadd double %tmp, 1.0
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000053 ret double %res
54}