• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test that we can use XI for byte operations that are expressed as i32
2; or i64 operations.
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5
6; Zero extension to 32 bits, negative constant.
7define void @f1(i8 *%ptr) {
8; CHECK-LABEL: f1:
9; CHECK: xi 0(%r2), 254
10; CHECK: br %r14
11  %val = load i8, i8 *%ptr
12  %ext = zext i8 %val to i32
13  %xor = xor i32 %ext, -2
14  %trunc = trunc i32 %xor to i8
15  store i8 %trunc, i8 *%ptr
16  ret void
17}
18
19; Zero extension to 64 bits, negative constant.
20define void @f2(i8 *%ptr) {
21; CHECK-LABEL: f2:
22; CHECK: xi 0(%r2), 254
23; CHECK: br %r14
24  %val = load i8, i8 *%ptr
25  %ext = zext i8 %val to i64
26  %xor = xor i64 %ext, -2
27  %trunc = trunc i64 %xor to i8
28  store i8 %trunc, i8 *%ptr
29  ret void
30}
31
32; Zero extension to 32 bits, positive constant.
33define void @f3(i8 *%ptr) {
34; CHECK-LABEL: f3:
35; CHECK: xi 0(%r2), 254
36; CHECK: br %r14
37  %val = load i8, i8 *%ptr
38  %ext = zext i8 %val to i32
39  %xor = xor i32 %ext, 254
40  %trunc = trunc i32 %xor to i8
41  store i8 %trunc, i8 *%ptr
42  ret void
43}
44
45; Zero extension to 64 bits, positive constant.
46define void @f4(i8 *%ptr) {
47; CHECK-LABEL: f4:
48; CHECK: xi 0(%r2), 254
49; CHECK: br %r14
50  %val = load i8, i8 *%ptr
51  %ext = zext i8 %val to i64
52  %xor = xor i64 %ext, 254
53  %trunc = trunc i64 %xor to i8
54  store i8 %trunc, i8 *%ptr
55  ret void
56}
57
58; Sign extension to 32 bits, negative constant.
59define void @f5(i8 *%ptr) {
60; CHECK-LABEL: f5:
61; CHECK: xi 0(%r2), 254
62; CHECK: br %r14
63  %val = load i8, i8 *%ptr
64  %ext = sext i8 %val to i32
65  %xor = xor i32 %ext, -2
66  %trunc = trunc i32 %xor to i8
67  store i8 %trunc, i8 *%ptr
68  ret void
69}
70
71; Sign extension to 64 bits, negative constant.
72define void @f6(i8 *%ptr) {
73; CHECK-LABEL: f6:
74; CHECK: xi 0(%r2), 254
75; CHECK: br %r14
76  %val = load i8, i8 *%ptr
77  %ext = sext i8 %val to i64
78  %xor = xor i64 %ext, -2
79  %trunc = trunc i64 %xor to i8
80  store i8 %trunc, i8 *%ptr
81  ret void
82}
83
84; Sign extension to 32 bits, positive constant.
85define void @f7(i8 *%ptr) {
86; CHECK-LABEL: f7:
87; CHECK: xi 0(%r2), 254
88; CHECK: br %r14
89  %val = load i8, i8 *%ptr
90  %ext = sext i8 %val to i32
91  %xor = xor i32 %ext, 254
92  %trunc = trunc i32 %xor to i8
93  store i8 %trunc, i8 *%ptr
94  ret void
95}
96
97; Sign extension to 64 bits, positive constant.
98define void @f8(i8 *%ptr) {
99; CHECK-LABEL: f8:
100; CHECK: xi 0(%r2), 254
101; CHECK: br %r14
102  %val = load i8, i8 *%ptr
103  %ext = sext i8 %val to i64
104  %xor = xor i64 %ext, 254
105  %trunc = trunc i64 %xor to i8
106  store i8 %trunc, i8 *%ptr
107  ret void
108}
109