44; RUN: llc -mtriple=riscv64 -mattr=+zbb -verify-machineinstrs < %s \
55; RUN: | FileCheck %s --check-prefixes=CHECK,RV64,NOZBS64
66; RUN: llc -mtriple=riscv32 -mattr=+zbb,+zbs -verify-machineinstrs < %s \
7- ; RUN: | FileCheck %s --check-prefixes=CHECK,RV32,ZBS
7+ ; RUN: | FileCheck %s --check-prefixes=CHECK,RV32,ZBS,ZBS32
88; 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
1010
1111define i32 @and0xabcdefff (i32 %x ) {
1212; CHECK-LABEL: and0xabcdefff:
@@ -301,16 +301,16 @@ define i64 @andimm64(i64 %x) {
301301 ret i64 %and
302302}
303303
304- define i64 @andimm64srli (i64 %x ) {
305- ; RV32-LABEL: andimm64srli :
304+ define i64 @orimm64srli (i64 %x ) {
305+ ; RV32-LABEL: orimm64srli :
306306; RV32: # %bb.0:
307307; RV32-NEXT: lui a2, 1040384
308308; RV32-NEXT: orn a0, a0, a2
309309; RV32-NEXT: lui a2, 917504
310310; RV32-NEXT: or a1, a1, a2
311311; RV32-NEXT: ret
312312;
313- ; RV64-LABEL: andimm64srli :
313+ ; RV64-LABEL: orimm64srli :
314314; RV64: # %bb.0:
315315; RV64-NEXT: lui a1, 983040
316316; RV64-NEXT: srli a1, a1, 3
@@ -319,3 +319,72 @@ define i64 @andimm64srli(i64 %x) {
319319 %or = or i64 %x , -2305843009180139521
320320 ret i64 %or
321321}
322+
323+ define i64 @andnofff (i64 %x ) {
324+ ; RV32-LABEL: andnofff:
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: andnofff:
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 @ornofff (i64 %x ) {
343+ ; NOZBS32-LABEL: ornofff:
344+ ; NOZBS32: # %bb.0:
345+ ; NOZBS32-NEXT: lui a2, 524288
346+ ; NOZBS32-NEXT: or a1, a1, a2
347+ ; NOZBS32-NEXT: ori a0, a0, 2047
348+ ; NOZBS32-NEXT: ret
349+ ;
350+ ; NOZBS64-LABEL: ornofff:
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: or a0, a0, a1
356+ ; NOZBS64-NEXT: ret
357+ ;
358+ ; ZBS32-LABEL: ornofff:
359+ ; ZBS32: # %bb.0:
360+ ; ZBS32-NEXT: ori a0, a0, 2047
361+ ; ZBS32-NEXT: bseti a1, a1, 31
362+ ; ZBS32-NEXT: ret
363+ ;
364+ ; ZBS64-LABEL: ornofff:
365+ ; ZBS64: # %bb.0:
366+ ; ZBS64-NEXT: ori a0, a0, 2047
367+ ; ZBS64-NEXT: bseti a0, a0, 63
368+ ; ZBS64-NEXT: ret
369+ %or = or i64 %x , -9223372036854773761
370+ ret i64 %or
371+ }
372+
373+ define i64 @xornofff (i64 %x ) {
374+ ; RV32-LABEL: xornofff:
375+ ; RV32: # %bb.0:
376+ ; RV32-NEXT: lui a2, 983040
377+ ; RV32-NEXT: xor a1, a1, a2
378+ ; RV32-NEXT: xori a0, a0, 255
379+ ; RV32-NEXT: ret
380+ ;
381+ ; RV64-LABEL: xornofff:
382+ ; RV64: # %bb.0:
383+ ; RV64-NEXT: li a1, -1
384+ ; RV64-NEXT: slli a1, a1, 60
385+ ; RV64-NEXT: addi a1, a1, 255
386+ ; RV64-NEXT: xor a0, a0, a1
387+ ; RV64-NEXT: ret
388+ %xor = xor i64 %x , -1152921504606846721
389+ ret i64 %xor
390+ }
0 commit comments