6
6
; RUN: llc -mtriple=riscv32 -mattr=+zbb,+zbs -verify-machineinstrs < %s \
7
7
; RUN: | FileCheck %s --check-prefixes=CHECK,RV32,ZBS
8
8
; RUN: llc -mtriple=riscv64 -mattr=+zbb,+zbs -verify-machineinstrs < %s \
9
- ; RUN: | FileCheck %s --check-prefixes=CHECK,RV64,ZBS
9
+ ; RUN: | FileCheck %s --check-prefixes=CHECK,RV64,ZBS,ZBS64
10
10
11
11
define i32 @and0xabcdefff (i32 %x ) {
12
12
; CHECK-LABEL: and0xabcdefff:
@@ -301,16 +301,16 @@ define i64 @andimm64(i64 %x) {
301
301
ret i64 %and
302
302
}
303
303
304
- define i64 @andimm64srli (i64 %x ) {
305
- ; RV32-LABEL: andimm64srli :
304
+ define i64 @orimm64srli (i64 %x ) {
305
+ ; RV32-LABEL: orimm64srli :
306
306
; RV32: # %bb.0:
307
307
; RV32-NEXT: lui a2, 1040384
308
308
; RV32-NEXT: orn a0, a0, a2
309
309
; RV32-NEXT: lui a2, 917504
310
310
; RV32-NEXT: or a1, a1, a2
311
311
; RV32-NEXT: ret
312
312
;
313
- ; RV64-LABEL: andimm64srli :
313
+ ; RV64-LABEL: orimm64srli :
314
314
; RV64: # %bb.0:
315
315
; RV64-NEXT: lui a1, 983040
316
316
; RV64-NEXT: srli a1, a1, 3
@@ -319,3 +319,48 @@ define i64 @andimm64srli(i64 %x) {
319
319
%or = or i64 %x , -2305843009180139521
320
320
ret i64 %or
321
321
}
322
+
323
+ define i64 @andimm64srli (i64 %x ) {
324
+ ; RV32-LABEL: andimm64srli:
325
+ ; RV32: # %bb.0:
326
+ ; RV32-NEXT: lui a2, 1044480
327
+ ; RV32-NEXT: and a1, a1, a2
328
+ ; RV32-NEXT: andi a0, a0, 255
329
+ ; RV32-NEXT: ret
330
+ ;
331
+ ; RV64-LABEL: andimm64srli:
332
+ ; RV64: # %bb.0:
333
+ ; RV64-NEXT: li a1, -1
334
+ ; RV64-NEXT: slli a1, a1, 56
335
+ ; RV64-NEXT: addi a1, a1, 255
336
+ ; RV64-NEXT: and a0, a0, a1
337
+ ; RV64-NEXT: ret
338
+ %and = and i64 %x , -72057594037927681
339
+ ret i64 %and
340
+ }
341
+
342
+ define i64 @andimm64srli2 (i64 %x ) {
343
+ ; RV32-LABEL: andimm64srli2:
344
+ ; RV32: # %bb.0:
345
+ ; RV32-NEXT: lui a2, 524288
346
+ ; RV32-NEXT: and a1, a1, a2
347
+ ; RV32-NEXT: andi a0, a0, 2047
348
+ ; RV32-NEXT: ret
349
+ ;
350
+ ; NOZBS64-LABEL: andimm64srli2:
351
+ ; NOZBS64: # %bb.0:
352
+ ; NOZBS64-NEXT: li a1, -1
353
+ ; NOZBS64-NEXT: slli a1, a1, 63
354
+ ; NOZBS64-NEXT: addi a1, a1, 2047
355
+ ; NOZBS64-NEXT: and a0, a0, a1
356
+ ; NOZBS64-NEXT: ret
357
+ ;
358
+ ; ZBS64-LABEL: andimm64srli2:
359
+ ; ZBS64: # %bb.0:
360
+ ; ZBS64-NEXT: li a1, 2047
361
+ ; ZBS64-NEXT: bseti a1, a1, 63
362
+ ; ZBS64-NEXT: and a0, a0, a1
363
+ ; ZBS64-NEXT: ret
364
+ %and = and i64 %x , -9223372036854773761
365
+ ret i64 %and
366
+ }
0 commit comments