not-01.ll
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
; Combined logical operations involving complement on z15
;
; RUN: llc -mcpu=z15 < %s -mtriple=s390x-linux-gnu | FileCheck %s
; And-with-complement 32-bit.
define i32 @f1(i32 %dummy, i32 %a, i32 %b) {
; CHECK-LABEL: f1:
; CHECK: ncrk %r2, %r3, %r4
; CHECK: br %r14
%neg = xor i32 %b, -1
%ret = and i32 %neg, %a
ret i32 %ret
}
; And-with-complement 64-bit.
define i64 @f2(i64 %dummy, i64 %a, i64 %b) {
; CHECK-LABEL: f2:
; CHECK: ncgrk %r2, %r3, %r4
; CHECK: br %r14
%neg = xor i64 %b, -1
%ret = and i64 %neg, %a
ret i64 %ret
}
; Or-with-complement 32-bit.
define i32 @f3(i32 %dummy, i32 %a, i32 %b) {
; CHECK-LABEL: f3:
; CHECK: ocrk %r2, %r3, %r4
; CHECK: br %r14
%neg = xor i32 %b, -1
%ret = or i32 %neg, %a
ret i32 %ret
}
; Or-with-complement 64-bit.
define i64 @f4(i64 %dummy, i64 %a, i64 %b) {
; CHECK-LABEL: f4:
; CHECK: ocgrk %r2, %r3, %r4
; CHECK: br %r14
%neg = xor i64 %b, -1
%ret = or i64 %neg, %a
ret i64 %ret
}
; NAND 32-bit.
define i32 @f5(i32 %dummy, i32 %a, i32 %b) {
; CHECK-LABEL: f5:
; CHECK: nnrk %r2, %r3, %r4
; CHECK: br %r14
%tmp = and i32 %a, %b
%ret = xor i32 %tmp, -1
ret i32 %ret
}
; NAND 64-bit.
define i64 @f6(i64 %dummy, i64 %a, i64 %b) {
; CHECK-LABEL: f6:
; CHECK: nngrk %r2, %r3, %r4
; CHECK: br %r14
%tmp = and i64 %a, %b
%ret = xor i64 %tmp, -1
ret i64 %ret
}
; NOR 32-bit.
define i32 @f7(i32 %dummy, i32 %a, i32 %b) {
; CHECK-LABEL: f7:
; CHECK: nork %r2, %r3, %r4
; CHECK: br %r14
%tmp = or i32 %a, %b
%ret = xor i32 %tmp, -1
ret i32 %ret
}
; NOR 64-bit.
define i64 @f8(i64 %dummy, i64 %a, i64 %b) {
; CHECK-LABEL: f8:
; CHECK: nogrk %r2, %r3, %r4
; CHECK: br %r14
%tmp = or i64 %a, %b
%ret = xor i64 %tmp, -1
ret i64 %ret
}
; NXOR 32-bit.
define i32 @f9(i32 %dummy, i32 %a, i32 %b) {
; CHECK-LABEL: f9:
; CHECK: nxrk %r2, %r3, %r4
; CHECK: br %r14
%tmp = xor i32 %a, %b
%ret = xor i32 %tmp, -1
ret i32 %ret
}
; NXOR 64-bit.
define i64 @f10(i64 %dummy, i64 %a, i64 %b) {
; CHECK-LABEL: f10:
; CHECK: nxgrk %r2, %r3, %r4
; CHECK: br %r14
%tmp = xor i64 %a, %b
%ret = xor i64 %tmp, -1
ret i64 %ret
}
; Or-with-complement 32-bit of a constant.
define i32 @f11(i32 %a) {
; CHECK-LABEL: f11:
; CHECK: lhi [[REG:%r[0-5]]], -256
; CHECK: ocrk %r2, [[REG]], %r2
; CHECK: br %r14
%neg = xor i32 %a, -1
%ret = or i32 %neg, -256
ret i32 %ret
}
; Or-with-complement 64-bit of a constant.
define i64 @f12(i64 %a) {
; CHECK-LABEL: f12:
; CHECK: lghi [[REG:%r[0-5]]], -256
; CHECK: ocgrk %r2, [[REG]], %r2
; CHECK: br %r14
%neg = xor i64 %a, -1
%ret = or i64 %neg, -256
ret i64 %ret
}
; NXOR 32-bit (alternate match).
define i32 @f13(i32 %a) {
; CHECK-LABEL: f13:
; CHECK: lhi [[REG:%r[0-5]]], -256
; CHECK: nxrk %r2, %r2, [[REG]]
; CHECK: br %r14
; Use an opaque const so the pattern doesn't get optimized away early.
%const = bitcast i32 -256 to i32
%neg = xor i32 %a, -1
%ret = xor i32 %neg, %const
ret i32 %ret
}
; NXOR 64-bit (alternate match).
define i64 @f14(i64 %a) {
; CHECK-LABEL: f14:
; CHECK: lghi [[REG:%r[0-5]]], -256
; CHECK: nxgrk %r2, %r2, [[REG]]
; CHECK: br %r14
; Use an opaque const so the pattern doesn't get optimized away early.
%const = bitcast i64 -256 to i64
%neg = xor i64 %a, -1
%ret = xor i64 %neg, %const
ret i64 %ret
}