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

Side by Side Diff: src/compiler/x64/code-generator-x64.cc

Issue 1072343002: [x86] Introduce vandps/vandpd/vxorps/vxorpd. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 ASSEMBLE_SSE_BINOP(subss); 722 ASSEMBLE_SSE_BINOP(subss);
723 break; 723 break;
724 case kSSEFloat32Mul: 724 case kSSEFloat32Mul:
725 ASSEMBLE_SSE_BINOP(mulss); 725 ASSEMBLE_SSE_BINOP(mulss);
726 break; 726 break;
727 case kSSEFloat32Div: 727 case kSSEFloat32Div:
728 ASSEMBLE_SSE_BINOP(divss); 728 ASSEMBLE_SSE_BINOP(divss);
729 break; 729 break;
730 case kSSEFloat32Abs: { 730 case kSSEFloat32Abs: {
731 // TODO(bmeurer): Use RIP relative 128-bit constants. 731 // TODO(bmeurer): Use RIP relative 128-bit constants.
732 // TODO(turbofan): Add AVX version with relaxed register constraints.
733 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 732 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
734 __ psrlq(kScratchDoubleReg, 33); 733 __ psrlq(kScratchDoubleReg, 33);
735 __ andps(i.OutputDoubleRegister(), kScratchDoubleReg); 734 __ andps(i.OutputDoubleRegister(), kScratchDoubleReg);
736 break; 735 break;
737 } 736 }
738 case kSSEFloat32Neg: { 737 case kSSEFloat32Neg: {
739 // TODO(bmeurer): Use RIP relative 128-bit constants. 738 // TODO(bmeurer): Use RIP relative 128-bit constants.
740 // TODO(turbofan): Add AVX version with relaxed register constraints.
741 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 739 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
742 __ psllq(kScratchDoubleReg, 31); 740 __ psllq(kScratchDoubleReg, 31);
743 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg); 741 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg);
744 break; 742 break;
745 } 743 }
746 case kSSEFloat32Sqrt: 744 case kSSEFloat32Sqrt:
747 ASSEMBLE_SSE_UNOP(sqrtss); 745 ASSEMBLE_SSE_UNOP(sqrtss);
748 break; 746 break;
749 case kSSEFloat32Max: 747 case kSSEFloat32Max:
750 ASSEMBLE_SSE_BINOP(maxss); 748 ASSEMBLE_SSE_BINOP(maxss);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 break; 801 break;
804 } 802 }
805 case kSSEFloat64Max: 803 case kSSEFloat64Max:
806 ASSEMBLE_SSE_BINOP(maxsd); 804 ASSEMBLE_SSE_BINOP(maxsd);
807 break; 805 break;
808 case kSSEFloat64Min: 806 case kSSEFloat64Min:
809 ASSEMBLE_SSE_BINOP(minsd); 807 ASSEMBLE_SSE_BINOP(minsd);
810 break; 808 break;
811 case kSSEFloat64Abs: { 809 case kSSEFloat64Abs: {
812 // TODO(bmeurer): Use RIP relative 128-bit constants. 810 // TODO(bmeurer): Use RIP relative 128-bit constants.
813 // TODO(turbofan): Add AVX version with relaxed register constraints.
814 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 811 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
815 __ psrlq(kScratchDoubleReg, 1); 812 __ psrlq(kScratchDoubleReg, 1);
816 __ andpd(i.OutputDoubleRegister(), kScratchDoubleReg); 813 __ andpd(i.OutputDoubleRegister(), kScratchDoubleReg);
817 break; 814 break;
818 } 815 }
819 case kSSEFloat64Neg: { 816 case kSSEFloat64Neg: {
820 // TODO(bmeurer): Use RIP relative 128-bit constants. 817 // TODO(bmeurer): Use RIP relative 128-bit constants.
821 // TODO(turbofan): Add AVX version with relaxed register constraints.
822 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 818 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
823 __ psllq(kScratchDoubleReg, 63); 819 __ psllq(kScratchDoubleReg, 63);
824 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); 820 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg);
825 break; 821 break;
826 } 822 }
827 case kSSEFloat64Sqrt: 823 case kSSEFloat64Sqrt:
828 ASSEMBLE_SSE_UNOP(sqrtsd); 824 ASSEMBLE_SSE_UNOP(sqrtsd);
829 break; 825 break;
830 case kSSEFloat64Round: { 826 case kSSEFloat64Round: {
831 CpuFeatureScope sse_scope(masm(), SSE4_1); 827 CpuFeatureScope sse_scope(masm(), SSE4_1);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 break; 946 break;
951 case kAVXFloat64Div: 947 case kAVXFloat64Div:
952 ASSEMBLE_AVX_BINOP(vdivsd); 948 ASSEMBLE_AVX_BINOP(vdivsd);
953 break; 949 break;
954 case kAVXFloat64Max: 950 case kAVXFloat64Max:
955 ASSEMBLE_AVX_BINOP(vmaxsd); 951 ASSEMBLE_AVX_BINOP(vmaxsd);
956 break; 952 break;
957 case kAVXFloat64Min: 953 case kAVXFloat64Min:
958 ASSEMBLE_AVX_BINOP(vminsd); 954 ASSEMBLE_AVX_BINOP(vminsd);
959 break; 955 break;
956 case kAVXFloat32Abs: {
957 // TODO(bmeurer): Use RIP relative 128-bit constants.
958 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
959 __ psrlq(kScratchDoubleReg, 33);
960 CpuFeatureScope avx_scope(masm(), AVX);
961 if (instr->InputAt(0)->IsDoubleRegister()) {
962 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg,
963 i.InputDoubleRegister(0));
964 } else {
965 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg,
966 i.InputOperand(0));
967 }
968 break;
969 }
970 case kAVXFloat32Neg: {
971 // TODO(bmeurer): Use RIP relative 128-bit constants.
972 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
973 __ psllq(kScratchDoubleReg, 31);
974 CpuFeatureScope avx_scope(masm(), AVX);
975 if (instr->InputAt(0)->IsDoubleRegister()) {
976 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg,
977 i.InputDoubleRegister(0));
978 } else {
979 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg,
980 i.InputOperand(0));
981 }
982 break;
983 }
984 case kAVXFloat64Abs: {
985 // TODO(bmeurer): Use RIP relative 128-bit constants.
986 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
987 __ psrlq(kScratchDoubleReg, 1);
988 CpuFeatureScope avx_scope(masm(), AVX);
989 if (instr->InputAt(0)->IsDoubleRegister()) {
990 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg,
991 i.InputDoubleRegister(0));
992 } else {
993 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg,
994 i.InputOperand(0));
995 }
996 break;
997 }
998 case kAVXFloat64Neg: {
999 // TODO(bmeurer): Use RIP relative 128-bit constants.
1000 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
1001 __ psllq(kScratchDoubleReg, 63);
1002 CpuFeatureScope avx_scope(masm(), AVX);
1003 if (instr->InputAt(0)->IsDoubleRegister()) {
1004 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg,
1005 i.InputDoubleRegister(0));
1006 } else {
1007 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg,
1008 i.InputOperand(0));
1009 }
1010 break;
1011 }
960 case kX64Movsxbl: 1012 case kX64Movsxbl:
961 ASSEMBLE_MOVX(movsxbl); 1013 ASSEMBLE_MOVX(movsxbl);
962 __ AssertZeroExtended(i.OutputRegister()); 1014 __ AssertZeroExtended(i.OutputRegister());
963 break; 1015 break;
964 case kX64Movzxbl: 1016 case kX64Movzxbl:
965 ASSEMBLE_MOVX(movzxbl); 1017 ASSEMBLE_MOVX(movzxbl);
966 __ AssertZeroExtended(i.OutputRegister()); 1018 __ AssertZeroExtended(i.OutputRegister());
967 break; 1019 break;
968 case kX64Movb: { 1020 case kX64Movb: {
969 size_t index = 0; 1021 size_t index = 0;
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 } 1658 }
1607 } 1659 }
1608 MarkLazyDeoptSite(); 1660 MarkLazyDeoptSite();
1609 } 1661 }
1610 1662
1611 #undef __ 1663 #undef __
1612 1664
1613 } // namespace internal 1665 } // namespace internal
1614 } // namespace compiler 1666 } // namespace compiler
1615 } // namespace v8 1667 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/x64/instruction-codes-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698