Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/x87/assembler-x87.cc

Issue 430423002: X87: Land the Fan (disabled) (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x87/assembler-x87.h ('k') | src/x87/assembler-x87-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 EnsureSpace ensure_space(this); 560 EnsureSpace ensure_space(this);
561 if (src.is(eax) || dst.is(eax)) { // Single-byte encoding. 561 if (src.is(eax) || dst.is(eax)) { // Single-byte encoding.
562 EMIT(0x90 | (src.is(eax) ? dst.code() : src.code())); 562 EMIT(0x90 | (src.is(eax) ? dst.code() : src.code()));
563 } else { 563 } else {
564 EMIT(0x87); 564 EMIT(0x87);
565 EMIT(0xC0 | src.code() << 3 | dst.code()); 565 EMIT(0xC0 | src.code() << 3 | dst.code());
566 } 566 }
567 } 567 }
568 568
569 569
570 void Assembler::xchg(Register dst, const Operand& src) {
571 EnsureSpace ensure_space(this);
572 EMIT(0x87);
573 emit_operand(dst, src);
574 }
575
576
570 void Assembler::adc(Register dst, int32_t imm32) { 577 void Assembler::adc(Register dst, int32_t imm32) {
571 EnsureSpace ensure_space(this); 578 EnsureSpace ensure_space(this);
572 emit_arith(2, Operand(dst), Immediate(imm32)); 579 emit_arith(2, Operand(dst), Immediate(imm32));
573 } 580 }
574 581
575 582
576 void Assembler::adc(Register dst, const Operand& src) { 583 void Assembler::adc(Register dst, const Operand& src) {
577 EnsureSpace ensure_space(this); 584 EnsureSpace ensure_space(this);
578 EMIT(0x13); 585 EMIT(0x13);
579 emit_operand(dst, src); 586 emit_operand(dst, src);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 emit_operand(ecx, dst); 750 emit_operand(ecx, dst);
744 } 751 }
745 752
746 753
747 void Assembler::cdq() { 754 void Assembler::cdq() {
748 EnsureSpace ensure_space(this); 755 EnsureSpace ensure_space(this);
749 EMIT(0x99); 756 EMIT(0x99);
750 } 757 }
751 758
752 759
753 void Assembler::idiv(Register src) { 760 void Assembler::idiv(const Operand& src) {
754 EnsureSpace ensure_space(this); 761 EnsureSpace ensure_space(this);
755 EMIT(0xF7); 762 EMIT(0xF7);
756 EMIT(0xF8 | src.code()); 763 emit_operand(edi, src);
757 } 764 }
758 765
759 766
767 void Assembler::div(const Operand& src) {
768 EnsureSpace ensure_space(this);
769 EMIT(0xF7);
770 emit_operand(esi, src);
771 }
772
773
760 void Assembler::imul(Register reg) { 774 void Assembler::imul(Register reg) {
761 EnsureSpace ensure_space(this); 775 EnsureSpace ensure_space(this);
762 EMIT(0xF7); 776 EMIT(0xF7);
763 EMIT(0xE8 | reg.code()); 777 EMIT(0xE8 | reg.code());
764 } 778 }
765 779
766 780
767 void Assembler::imul(Register dst, const Operand& src) { 781 void Assembler::imul(Register dst, const Operand& src) {
768 EnsureSpace ensure_space(this); 782 EnsureSpace ensure_space(this);
769 EMIT(0x0F); 783 EMIT(0x0F);
770 EMIT(0xAF); 784 EMIT(0xAF);
771 emit_operand(dst, src); 785 emit_operand(dst, src);
772 } 786 }
773 787
774 788
775 void Assembler::imul(Register dst, Register src, int32_t imm32) { 789 void Assembler::imul(Register dst, Register src, int32_t imm32) {
790 imul(dst, Operand(src), imm32);
791 }
792
793
794 void Assembler::imul(Register dst, const Operand& src, int32_t imm32) {
776 EnsureSpace ensure_space(this); 795 EnsureSpace ensure_space(this);
777 if (is_int8(imm32)) { 796 if (is_int8(imm32)) {
778 EMIT(0x6B); 797 EMIT(0x6B);
779 EMIT(0xC0 | dst.code() << 3 | src.code()); 798 emit_operand(dst, src);
780 EMIT(imm32); 799 EMIT(imm32);
781 } else { 800 } else {
782 EMIT(0x69); 801 EMIT(0x69);
783 EMIT(0xC0 | dst.code() << 3 | src.code()); 802 emit_operand(dst, src);
784 emit(imm32); 803 emit(imm32);
785 } 804 }
786 } 805 }
787 806
788 807
789 void Assembler::inc(Register dst) { 808 void Assembler::inc(Register dst) {
790 EnsureSpace ensure_space(this); 809 EnsureSpace ensure_space(this);
791 EMIT(0x40 | dst.code()); 810 EMIT(0x40 | dst.code());
792 } 811 }
793 812
(...skipping 19 matching lines...) Expand all
813 } 832 }
814 833
815 834
816 void Assembler::neg(Register dst) { 835 void Assembler::neg(Register dst) {
817 EnsureSpace ensure_space(this); 836 EnsureSpace ensure_space(this);
818 EMIT(0xF7); 837 EMIT(0xF7);
819 EMIT(0xD8 | dst.code()); 838 EMIT(0xD8 | dst.code());
820 } 839 }
821 840
822 841
842 void Assembler::neg(const Operand& dst) {
843 EnsureSpace ensure_space(this);
844 EMIT(0xF7);
845 emit_operand(ebx, dst);
846 }
847
848
823 void Assembler::not_(Register dst) { 849 void Assembler::not_(Register dst) {
824 EnsureSpace ensure_space(this); 850 EnsureSpace ensure_space(this);
825 EMIT(0xF7); 851 EMIT(0xF7);
826 EMIT(0xD0 | dst.code()); 852 EMIT(0xD0 | dst.code());
827 } 853 }
828 854
829 855
856 void Assembler::not_(const Operand& dst) {
857 EnsureSpace ensure_space(this);
858 EMIT(0xF7);
859 emit_operand(edx, dst);
860 }
861
862
830 void Assembler::or_(Register dst, int32_t imm32) { 863 void Assembler::or_(Register dst, int32_t imm32) {
831 EnsureSpace ensure_space(this); 864 EnsureSpace ensure_space(this);
832 emit_arith(1, Operand(dst), Immediate(imm32)); 865 emit_arith(1, Operand(dst), Immediate(imm32));
833 } 866 }
834 867
835 868
836 void Assembler::or_(Register dst, const Operand& src) { 869 void Assembler::or_(Register dst, const Operand& src) {
837 EnsureSpace ensure_space(this); 870 EnsureSpace ensure_space(this);
838 EMIT(0x0B); 871 EMIT(0x0B);
839 emit_operand(dst, src); 872 emit_operand(dst, src);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 } 928 }
896 929
897 930
898 void Assembler::ror_cl(Register dst) { 931 void Assembler::ror_cl(Register dst) {
899 EnsureSpace ensure_space(this); 932 EnsureSpace ensure_space(this);
900 EMIT(0xD3); 933 EMIT(0xD3);
901 EMIT(0xC8 | dst.code()); 934 EMIT(0xC8 | dst.code());
902 } 935 }
903 936
904 937
905 void Assembler::sar(Register dst, uint8_t imm8) { 938 void Assembler::sar(const Operand& dst, uint8_t imm8) {
906 EnsureSpace ensure_space(this); 939 EnsureSpace ensure_space(this);
907 ASSERT(is_uint5(imm8)); // illegal shift count 940 ASSERT(is_uint5(imm8)); // illegal shift count
908 if (imm8 == 1) { 941 if (imm8 == 1) {
909 EMIT(0xD1); 942 EMIT(0xD1);
910 EMIT(0xF8 | dst.code()); 943 emit_operand(edi, dst);
911 } else { 944 } else {
912 EMIT(0xC1); 945 EMIT(0xC1);
913 EMIT(0xF8 | dst.code()); 946 emit_operand(edi, dst);
914 EMIT(imm8); 947 EMIT(imm8);
915 } 948 }
916 } 949 }
917 950
918 951
919 void Assembler::sar_cl(Register dst) { 952 void Assembler::sar_cl(const Operand& dst) {
920 EnsureSpace ensure_space(this); 953 EnsureSpace ensure_space(this);
921 EMIT(0xD3); 954 EMIT(0xD3);
922 EMIT(0xF8 | dst.code()); 955 emit_operand(edi, dst);
923 } 956 }
924 957
925 958
926 void Assembler::sbb(Register dst, const Operand& src) { 959 void Assembler::sbb(Register dst, const Operand& src) {
927 EnsureSpace ensure_space(this); 960 EnsureSpace ensure_space(this);
928 EMIT(0x1B); 961 EMIT(0x1B);
929 emit_operand(dst, src); 962 emit_operand(dst, src);
930 } 963 }
931 964
932 965
933 void Assembler::shld(Register dst, const Operand& src) { 966 void Assembler::shld(Register dst, const Operand& src) {
934 EnsureSpace ensure_space(this); 967 EnsureSpace ensure_space(this);
935 EMIT(0x0F); 968 EMIT(0x0F);
936 EMIT(0xA5); 969 EMIT(0xA5);
937 emit_operand(dst, src); 970 emit_operand(dst, src);
938 } 971 }
939 972
940 973
941 void Assembler::shl(Register dst, uint8_t imm8) { 974 void Assembler::shl(const Operand& dst, uint8_t imm8) {
942 EnsureSpace ensure_space(this); 975 EnsureSpace ensure_space(this);
943 ASSERT(is_uint5(imm8)); // illegal shift count 976 ASSERT(is_uint5(imm8)); // illegal shift count
944 if (imm8 == 1) { 977 if (imm8 == 1) {
945 EMIT(0xD1); 978 EMIT(0xD1);
946 EMIT(0xE0 | dst.code()); 979 emit_operand(esp, dst);
947 } else { 980 } else {
948 EMIT(0xC1); 981 EMIT(0xC1);
949 EMIT(0xE0 | dst.code()); 982 emit_operand(esp, dst);
950 EMIT(imm8); 983 EMIT(imm8);
951 } 984 }
952 } 985 }
953 986
954 987
955 void Assembler::shl_cl(Register dst) { 988 void Assembler::shl_cl(const Operand& dst) {
956 EnsureSpace ensure_space(this); 989 EnsureSpace ensure_space(this);
957 EMIT(0xD3); 990 EMIT(0xD3);
958 EMIT(0xE0 | dst.code()); 991 emit_operand(esp, dst);
959 } 992 }
960 993
961 994
962 void Assembler::shrd(Register dst, const Operand& src) { 995 void Assembler::shrd(Register dst, const Operand& src) {
963 EnsureSpace ensure_space(this); 996 EnsureSpace ensure_space(this);
964 EMIT(0x0F); 997 EMIT(0x0F);
965 EMIT(0xAD); 998 EMIT(0xAD);
966 emit_operand(dst, src); 999 emit_operand(dst, src);
967 } 1000 }
968 1001
969 1002
970 void Assembler::shr(Register dst, uint8_t imm8) { 1003 void Assembler::shr(const Operand& dst, uint8_t imm8) {
971 EnsureSpace ensure_space(this); 1004 EnsureSpace ensure_space(this);
972 ASSERT(is_uint5(imm8)); // illegal shift count 1005 ASSERT(is_uint5(imm8)); // illegal shift count
973 if (imm8 == 1) { 1006 if (imm8 == 1) {
974 EMIT(0xD1); 1007 EMIT(0xD1);
975 EMIT(0xE8 | dst.code()); 1008 emit_operand(ebp, dst);
976 } else { 1009 } else {
977 EMIT(0xC1); 1010 EMIT(0xC1);
978 EMIT(0xE8 | dst.code()); 1011 emit_operand(ebp, dst);
979 EMIT(imm8); 1012 EMIT(imm8);
980 } 1013 }
981 } 1014 }
982 1015
983 1016
984 void Assembler::shr_cl(Register dst) { 1017 void Assembler::shr_cl(const Operand& dst) {
985 EnsureSpace ensure_space(this); 1018 EnsureSpace ensure_space(this);
986 EMIT(0xD3); 1019 EMIT(0xD3);
987 EMIT(0xE8 | dst.code()); 1020 emit_operand(ebp, dst);
988 } 1021 }
989 1022
990 1023
991 void Assembler::sub(const Operand& dst, const Immediate& x) { 1024 void Assembler::sub(const Operand& dst, const Immediate& x) {
992 EnsureSpace ensure_space(this); 1025 EnsureSpace ensure_space(this);
993 emit_arith(5, dst, x); 1026 emit_arith(5, dst, x);
994 } 1027 }
995 1028
996 1029
997 void Assembler::sub(Register dst, const Operand& src) { 1030 void Assembler::sub(Register dst, const Operand& src) {
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 fprintf(coverage_log, "%s\n", file_line); 2053 fprintf(coverage_log, "%s\n", file_line);
2021 fflush(coverage_log); 2054 fflush(coverage_log);
2022 } 2055 }
2023 } 2056 }
2024 2057
2025 #endif 2058 #endif
2026 2059
2027 } } // namespace v8::internal 2060 } } // namespace v8::internal
2028 2061
2029 #endif // V8_TARGET_ARCH_X87 2062 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/assembler-x87.h ('k') | src/x87/assembler-x87-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698