llvm.org GIT mirror llvm / d244699
use a multipattern to define setcc instructions: X86InstrCMovSetCC.td | 200 ++++++--------------------------------------------- 1 file changed, 27 insertions(+), 173 deletions(-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115689 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
1 changed file(s) with 30 addition(s) and 176 deletion(s). Raw diff Collapse all Expand all
627627 X86_COND_NO, EFLAGS))]>, TB;
628628 } // Constraints = "$src1 = $dst"
629629
630 let Uses = [EFLAGS] in {
631
632 def SETEr : I<0x94, MRM0r,
633 (outs GR8 :$dst), (ins),
634 "sete\t$dst",
635 [(set GR8:$dst, (X86setcc X86_COND_E, EFLAGS))]>,
636 TB; // GR8 = ==
637 def SETEm : I<0x94, MRM0m,
638 (outs), (ins i8mem:$dst),
639 "sete\t$dst",
640 [(store (X86setcc X86_COND_E, EFLAGS), addr:$dst)]>,
641 TB; // [mem8] = ==
642
643 def SETNEr : I<0x95, MRM0r,
644 (outs GR8 :$dst), (ins),
645 "setne\t$dst",
646 [(set GR8:$dst, (X86setcc X86_COND_NE, EFLAGS))]>,
647 TB; // GR8 = !=
648 def SETNEm : I<0x95, MRM0m,
649 (outs), (ins i8mem:$dst),
650 "setne\t$dst",
651 [(store (X86setcc X86_COND_NE, EFLAGS), addr:$dst)]>,
652 TB; // [mem8] = !=
653
654 def SETLr : I<0x9C, MRM0r,
655 (outs GR8 :$dst), (ins),
656 "setl\t$dst",
657 [(set GR8:$dst, (X86setcc X86_COND_L, EFLAGS))]>,
658 TB; // GR8 = < signed
659 def SETLm : I<0x9C, MRM0m,
660 (outs), (ins i8mem:$dst),
661 "setl\t$dst",
662 [(store (X86setcc X86_COND_L, EFLAGS), addr:$dst)]>,
663 TB; // [mem8] = < signed
664
665 def SETGEr : I<0x9D, MRM0r,
666 (outs GR8 :$dst), (ins),
667 "setge\t$dst",
668 [(set GR8:$dst, (X86setcc X86_COND_GE, EFLAGS))]>,
669 TB; // GR8 = >= signed
670 def SETGEm : I<0x9D, MRM0m,
671 (outs), (ins i8mem:$dst),
672 "setge\t$dst",
673 [(store (X86setcc X86_COND_GE, EFLAGS), addr:$dst)]>,
674 TB; // [mem8] = >= signed
675
676 def SETLEr : I<0x9E, MRM0r,
677 (outs GR8 :$dst), (ins),
678 "setle\t$dst",
679 [(set GR8:$dst, (X86setcc X86_COND_LE, EFLAGS))]>,
680 TB; // GR8 = <= signed
681 def SETLEm : I<0x9E, MRM0m,
682 (outs), (ins i8mem:$dst),
683 "setle\t$dst",
684 [(store (X86setcc X86_COND_LE, EFLAGS), addr:$dst)]>,
685 TB; // [mem8] = <= signed
686
687 def SETGr : I<0x9F, MRM0r,
688 (outs GR8 :$dst), (ins),
689 "setg\t$dst",
690 [(set GR8:$dst, (X86setcc X86_COND_G, EFLAGS))]>,
691 TB; // GR8 = > signed
692 def SETGm : I<0x9F, MRM0m,
693 (outs), (ins i8mem:$dst),
694 "setg\t$dst",
695 [(store (X86setcc X86_COND_G, EFLAGS), addr:$dst)]>,
696 TB; // [mem8] = > signed
697
698 def SETBr : I<0x92, MRM0r,
699 (outs GR8 :$dst), (ins),
700 "setb\t$dst",
701 [(set GR8:$dst, (X86setcc X86_COND_B, EFLAGS))]>,
702 TB; // GR8 = < unsign
703 def SETBm : I<0x92, MRM0m,
704 (outs), (ins i8mem:$dst),
705 "setb\t$dst",
706 [(store (X86setcc X86_COND_B, EFLAGS), addr:$dst)]>,
707 TB; // [mem8] = < unsign
708
709 def SETAEr : I<0x93, MRM0r,
710 (outs GR8 :$dst), (ins),
711 "setae\t$dst",
712 [(set GR8:$dst, (X86setcc X86_COND_AE, EFLAGS))]>,
713 TB; // GR8 = >= unsign
714 def SETAEm : I<0x93, MRM0m,
715 (outs), (ins i8mem:$dst),
716 "setae\t$dst",
717 [(store (X86setcc X86_COND_AE, EFLAGS), addr:$dst)]>,
718 TB; // [mem8] = >= unsign
719
720 def SETBEr : I<0x96, MRM0r,
721 (outs GR8 :$dst), (ins),
722 "setbe\t$dst",
723 [(set GR8:$dst, (X86setcc X86_COND_BE, EFLAGS))]>,
724 TB; // GR8 = <= unsign
725 def SETBEm : I<0x96, MRM0m,
726 (outs), (ins i8mem:$dst),
727 "setbe\t$dst",
728 [(store (X86setcc X86_COND_BE, EFLAGS), addr:$dst)]>,
729 TB; // [mem8] = <= unsign
730
731 def SETAr : I<0x97, MRM0r,
732 (outs GR8 :$dst), (ins),
733 "seta\t$dst",
734 [(set GR8:$dst, (X86setcc X86_COND_A, EFLAGS))]>,
735 TB; // GR8 = > signed
736 def SETAm : I<0x97, MRM0m,
737 (outs), (ins i8mem:$dst),
738 "seta\t$dst",
739 [(store (X86setcc X86_COND_A, EFLAGS), addr:$dst)]>,
740 TB; // [mem8] = > signed
741
742 def SETSr : I<0x98, MRM0r,
743 (outs GR8 :$dst), (ins),
744 "sets\t$dst",
745 [(set GR8:$dst, (X86setcc X86_COND_S, EFLAGS))]>,
746 TB; // GR8 =
747 def SETSm : I<0x98, MRM0m,
748 (outs), (ins i8mem:$dst),
749 "sets\t$dst",
750 [(store (X86setcc X86_COND_S, EFLAGS), addr:$dst)]>,
751 TB; // [mem8] =
752 def SETNSr : I<0x99, MRM0r,
753 (outs GR8 :$dst), (ins),
754 "setns\t$dst",
755 [(set GR8:$dst, (X86setcc X86_COND_NS, EFLAGS))]>,
756 TB; // GR8 = !
757 def SETNSm : I<0x99, MRM0m,
758 (outs), (ins i8mem:$dst),
759 "setns\t$dst",
760 [(store (X86setcc X86_COND_NS, EFLAGS), addr:$dst)]>,
761 TB; // [mem8] = !
762
763 def SETPr : I<0x9A, MRM0r,
764 (outs GR8 :$dst), (ins),
765 "setp\t$dst",
766 [(set GR8:$dst, (X86setcc X86_COND_P, EFLAGS))]>,
767 TB; // GR8 = parity
768 def SETPm : I<0x9A, MRM0m,
769 (outs), (ins i8mem:$dst),
770 "setp\t$dst",
771 [(store (X86setcc X86_COND_P, EFLAGS), addr:$dst)]>,
772 TB; // [mem8] = parity
773 def SETNPr : I<0x9B, MRM0r,
774 (outs GR8 :$dst), (ins),
775 "setnp\t$dst",
776 [(set GR8:$dst, (X86setcc X86_COND_NP, EFLAGS))]>,
777 TB; // GR8 = not parity
778 def SETNPm : I<0x9B, MRM0m,
779 (outs), (ins i8mem:$dst),
780 "setnp\t$dst",
781 [(store (X86setcc X86_COND_NP, EFLAGS), addr:$dst)]>,
782 TB; // [mem8] = not parity
783
784 def SETOr : I<0x90, MRM0r,
785 (outs GR8 :$dst), (ins),
786 "seto\t$dst",
787 [(set GR8:$dst, (X86setcc X86_COND_O, EFLAGS))]>,
788 TB; // GR8 = overflow
789 def SETOm : I<0x90, MRM0m,
790 (outs), (ins i8mem:$dst),
791 "seto\t$dst",
792 [(store (X86setcc X86_COND_O, EFLAGS), addr:$dst)]>,
793 TB; // [mem8] = overflow
794 def SETNOr : I<0x91, MRM0r,
795 (outs GR8 :$dst), (ins),
796 "setno\t$dst",
797 [(set GR8:$dst, (X86setcc X86_COND_NO, EFLAGS))]>,
798 TB; // GR8 = not overflow
799 def SETNOm : I<0x91, MRM0m,
800 (outs), (ins i8mem:$dst),
801 "setno\t$dst",
802 [(store (X86setcc X86_COND_NO, EFLAGS), addr:$dst)]>,
803 TB; // [mem8] = not overflow
804 } // Uses = [EFLAGS]
805
630
631 // SetCC instructions.
632 multiclass SETCC opc, string Mnemonic, PatLeaf OpNode> {
633 let Uses = [EFLAGS] in {
634 def r : I
635 !strconcat(Mnemonic, "\t$dst"),
636 [(set GR8:$dst, (X86setcc OpNode, EFLAGS))]>, TB;
637 def m : I
638 !strconcat(Mnemonic, "\t$dst"),
639 [(store (X86setcc OpNode, EFLAGS), addr:$dst)]>, TB;
640 } // Uses = [EFLAGS]
641 }
642
643 defm SETO : SETCC<0x90, "seto", X86_COND_O>; // is overflow bit set
644 defm SETNO : SETCC<0x91, "setno", X86_COND_NO>; // is overflow bit not set
645 defm SETB : SETCC<0x92, "setb", X86_COND_B>; // unsigned less than
646 defm SETAE : SETCC<0x93, "setae", X86_COND_AE>; // unsigned greater or equal
647 defm SETE : SETCC<0x94, "sete", X86_COND_E>; // equal to
648 defm SETNE : SETCC<0x95, "setne", X86_COND_NE>; // not equal to
649 defm SETBE : SETCC<0x96, "setbe", X86_COND_BE>; // unsigned less than or equal
650 defm SETA : SETCC<0x97, "seta", X86_COND_A>; // unsigned greater than
651 defm SETS : SETCC<0x98, "sets", X86_COND_S>; // is signed bit set
652 defm SETNS : SETCC<0x99, "setns", X86_COND_NS>; // is not signed
653 defm SETP : SETCC<0x9A, "setp", X86_COND_P>; // is parity bit set
654 defm SETNP : SETCC<0x9B, "setnp", X86_COND_NP>; // is parity bit not set
655 defm SETL : SETCC<0x9C, "setl", X86_COND_L>; // signed less than
656 defm SETGE : SETCC<0x9D, "setge", X86_COND_GE>; // signed greater or equal
657 defm SETLE : SETCC<0x9E, "setle", X86_COND_LE>; // signed less than or equal
658 defm SETG : SETCC<0x9F, "setg", X86_COND_G>; // signed greater than
659