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(ptr %ptr) {
9 ; CHECK: ni 0(%r2), 254
11 %val = load i8, ptr %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, ptr %ptr
19 ; Zero extension to 64 bits, negative constant.
20 define void @f2(ptr %ptr) {
22 ; CHECK: ni 0(%r2), 254
24 %val = load i8, ptr %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, ptr %ptr
32 ; Zero extension to 32 bits, positive constant.
33 define void @f3(ptr %ptr) {
35 ; CHECK: ni 0(%r2), 254
37 %val = load i8, ptr %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, ptr %ptr
45 ; Zero extension to 64 bits, positive constant.
46 define void @f4(ptr %ptr) {
48 ; CHECK: ni 0(%r2), 254
50 %val = load i8, ptr %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, ptr %ptr
58 ; Sign extension to 32 bits, negative constant.
59 define void @f5(ptr %ptr) {
61 ; CHECK: ni 0(%r2), 254
63 %val = load i8, ptr %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, ptr %ptr
71 ; Sign extension to 64 bits, negative constant.
72 define void @f6(ptr %ptr) {
74 ; CHECK: ni 0(%r2), 254
76 %val = load i8, ptr %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, ptr %ptr
84 ; Sign extension to 32 bits, positive constant.
85 define void @f7(ptr %ptr) {
87 ; CHECK: ni 0(%r2), 254
89 %val = load i8, ptr %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, ptr %ptr
97 ; Sign extension to 64 bits, positive constant.
98 define void @f8(ptr %ptr) {
100 ; CHECK: ni 0(%r2), 254
102 %val = load i8, ptr %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, ptr %ptr