blob: 4d4c4bbd20d10c73791290d5470ae3b48f79c6f2 [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
13 %res = select i1 %cond, double %a, double %b
14 ret double %res
15}
16
Richard Sandiford93183ee2013-09-18 09:56:40 +000017; Check the top of the CLIJ range.
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000018define double @f2(double %a, double %b, i32 %i1) {
Stephen Lind24ab202013-07-14 06:24:09 +000019; CHECK-LABEL: f2:
Richard Sandiford93183ee2013-09-18 09:56:40 +000020; CHECK: clijl %r2, 255
21; CHECK: ldr %f0, %f2
22; CHECK: br %r14
23 %cond = icmp ult i32 %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, i32 %i1) {
30; CHECK-LABEL: f3:
31; CHECK: clfi %r2, 256
32; CHECK: jl
33; CHECK: ldr %f0, %f2
34; CHECK: br %r14
35 %cond = icmp ult i32 %i1, 256
36 %res = select i1 %cond, double %a, double %b
37 ret double %res
38}
39
40; Check a value near the high end of the range.
41define double @f4(double %a, double %b, i32 %i1) {
42; CHECK-LABEL: f4:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000043; CHECK: clfi %r2, 4294967280
Richard Sandiford586f4172013-05-21 08:53:17 +000044; CHECK-NEXT: jl
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000045; CHECK: ldr %f0, %f2
46; CHECK: br %r14
47 %cond = icmp ult i32 %i1, 4294967280
48 %res = select i1 %cond, double %a, double %b
49 ret double %res
50}