1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
5 ;; Exercise the 'or' LLVM IR: https://llvm.org/docs/LangRef.html#or-instruction
7 define i1 @or_i1(i1 %a, i1 %b) {
9 ; LA32: # %bb.0: # %entry
10 ; LA32-NEXT: or $a0, $a0, $a1
14 ; LA64: # %bb.0: # %entry
15 ; LA64-NEXT: or $a0, $a0, $a1
22 define i8 @or_i8(i8 %a, i8 %b) {
24 ; LA32: # %bb.0: # %entry
25 ; LA32-NEXT: or $a0, $a0, $a1
29 ; LA64: # %bb.0: # %entry
30 ; LA64-NEXT: or $a0, $a0, $a1
37 define i16 @or_i16(i16 %a, i16 %b) {
39 ; LA32: # %bb.0: # %entry
40 ; LA32-NEXT: or $a0, $a0, $a1
44 ; LA64: # %bb.0: # %entry
45 ; LA64-NEXT: or $a0, $a0, $a1
52 define i32 @or_i32(i32 %a, i32 %b) {
54 ; LA32: # %bb.0: # %entry
55 ; LA32-NEXT: or $a0, $a0, $a1
59 ; LA64: # %bb.0: # %entry
60 ; LA64-NEXT: or $a0, $a0, $a1
67 define i64 @or_i64(i64 %a, i64 %b) {
69 ; LA32: # %bb.0: # %entry
70 ; LA32-NEXT: or $a0, $a0, $a2
71 ; LA32-NEXT: or $a1, $a1, $a3
75 ; LA64: # %bb.0: # %entry
76 ; LA64-NEXT: or $a0, $a0, $a1
83 define i1 @or_i1_0(i1 %b) {
84 ; LA32-LABEL: or_i1_0:
85 ; LA32: # %bb.0: # %entry
88 ; LA64-LABEL: or_i1_0:
89 ; LA64: # %bb.0: # %entry
96 define i1 @or_i1_5(i1 %b) {
97 ; LA32-LABEL: or_i1_5:
98 ; LA32: # %bb.0: # %entry
99 ; LA32-NEXT: ori $a0, $zero, 1
102 ; LA64-LABEL: or_i1_5:
103 ; LA64: # %bb.0: # %entry
104 ; LA64-NEXT: ori $a0, $zero, 1
111 define i8 @or_i8_5(i8 %b) {
112 ; LA32-LABEL: or_i8_5:
113 ; LA32: # %bb.0: # %entry
114 ; LA32-NEXT: ori $a0, $a0, 5
117 ; LA64-LABEL: or_i8_5:
118 ; LA64: # %bb.0: # %entry
119 ; LA64-NEXT: ori $a0, $a0, 5
126 define i8 @or_i8_257(i8 %b) {
127 ; LA32-LABEL: or_i8_257:
128 ; LA32: # %bb.0: # %entry
129 ; LA32-NEXT: ori $a0, $a0, 1
132 ; LA64-LABEL: or_i8_257:
133 ; LA64: # %bb.0: # %entry
134 ; LA64-NEXT: ori $a0, $a0, 1
141 define i16 @or_i16_5(i16 %b) {
142 ; LA32-LABEL: or_i16_5:
143 ; LA32: # %bb.0: # %entry
144 ; LA32-NEXT: ori $a0, $a0, 5
147 ; LA64-LABEL: or_i16_5:
148 ; LA64: # %bb.0: # %entry
149 ; LA64-NEXT: ori $a0, $a0, 5
156 define i16 @or_i16_0x1000(i16 %b) {
157 ; LA32-LABEL: or_i16_0x1000:
158 ; LA32: # %bb.0: # %entry
159 ; LA32-NEXT: lu12i.w $a1, 1
160 ; LA32-NEXT: or $a0, $a0, $a1
163 ; LA64-LABEL: or_i16_0x1000:
164 ; LA64: # %bb.0: # %entry
165 ; LA64-NEXT: lu12i.w $a1, 1
166 ; LA64-NEXT: or $a0, $a0, $a1
173 define i16 @or_i16_0x10001(i16 %b) {
174 ; LA32-LABEL: or_i16_0x10001:
175 ; LA32: # %bb.0: # %entry
176 ; LA32-NEXT: ori $a0, $a0, 1
179 ; LA64-LABEL: or_i16_0x10001:
180 ; LA64: # %bb.0: # %entry
181 ; LA64-NEXT: ori $a0, $a0, 1
184 %r = or i16 65537, %b
188 define i32 @or_i32_5(i32 %b) {
189 ; LA32-LABEL: or_i32_5:
190 ; LA32: # %bb.0: # %entry
191 ; LA32-NEXT: ori $a0, $a0, 5
194 ; LA64-LABEL: or_i32_5:
195 ; LA64: # %bb.0: # %entry
196 ; LA64-NEXT: ori $a0, $a0, 5
203 define i32 @or_i32_0x1000(i32 %b) {
204 ; LA32-LABEL: or_i32_0x1000:
205 ; LA32: # %bb.0: # %entry
206 ; LA32-NEXT: lu12i.w $a1, 1
207 ; LA32-NEXT: or $a0, $a0, $a1
210 ; LA64-LABEL: or_i32_0x1000:
211 ; LA64: # %bb.0: # %entry
212 ; LA64-NEXT: lu12i.w $a1, 1
213 ; LA64-NEXT: or $a0, $a0, $a1
220 define i32 @or_i32_0x100000001(i32 %b) {
221 ; LA32-LABEL: or_i32_0x100000001:
222 ; LA32: # %bb.0: # %entry
223 ; LA32-NEXT: ori $a0, $a0, 1
226 ; LA64-LABEL: or_i32_0x100000001:
227 ; LA64: # %bb.0: # %entry
228 ; LA64-NEXT: ori $a0, $a0, 1
231 %r = or i32 4294967297, %b
235 define i64 @or_i64_5(i64 %b) {
236 ; LA32-LABEL: or_i64_5:
237 ; LA32: # %bb.0: # %entry
238 ; LA32-NEXT: ori $a0, $a0, 5
241 ; LA64-LABEL: or_i64_5:
242 ; LA64: # %bb.0: # %entry
243 ; LA64-NEXT: ori $a0, $a0, 5
250 define i64 @or_i64_0x1000(i64 %b) {
251 ; LA32-LABEL: or_i64_0x1000:
252 ; LA32: # %bb.0: # %entry
253 ; LA32-NEXT: lu12i.w $a2, 1
254 ; LA32-NEXT: or $a0, $a0, $a2
257 ; LA64-LABEL: or_i64_0x1000:
258 ; LA64: # %bb.0: # %entry
259 ; LA64-NEXT: lu12i.w $a1, 1
260 ; LA64-NEXT: or $a0, $a0, $a1