1 ; Test that we can use NI for byte operations that are expressed as i32
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 ; Zero extension to 32 bits, negative constant.
7 define void @f1(i8 *%ptr) {
9 ; CHECK: ni 0(%r2), 254
11 %val = load i8, i8 *%ptr
12 %ext = zext i8 %val to i32
13 %and = and i32 %ext, -2
14 %trunc = trunc i32 %and to i8
15 store i8 %trunc, i8 *%ptr
19 ; Zero extension to 64 bits, negative constant.
20 define void @f2(i8 *%ptr) {
22 ; CHECK: ni 0(%r2), 254
24 %val = load i8, i8 *%ptr
25 %ext = zext i8 %val to i64
26 %and = and i64 %ext, -2
27 %trunc = trunc i64 %and to i8
28 store i8 %trunc, i8 *%ptr
32 ; Zero extension to 32 bits, positive constant.
33 define void @f3(i8 *%ptr) {
35 ; CHECK: ni 0(%r2), 254
37 %val = load i8, i8 *%ptr
38 %ext = zext i8 %val to i32
39 %and = and i32 %ext, 254
40 %trunc = trunc i32 %and to i8
41 store i8 %trunc, i8 *%ptr
45 ; Zero extension to 64 bits, positive constant.
46 define void @f4(i8 *%ptr) {
48 ; CHECK: ni 0(%r2), 254
50 %val = load i8, i8 *%ptr
51 %ext = zext i8 %val to i64
52 %and = and i64 %ext, 254
53 %trunc = trunc i64 %and to i8
54 store i8 %trunc, i8 *%ptr
58 ; Sign extension to 32 bits, negative constant.
59 define void @f5(i8 *%ptr) {
61 ; CHECK: ni 0(%r2), 254
63 %val = load i8, i8 *%ptr
64 %ext = sext i8 %val to i32
65 %and = and i32 %ext, -2
66 %trunc = trunc i32 %and to i8
67 store i8 %trunc, i8 *%ptr
71 ; Sign extension to 64 bits, negative constant.
72 define void @f6(i8 *%ptr) {
74 ; CHECK: ni 0(%r2), 254
76 %val = load i8, i8 *%ptr
77 %ext = sext i8 %val to i64
78 %and = and i64 %ext, -2
79 %trunc = trunc i64 %and to i8
80 store i8 %trunc, i8 *%ptr
84 ; Sign extension to 32 bits, positive constant.
85 define void @f7(i8 *%ptr) {
87 ; CHECK: ni 0(%r2), 254
89 %val = load i8, i8 *%ptr
90 %ext = sext i8 %val to i32
91 %and = and i32 %ext, 254
92 %trunc = trunc i32 %and to i8
93 store i8 %trunc, i8 *%ptr
97 ; Sign extension to 64 bits, positive constant.
98 define void @f8(i8 *%ptr) {
100 ; CHECK: ni 0(%r2), 254
102 %val = load i8, i8 *%ptr
103 %ext = sext i8 %val to i64
104 %and = and i64 %ext, 254
105 %trunc = trunc i64 %and to i8
106 store i8 %trunc, i8 *%ptr