blob: a3a223fa34480c9de6c559151814846923252862 [file] [log] [blame]
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00001; Test 16-bit inequality comparisons between memory and a constant.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5; Check the low end of the unsigned 16-bit range.
6define double @f1(double %a, double %b, i16 *%ptr) {
7; CHECK: f1:
8; CHECK: clhhsi 0(%r2), 0
9; CHECK-NEXT: j{{g?}}lh
10; CHECK: ldr %f0, %f2
11; CHECK: br %r14
12 %val = load i16 *%ptr
13 %cond = icmp ne i16 %val, 0
14 %res = select i1 %cond, double %a, double %b
15 ret double %res
16}
17
18; Check the high end of the unsigned 16-bit range.
19define double @f2(double %a, double %b, i16 *%ptr) {
20; CHECK: f2:
21; CHECK: clhhsi 0(%r2), 65535
22; CHECK-NEXT: j{{g?}}lh
23; CHECK: ldr %f0, %f2
24; CHECK: br %r14
25 %val = load i16 *%ptr
26 %cond = icmp ne i16 %val, 65535
27 %res = select i1 %cond, double %a, double %b
28 ret double %res
29}
30
31; Check the low end of the signed 16-bit range.
32define double @f3(double %a, double %b, i16 *%ptr) {
33; CHECK: f3:
34; CHECK: clhhsi 0(%r2), 32768
35; CHECK-NEXT: j{{g?}}lh
36; CHECK: ldr %f0, %f2
37; CHECK: br %r14
38 %val = load i16 *%ptr
39 %cond = icmp ne i16 %val, -32768
40 %res = select i1 %cond, double %a, double %b
41 ret double %res
42}
43
44; Check the high end of the signed 16-bit range.
45define double @f4(double %a, double %b, i16 *%ptr) {
46; CHECK: f4:
47; CHECK: clhhsi 0(%r2), 32767
48; CHECK-NEXT: j{{g?}}lh
49; CHECK: ldr %f0, %f2
50; CHECK: br %r14
51 %val = load i16 *%ptr
52 %cond = icmp ne i16 %val, 32767
53 %res = select i1 %cond, double %a, double %b
54 ret double %res
55}