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

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

Issue 2637583002: [wasm] Fix codegen issue for i64.add and i64.sub on ia32 (Closed)
Patch Set: Rebasing Created 3 years, 11 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 | « no previous file | test/cctest/wasm/test-run-wasm-64.cc » ('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 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/compilation-info.h" 7 #include "src/compilation-info.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 if (i.OutputRegister(0).code() == i.InputRegister(1).code() || 884 if (i.OutputRegister(0).code() == i.InputRegister(1).code() ||
885 i.OutputRegister(0).code() == i.InputRegister(3).code()) { 885 i.OutputRegister(0).code() == i.InputRegister(3).code()) {
886 // We cannot write to the output register directly, because it would 886 // We cannot write to the output register directly, because it would
887 // overwrite an input for adc. We have to use the temp register. 887 // overwrite an input for adc. We have to use the temp register.
888 use_temp = true; 888 use_temp = true;
889 __ Move(i.TempRegister(0), i.InputRegister(0)); 889 __ Move(i.TempRegister(0), i.InputRegister(0));
890 __ add(i.TempRegister(0), i.InputRegister(2)); 890 __ add(i.TempRegister(0), i.InputRegister(2));
891 } else { 891 } else {
892 __ add(i.OutputRegister(0), i.InputRegister(2)); 892 __ add(i.OutputRegister(0), i.InputRegister(2));
893 } 893 }
894 __ adc(i.InputRegister(1), Operand(i.InputRegister(3)));
895 if (i.OutputRegister(1).code() != i.InputRegister(1).code()) { 894 if (i.OutputRegister(1).code() != i.InputRegister(1).code()) {
896 __ Move(i.OutputRegister(1), i.InputRegister(1)); 895 __ Move(i.OutputRegister(1), i.InputRegister(1));
897 } 896 }
897 __ adc(i.OutputRegister(1), Operand(i.InputRegister(3)));
898 if (use_temp) { 898 if (use_temp) {
899 __ Move(i.OutputRegister(0), i.TempRegister(0)); 899 __ Move(i.OutputRegister(0), i.TempRegister(0));
900 } 900 }
901 break; 901 break;
902 } 902 }
903 case kIA32SubPair: { 903 case kIA32SubPair: {
904 // i.OutputRegister(0) == i.InputRegister(0) ... left low word. 904 // i.OutputRegister(0) == i.InputRegister(0) ... left low word.
905 // i.InputRegister(1) ... left high word. 905 // i.InputRegister(1) ... left high word.
906 // i.InputRegister(2) ... right low word. 906 // i.InputRegister(2) ... right low word.
907 // i.InputRegister(3) ... right high word. 907 // i.InputRegister(3) ... right high word.
908 bool use_temp = false; 908 bool use_temp = false;
909 if (i.OutputRegister(0).code() == i.InputRegister(1).code() || 909 if (i.OutputRegister(0).code() == i.InputRegister(1).code() ||
910 i.OutputRegister(0).code() == i.InputRegister(3).code()) { 910 i.OutputRegister(0).code() == i.InputRegister(3).code()) {
911 // We cannot write to the output register directly, because it would 911 // We cannot write to the output register directly, because it would
912 // overwrite an input for adc. We have to use the temp register. 912 // overwrite an input for adc. We have to use the temp register.
913 use_temp = true; 913 use_temp = true;
914 __ Move(i.TempRegister(0), i.InputRegister(0)); 914 __ Move(i.TempRegister(0), i.InputRegister(0));
915 __ sub(i.TempRegister(0), i.InputRegister(2)); 915 __ sub(i.TempRegister(0), i.InputRegister(2));
916 } else { 916 } else {
917 __ sub(i.OutputRegister(0), i.InputRegister(2)); 917 __ sub(i.OutputRegister(0), i.InputRegister(2));
918 } 918 }
919 __ sbb(i.InputRegister(1), Operand(i.InputRegister(3)));
920 if (i.OutputRegister(1).code() != i.InputRegister(1).code()) { 919 if (i.OutputRegister(1).code() != i.InputRegister(1).code()) {
921 __ Move(i.OutputRegister(1), i.InputRegister(1)); 920 __ Move(i.OutputRegister(1), i.InputRegister(1));
922 } 921 }
922 __ sbb(i.OutputRegister(1), Operand(i.InputRegister(3)));
923 if (use_temp) { 923 if (use_temp) {
924 __ Move(i.OutputRegister(0), i.TempRegister(0)); 924 __ Move(i.OutputRegister(0), i.TempRegister(0));
925 } 925 }
926 break; 926 break;
927 } 927 }
928 case kIA32MulPair: { 928 case kIA32MulPair: {
929 __ imul(i.OutputRegister(1), i.InputOperand(0)); 929 __ imul(i.OutputRegister(1), i.InputOperand(0));
930 __ mov(i.TempRegister(0), i.InputOperand(1)); 930 __ mov(i.TempRegister(0), i.InputOperand(1));
931 __ imul(i.TempRegister(0), i.InputOperand(2)); 931 __ imul(i.TempRegister(0), i.InputOperand(2));
932 __ add(i.OutputRegister(1), i.TempRegister(0)); 932 __ add(i.OutputRegister(1), i.TempRegister(0));
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2301 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2302 __ Nop(padding_size); 2302 __ Nop(padding_size);
2303 } 2303 }
2304 } 2304 }
2305 2305
2306 #undef __ 2306 #undef __
2307 2307
2308 } // namespace compiler 2308 } // namespace compiler
2309 } // namespace internal 2309 } // namespace internal
2310 } // namespace v8 2310 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698