Skip to content

Commit cb3eb7a

Browse files
committed
[RISCV] Precommit tests for override hasAndNotCompare.
Precommit tests for D115922. Differential Revision: https://reviews.llvm.org/D116013
1 parent 0a3258f commit cb3eb7a

File tree

2 files changed

+218
-0
lines changed

2 files changed

+218
-0
lines changed

llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,3 +557,117 @@ define i16 @srai_i16(i16 %a) nounwind {
557557
%1 = ashr i16 %a, 9
558558
ret i16 %1
559559
}
560+
561+
define i1 @andn_seqz_i32(i32 %a, i32 %b) nounwind {
562+
; RV32I-LABEL: andn_seqz_i32:
563+
; RV32I: # %bb.0:
564+
; RV32I-NEXT: and a0, a0, a1
565+
; RV32I-NEXT: xor a0, a0, a1
566+
; RV32I-NEXT: seqz a0, a0
567+
; RV32I-NEXT: ret
568+
;
569+
; RV32ZBB-LABEL: andn_seqz_i32:
570+
; RV32ZBB: # %bb.0:
571+
; RV32ZBB-NEXT: and a0, a0, a1
572+
; RV32ZBB-NEXT: xor a0, a0, a1
573+
; RV32ZBB-NEXT: seqz a0, a0
574+
; RV32ZBB-NEXT: ret
575+
;
576+
; RV32ZBP-LABEL: andn_seqz_i32:
577+
; RV32ZBP: # %bb.0:
578+
; RV32ZBP-NEXT: and a0, a0, a1
579+
; RV32ZBP-NEXT: xor a0, a0, a1
580+
; RV32ZBP-NEXT: seqz a0, a0
581+
; RV32ZBP-NEXT: ret
582+
%and = and i32 %a, %b
583+
%cmpeq = icmp eq i32 %and, %b
584+
ret i1 %cmpeq
585+
}
586+
587+
define i1 @andn_seqz_i64(i64 %a, i64 %b) nounwind {
588+
; RV32I-LABEL: andn_seqz_i64:
589+
; RV32I: # %bb.0:
590+
; RV32I-NEXT: not a0, a0
591+
; RV32I-NEXT: not a1, a1
592+
; RV32I-NEXT: and a1, a1, a3
593+
; RV32I-NEXT: and a0, a0, a2
594+
; RV32I-NEXT: or a0, a0, a1
595+
; RV32I-NEXT: seqz a0, a0
596+
; RV32I-NEXT: ret
597+
;
598+
; RV32ZBB-LABEL: andn_seqz_i64:
599+
; RV32ZBB: # %bb.0:
600+
; RV32ZBB-NEXT: andn a1, a3, a1
601+
; RV32ZBB-NEXT: andn a0, a2, a0
602+
; RV32ZBB-NEXT: or a0, a0, a1
603+
; RV32ZBB-NEXT: seqz a0, a0
604+
; RV32ZBB-NEXT: ret
605+
;
606+
; RV32ZBP-LABEL: andn_seqz_i64:
607+
; RV32ZBP: # %bb.0:
608+
; RV32ZBP-NEXT: andn a1, a3, a1
609+
; RV32ZBP-NEXT: andn a0, a2, a0
610+
; RV32ZBP-NEXT: or a0, a0, a1
611+
; RV32ZBP-NEXT: seqz a0, a0
612+
; RV32ZBP-NEXT: ret
613+
%and = and i64 %a, %b
614+
%cmpeq = icmp eq i64 %and, %b
615+
ret i1 %cmpeq
616+
}
617+
618+
define i1 @andn_snez_i32(i32 %a, i32 %b) nounwind {
619+
; RV32I-LABEL: andn_snez_i32:
620+
; RV32I: # %bb.0:
621+
; RV32I-NEXT: and a0, a0, a1
622+
; RV32I-NEXT: xor a0, a0, a1
623+
; RV32I-NEXT: snez a0, a0
624+
; RV32I-NEXT: ret
625+
;
626+
; RV32ZBB-LABEL: andn_snez_i32:
627+
; RV32ZBB: # %bb.0:
628+
; RV32ZBB-NEXT: and a0, a0, a1
629+
; RV32ZBB-NEXT: xor a0, a0, a1
630+
; RV32ZBB-NEXT: snez a0, a0
631+
; RV32ZBB-NEXT: ret
632+
;
633+
; RV32ZBP-LABEL: andn_snez_i32:
634+
; RV32ZBP: # %bb.0:
635+
; RV32ZBP-NEXT: and a0, a0, a1
636+
; RV32ZBP-NEXT: xor a0, a0, a1
637+
; RV32ZBP-NEXT: snez a0, a0
638+
; RV32ZBP-NEXT: ret
639+
%and = and i32 %a, %b
640+
%cmpeq = icmp ne i32 %and, %b
641+
ret i1 %cmpeq
642+
}
643+
644+
define i1 @andn_snez_i64(i64 %a, i64 %b) nounwind {
645+
; RV32I-LABEL: andn_snez_i64:
646+
; RV32I: # %bb.0:
647+
; RV32I-NEXT: not a0, a0
648+
; RV32I-NEXT: not a1, a1
649+
; RV32I-NEXT: and a1, a1, a3
650+
; RV32I-NEXT: and a0, a0, a2
651+
; RV32I-NEXT: or a0, a0, a1
652+
; RV32I-NEXT: snez a0, a0
653+
; RV32I-NEXT: ret
654+
;
655+
; RV32ZBB-LABEL: andn_snez_i64:
656+
; RV32ZBB: # %bb.0:
657+
; RV32ZBB-NEXT: andn a1, a3, a1
658+
; RV32ZBB-NEXT: andn a0, a2, a0
659+
; RV32ZBB-NEXT: or a0, a0, a1
660+
; RV32ZBB-NEXT: snez a0, a0
661+
; RV32ZBB-NEXT: ret
662+
;
663+
; RV32ZBP-LABEL: andn_snez_i64:
664+
; RV32ZBP: # %bb.0:
665+
; RV32ZBP-NEXT: andn a1, a3, a1
666+
; RV32ZBP-NEXT: andn a0, a2, a0
667+
; RV32ZBP-NEXT: or a0, a0, a1
668+
; RV32ZBP-NEXT: snez a0, a0
669+
; RV32ZBP-NEXT: ret
670+
%and = and i64 %a, %b
671+
%cmpeq = icmp ne i64 %and, %b
672+
ret i1 %cmpeq
673+
}

