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

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

Issue 1360603003: [arm64] Implement Float(32|64)(Min|Max) using fcsel. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove "Ternary". Created 5 years, 1 month 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 | src/compiler/arm64/instruction-selector-arm64.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/arm64/macro-assembler-arm64.h" 8 #include "src/arm64/macro-assembler-arm64.h"
9 #include "src/compiler/code-generator-impl.h" 9 #include "src/compiler/code-generator-impl.h"
10 #include "src/compiler/gap-resolver.h" 10 #include "src/compiler/gap-resolver.h"
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 break; 815 break;
816 case kArm64Float32Mul: 816 case kArm64Float32Mul:
817 __ Fmul(i.OutputFloat32Register(), i.InputFloat32Register(0), 817 __ Fmul(i.OutputFloat32Register(), i.InputFloat32Register(0),
818 i.InputFloat32Register(1)); 818 i.InputFloat32Register(1));
819 break; 819 break;
820 case kArm64Float32Div: 820 case kArm64Float32Div:
821 __ Fdiv(i.OutputFloat32Register(), i.InputFloat32Register(0), 821 __ Fdiv(i.OutputFloat32Register(), i.InputFloat32Register(0),
822 i.InputFloat32Register(1)); 822 i.InputFloat32Register(1));
823 break; 823 break;
824 case kArm64Float32Max: 824 case kArm64Float32Max:
825 __ Fmax(i.OutputFloat32Register(), i.InputFloat32Register(0), 825 // (b < a) ? a : b
826 i.InputFloat32Register(1)); 826 __ Fcmp(i.InputFloat32Register(1), i.InputFloat32Register(0));
827 __ Fcsel(i.OutputFloat32Register(), i.InputFloat32Register(0),
828 i.InputFloat32Register(1), lo);
827 break; 829 break;
828 case kArm64Float32Min: 830 case kArm64Float32Min:
829 __ Fmin(i.OutputFloat32Register(), i.InputFloat32Register(0), 831 // (a < b) ? a : b
830 i.InputFloat32Register(1)); 832 __ Fcmp(i.InputFloat32Register(0), i.InputFloat32Register(1));
833 __ Fcsel(i.OutputFloat32Register(), i.InputFloat32Register(0),
834 i.InputFloat32Register(1), lo);
831 break; 835 break;
832 case kArm64Float32Abs: 836 case kArm64Float32Abs:
833 __ Fabs(i.OutputFloat32Register(), i.InputFloat32Register(0)); 837 __ Fabs(i.OutputFloat32Register(), i.InputFloat32Register(0));
834 break; 838 break;
835 case kArm64Float32Sqrt: 839 case kArm64Float32Sqrt:
836 __ Fsqrt(i.OutputFloat32Register(), i.InputFloat32Register(0)); 840 __ Fsqrt(i.OutputFloat32Register(), i.InputFloat32Register(0));
837 break; 841 break;
838 case kArm64Float64Cmp: 842 case kArm64Float64Cmp:
839 if (instr->InputAt(1)->IsDoubleRegister()) { 843 if (instr->InputAt(1)->IsDoubleRegister()) {
840 __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 844 __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
(...skipping 25 matching lines...) Expand all
866 FrameScope scope(masm(), StackFrame::MANUAL); 870 FrameScope scope(masm(), StackFrame::MANUAL);
867 DCHECK(d0.is(i.InputDoubleRegister(0))); 871 DCHECK(d0.is(i.InputDoubleRegister(0)));
868 DCHECK(d1.is(i.InputDoubleRegister(1))); 872 DCHECK(d1.is(i.InputDoubleRegister(1)));
869 DCHECK(d0.is(i.OutputDoubleRegister())); 873 DCHECK(d0.is(i.OutputDoubleRegister()));
870 // TODO(dcarney): make sure this saves all relevant registers. 874 // TODO(dcarney): make sure this saves all relevant registers.
871 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), 875 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()),
872 0, 2); 876 0, 2);
873 break; 877 break;
874 } 878 }
875 case kArm64Float64Max: 879 case kArm64Float64Max:
876 __ Fmax(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 880 // (b < a) ? a : b
877 i.InputDoubleRegister(1)); 881 __ Fcmp(i.InputDoubleRegister(1), i.InputDoubleRegister(0));
882 __ Fcsel(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
883 i.InputDoubleRegister(1), lo);
878 break; 884 break;
879 case kArm64Float64Min: 885 case kArm64Float64Min:
880 __ Fmin(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 886 // (a < b) ? a : b
881 i.InputDoubleRegister(1)); 887 __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
888 __ Fcsel(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
889 i.InputDoubleRegister(1), lo);
882 break; 890 break;
883 case kArm64Float64Abs: 891 case kArm64Float64Abs:
884 __ Fabs(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 892 __ Fabs(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
885 break; 893 break;
886 case kArm64Float64Neg: 894 case kArm64Float64Neg:
887 __ Fneg(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 895 __ Fneg(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
888 break; 896 break;
889 case kArm64Float64Sqrt: 897 case kArm64Float64Sqrt:
890 __ Fsqrt(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 898 __ Fsqrt(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
891 break; 899 break;
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 padding_size -= kInstructionSize; 1457 padding_size -= kInstructionSize;
1450 } 1458 }
1451 } 1459 }
1452 } 1460 }
1453 1461
1454 #undef __ 1462 #undef __
1455 1463
1456 } // namespace compiler 1464 } // namespace compiler
1457 } // namespace internal 1465 } // namespace internal
1458 } // namespace v8 1466 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/arm64/instruction-selector-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698