1
; Test zero extensions from a halfword to an i32.
3
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5
; Test register extension, starting with an i32.
6
define i32 @f1(i32 %a) {
10
%half = trunc i32 %a to i16
11
%ext = zext i16 %half to i32
15
; ...and again with an i64.
16
define i32 @f2(i64 %a) {
18
; CHECK: llhr %r2, %r2
20
%half = trunc i64 %a to i16
21
%ext = zext i16 %half to i32
25
; Check ANDs that are equivalent to zero extension.
26
define i32 @f3(i32 %a) {
28
; CHECK: llhr %r2, %r2
30
%ext = and i32 %a, 65535
34
; Check LLH with no displacement.
35
define i32 @f4(i16 *%src) {
37
; CHECK: llh %r2, 0(%r2)
39
%half = load i16 *%src
40
%ext = zext i16 %half to i32
44
; Check the high end of the LLH range.
45
define i32 @f5(i16 *%src) {
47
; CHECK: llh %r2, 524286(%r2)
49
%ptr = getelementptr i16 *%src, i64 262143
50
%half = load i16 *%ptr
51
%ext = zext i16 %half to i32
55
; Check the next halfword up, which needs separate address logic.
56
; Other sequences besides this one would be OK.
57
define i32 @f6(i16 *%src) {
59
; CHECK: agfi %r2, 524288
60
; CHECK: llh %r2, 0(%r2)
62
%ptr = getelementptr i16 *%src, i64 262144
63
%half = load i16 *%ptr
64
%ext = zext i16 %half to i32
68
; Check the high end of the negative LLH range.
69
define i32 @f7(i16 *%src) {
71
; CHECK: llh %r2, -2(%r2)
73
%ptr = getelementptr i16 *%src, i64 -1
74
%half = load i16 *%ptr
75
%ext = zext i16 %half to i32
79
; Check the low end of the LLH range.
80
define i32 @f8(i16 *%src) {
82
; CHECK: llh %r2, -524288(%r2)
84
%ptr = getelementptr i16 *%src, i64 -262144
85
%half = load i16 *%ptr
86
%ext = zext i16 %half to i32
90
; Check the next halfword down, which needs separate address logic.
91
; Other sequences besides this one would be OK.
92
define i32 @f9(i16 *%src) {
94
; CHECK: agfi %r2, -524290
95
; CHECK: llh %r2, 0(%r2)
97
%ptr = getelementptr i16 *%src, i64 -262145
98
%half = load i16 *%ptr
99
%ext = zext i16 %half to i32
103
; Check that LLH allows an index
104
define i32 @f10(i64 %src, i64 %index) {
106
; CHECK: llh %r2, 524287(%r3,%r2)
108
%add1 = add i64 %src, %index
109
%add2 = add i64 %add1, 524287
110
%ptr = inttoptr i64 %add2 to i16 *
111
%half = load i16 *%ptr
112
%ext = zext i16 %half to i32