llvm/test/CodeGen/RISCV/rv64zbb-zbp.ll

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,3 +628,107 @@ define i16 @srai_i16(i16 %a) nounwind {
628628
%1 = ashr i16 %a, 9
629629
ret i16 %1
630630
}
631+
632+
define i1 @andn_seqz_i32(i32 signext %a, i32 signext %b) nounwind {
633+
; RV64I-LABEL: andn_seqz_i32:
634+
; RV64I: # %bb.0:
635+
; RV64I-NEXT: and a0, a0, a1
636+
; RV64I-NEXT: xor a0, a0, a1
637+
; RV64I-NEXT: seqz a0, a0
638+
; RV64I-NEXT: ret
639+
;
640+
; RV64ZBB-LABEL: andn_seqz_i32:
641+
; RV64ZBB: # %bb.0:
642+
; RV64ZBB-NEXT: and a0, a0, a1
643+
; RV64ZBB-NEXT: xor a0, a0, a1
644+
; RV64ZBB-NEXT: seqz a0, a0
645+
; RV64ZBB-NEXT: ret
646+
;
647+
; RV64ZBP-LABEL: andn_seqz_i32:
648+
; RV64ZBP: # %bb.0:
649+
; RV64ZBP-NEXT: and a0, a0, a1
650+
; RV64ZBP-NEXT: xor a0, a0, a1
651+
; RV64ZBP-NEXT: seqz a0, a0
652+
; RV64ZBP-NEXT: ret
653+
%and = and i32 %a, %b
654+
%cmpeq = icmp eq i32 %and, %b
655+
ret i1 %cmpeq
656+
}
657+
658+
define i1 @andn_seqz_i64(i64 %a, i64 %b) nounwind {
659+
; RV64I-LABEL: andn_seqz_i64:
660+
; RV64I: # %bb.0:
661+
; RV64I-NEXT: and a0, a0, a1
662+
; RV64I-NEXT: xor a0, a0, a1
663+
; RV64I-NEXT: seqz a0, a0
664+
; RV64I-NEXT: ret
665+
;
666+
; RV64ZBB-LABEL: andn_seqz_i64:
667+
; RV64ZBB: # %bb.0:
668+
; RV64ZBB-NEXT: and a0, a0, a1
669+
; RV64ZBB-NEXT: xor a0, a0, a1
670+
; RV64ZBB-NEXT: seqz a0, a0
671+
; RV64ZBB-NEXT: ret
672+
;
673+
; RV64ZBP-LABEL: andn_seqz_i64:
674+
; RV64ZBP: # %bb.0:
675+
; RV64ZBP-NEXT: and a0, a0, a1
676+
; RV64ZBP-NEXT: xor a0, a0, a1
677+
; RV64ZBP-NEXT: seqz a0, a0
678+
; RV64ZBP-NEXT: ret
679+
%and = and i64 %a, %b
680+
%cmpeq = icmp eq i64 %and, %b
681+
ret i1 %cmpeq
682+
}
683+
684+
define i1 @andn_snez_i32(i32 signext %a, i32 signext %b) nounwind {
685+
; RV64I-LABEL: andn_snez_i32:
686+
; RV64I: # %bb.0:
687+
; RV64I-NEXT: and a0, a0, a1
688+
; RV64I-NEXT: xor a0, a0, a1
689+
; RV64I-NEXT: snez a0, a0
690+
; RV64I-NEXT: ret
691+
;
692+
; RV64ZBB-LABEL: andn_snez_i32:
693+
; RV64ZBB: # %bb.0:
694+
; RV64ZBB-NEXT: and a0, a0, a1
695+
; RV64ZBB-NEXT: xor a0, a0, a1
696+
; RV64ZBB-NEXT: snez a0, a0
697+
; RV64ZBB-NEXT: ret
698+
;
699+
; RV64ZBP-LABEL: andn_snez_i32:
700+
; RV64ZBP: # %bb.0:
701+
; RV64ZBP-NEXT: and a0, a0, a1
702+
; RV64ZBP-NEXT: xor a0, a0, a1
703+
; RV64ZBP-NEXT: snez a0, a0
704+
; RV64ZBP-NEXT: ret
705+
%and = and i32 %a, %b
706+
%cmpeq = icmp ne i32 %and, %b
707+
ret i1 %cmpeq
708+
}
709+
710+
define i1 @andn_snez_i64(i64 %a, i64 %b) nounwind {
711+
; RV64I-LABEL: andn_snez_i64:
712+
; RV64I: # %bb.0:
713+
; RV64I-NEXT: and a0, a0, a1
714+
; RV64I-NEXT: xor a0, a0, a1
715+
; RV64I-NEXT: snez a0, a0
716+
; RV64I-NEXT: ret
717+
;
718+
; RV64ZBB-LABEL: andn_snez_i64:
719+
; RV64ZBB: # %bb.0:
720+
; RV64ZBB-NEXT: and a0, a0, a1
721+
; RV64ZBB-NEXT: xor a0, a0, a1
722+
; RV64ZBB-NEXT: snez a0, a0
723+
; RV64ZBB-NEXT: ret
724+
;
725+
; RV64ZBP-LABEL: andn_snez_i64:
726+
; RV64ZBP: # %bb.0:
727+
; RV64ZBP-NEXT: and a0, a0, a1
728+
; RV64ZBP-NEXT: xor a0, a0, a1
729+
; RV64ZBP-NEXT: snez a0, a0
730+
; RV64ZBP-NEXT: ret
731+
%and = and i64 %a, %b
732+
%cmpeq = icmp ne i64 %and, %b
733+
ret i1 %cmpeq
734+
}

0 commit comments

Comments
 (0)