1 ; Combined logical operations involving complement on z15
3 ; RUN: llc -mcpu=z15 < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; And-with-complement 32-bit.
6 define i32 @f1(i32 %dummy, i32 %a, i32 %b) {
8 ; CHECK: ncrk %r2, %r3, %r4
11 %ret = and i32 %neg, %a
15 ; And-with-complement 64-bit.
16 define i64 @f2(i64 %dummy, i64 %a, i64 %b) {
18 ; CHECK: ncgrk %r2, %r3, %r4
21 %ret = and i64 %neg, %a
25 ; Or-with-complement 32-bit.
26 define i32 @f3(i32 %dummy, i32 %a, i32 %b) {
28 ; CHECK: ocrk %r2, %r3, %r4
31 %ret = or i32 %neg, %a
35 ; Or-with-complement 64-bit.
36 define i64 @f4(i64 %dummy, i64 %a, i64 %b) {
38 ; CHECK: ocgrk %r2, %r3, %r4
41 %ret = or i64 %neg, %a
46 define i32 @f5(i32 %dummy, i32 %a, i32 %b) {
48 ; CHECK: nnrk %r2, %r3, %r4
51 %ret = xor i32 %tmp, -1
56 define i64 @f6(i64 %dummy, i64 %a, i64 %b) {
58 ; CHECK: nngrk %r2, %r3, %r4
61 %ret = xor i64 %tmp, -1
66 define i32 @f7(i32 %dummy, i32 %a, i32 %b) {
68 ; CHECK: nork %r2, %r3, %r4
71 %ret = xor i32 %tmp, -1
76 define i64 @f8(i64 %dummy, i64 %a, i64 %b) {
78 ; CHECK: nogrk %r2, %r3, %r4
81 %ret = xor i64 %tmp, -1
86 define i32 @f9(i32 %dummy, i32 %a, i32 %b) {
88 ; CHECK: nxrk %r2, %r3, %r4
91 %ret = xor i32 %tmp, -1
96 define i64 @f10(i64 %dummy, i64 %a, i64 %b) {
98 ; CHECK: nxgrk %r2, %r3, %r4
100 %tmp = xor i64 %a, %b
101 %ret = xor i64 %tmp, -1
105 ; Or-with-complement 32-bit of a constant.
106 define i32 @f11(i32 %a) {
108 ; CHECK: lhi [[REG:%r[0-5]]], -256
109 ; CHECK: ocrk %r2, [[REG]], %r2
111 %neg = xor i32 %a, -1
112 %ret = or i32 %neg, -256
116 ; Or-with-complement 64-bit of a constant.
117 define i64 @f12(i64 %a) {
119 ; CHECK: lghi [[REG:%r[0-5]]], -256
120 ; CHECK: ocgrk %r2, [[REG]], %r2
122 %neg = xor i64 %a, -1
123 %ret = or i64 %neg, -256
127 ; NXOR 32-bit (alternate match).
128 define i32 @f13(i32 %a) {
130 ; CHECK: lhi [[REG:%r[0-5]]], -256
131 ; CHECK: nxrk %r2, %r2, [[REG]]
133 ; Use an opaque const so the pattern doesn't get optimized away early.
134 %const = bitcast i32 -256 to i32
135 %neg = xor i32 %a, -1
136 %ret = xor i32 %neg, %const
140 ; NXOR 64-bit (alternate match).
141 define i64 @f14(i64 %a) {
143 ; CHECK: lghi [[REG:%r[0-5]]], -256
144 ; CHECK: nxgrk %r2, %r2, [[REG]]
146 ; Use an opaque const so the pattern doesn't get optimized away early.
147 %const = bitcast i64 -256 to i64
148 %neg = xor i64 %a, -1
149 %ret = xor i64 %neg, %const