1
; Test 32-bit equality comparisons that are really between a memory halfword
4
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6
; Check the low end of the 16-bit unsigned range, with zero extension.
7
define double @f1(double %a, double %b, i16 *%ptr) {
9
; CHECK: clhhsi 0(%r2), 0
13
%ext = zext i16 %val to i32
14
%cond = icmp eq i32 %ext, 0
15
%res = select i1 %cond, double %a, double %b
19
; Check the high end of the 16-bit unsigned range, with zero extension.
20
define double @f2(double %a, double %b, i16 *%ptr) {
22
; CHECK: clhhsi 0(%r2), 65535
26
%ext = zext i16 %val to i32
27
%cond = icmp eq i32 %ext, 65535
28
%res = select i1 %cond, double %a, double %b
32
; Check the next value up, with zero extension. The condition is always false.
33
define double @f3(double %a, double %b, i16 *%ptr) {
38
%ext = zext i16 %val to i32
39
%cond = icmp eq i32 %ext, 65536
40
%res = select i1 %cond, double %a, double %b
44
; Check comparisons with -1, with zero extension.
45
; This condition is also always false.
46
define double @f4(double %a, double %b, i16 *%ptr) {
51
%ext = zext i16 %val to i32
52
%cond = icmp eq i32 %ext, -1
53
%res = select i1 %cond, double %a, double %b
57
; Check comparisons with 0, using sign extension.
58
define double @f5(double %a, double %b, i16 *%ptr) {
60
; CHECK: clhhsi 0(%r2), 0
64
%ext = sext i16 %val to i32
65
%cond = icmp eq i32 %ext, 0
66
%res = select i1 %cond, double %a, double %b
70
; Check the high end of the signed 16-bit range, using sign extension.
71
define double @f6(double %a, double %b, i16 *%ptr) {
73
; CHECK: clhhsi 0(%r2), 32767
77
%ext = sext i16 %val to i32
78
%cond = icmp eq i32 %ext, 32767
79
%res = select i1 %cond, double %a, double %b
83
; Check the next value up, using sign extension.
84
; The condition is always false.
85
define double @f7(double %a, double %b, i16 *%ptr) {
90
%ext = sext i16 %val to i32
91
%cond = icmp eq i32 %ext, 32768
92
%res = select i1 %cond, double %a, double %b
96
; Check comparisons with -1, using sign extension.
97
define double @f8(double %a, double %b, i16 *%ptr) {
99
; CHECK: clhhsi 0(%r2), 65535
102
%val = load i16 *%ptr
103
%ext = sext i16 %val to i32
104
%cond = icmp eq i32 %ext, -1
105
%res = select i1 %cond, double %a, double %b
109
; Check the low end of the signed 16-bit range, using sign extension.
110
define double @f9(double %a, double %b, i16 *%ptr) {
112
; CHECK: clhhsi 0(%r2), 32768
115
%val = load i16 *%ptr
116
%ext = sext i16 %val to i32
117
%cond = icmp eq i32 %ext, -32768
118
%res = select i1 %cond, double %a, double %b
122
; Check the next value down, using sign extension.
123
; The condition is always false.
124
define double @f10(double %a, double %b, i16 *%ptr) {
128
%val = load i16 *%ptr
129
%ext = sext i16 %val to i32
130
%cond = icmp eq i32 %ext, -32769
131
%res = select i1 %cond, double %a, double %b