[SystemZ] Automatically detect zEC12 and z196 hosts
[oota-llvm.git] / test / CodeGen / SystemZ / int-cmp-24.ll
1 ; Test 16-bit equality 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.
6 define double @f1(double %a, double %b, i16 *%ptr) {
7 ; CHECK-LABEL: f1:
8 ; CHECK: clhhsi 0(%r2), 0
9 ; CHECK-NEXT: je
10 ; CHECK: ldr %f0, %f2
11 ; CHECK: br %r14
12   %val = load i16 *%ptr
13   %cond = icmp eq 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.
19 define double @f2(double %a, double %b, i16 *%ptr) {
20 ; CHECK-LABEL: f2:
21 ; CHECK: clhhsi 0(%r2), 65535
22 ; CHECK-NEXT: je
23 ; CHECK: ldr %f0, %f2
24 ; CHECK: br %r14
25   %val = load i16 *%ptr
26   %cond = icmp eq 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.
32 define double @f3(double %a, double %b, i16 *%ptr) {
33 ; CHECK-LABEL: f3:
34 ; CHECK: clhhsi 0(%r2), 32768
35 ; CHECK-NEXT: je
36 ; CHECK: ldr %f0, %f2
37 ; CHECK: br %r14
38   %val = load i16 *%ptr
39   %cond = icmp eq 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.
45 define double @f4(double %a, double %b, i16 *%ptr) {
46 ; CHECK-LABEL: f4:
47 ; CHECK: clhhsi 0(%r2), 32767
48 ; CHECK-NEXT: je
49 ; CHECK: ldr %f0, %f2
50 ; CHECK: br %r14
51   %val = load i16 *%ptr
52   %cond = icmp eq i16 %val, 32767
53   %res = select i1 %cond, double %a, double %b
54   ret double %res
55 }