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

Side by Side Diff: src/builtins/mips/builtins-mips.cc

Issue 2534413002: MIPS: Improve Float(32|64)(Max|Min). (Closed)
Patch Set: MIPS: Improve Float(32|64)(Max|Min). Created 4 years 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/builtins/mips64/builtins-mips64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // ----------------------------------- 132 // -----------------------------------
133 Heap::RootListIndex const root_index = 133 Heap::RootListIndex const root_index =
134 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex 134 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
135 : Heap::kMinusInfinityValueRootIndex; 135 : Heap::kMinusInfinityValueRootIndex;
136 136
137 // Load the accumulator with the default return value (either -Infinity or 137 // Load the accumulator with the default return value (either -Infinity or
138 // +Infinity), with the tagged value in t2 and the double value in f0. 138 // +Infinity), with the tagged value in t2 and the double value in f0.
139 __ LoadRoot(t2, root_index); 139 __ LoadRoot(t2, root_index);
140 __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset)); 140 __ ldc1(f0, FieldMemOperand(t2, HeapNumber::kValueOffset));
141 141
142 Label done_loop, loop; 142 Label done_loop, loop, done;
143 __ mov(a3, a0); 143 __ mov(a3, a0);
144 __ bind(&loop); 144 __ bind(&loop);
145 { 145 {
146 // Check if all parameters done. 146 // Check if all parameters done.
147 __ Subu(a3, a3, Operand(1)); 147 __ Subu(a3, a3, Operand(1));
148 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); 148 __ Branch(&done_loop, lt, a3, Operand(zero_reg));
149 149
150 // Load the next parameter tagged value into a2. 150 // Load the next parameter tagged value into a2.
151 __ Lsa(at, sp, a3, kPointerSizeLog2); 151 __ Lsa(at, sp, a3, kPointerSizeLog2);
152 __ lw(a2, MemOperand(at)); 152 __ lw(a2, MemOperand(at));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); 188 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset));
189 __ jmp(&done_convert); 189 __ jmp(&done_convert);
190 __ bind(&convert_smi); 190 __ bind(&convert_smi);
191 __ SmiToDoubleFPURegister(a2, f2, t0); 191 __ SmiToDoubleFPURegister(a2, f2, t0);
192 __ bind(&done_convert); 192 __ bind(&done_convert);
193 193
194 // Perform the actual comparison with using Min/Max macro instructions the 194 // Perform the actual comparison with using Min/Max macro instructions the
195 // accumulator value on the left hand side (f0) and the next parameter value 195 // accumulator value on the left hand side (f0) and the next parameter value
196 // on the right hand side (f2). 196 // on the right hand side (f2).
197 // We need to work out which HeapNumber (or smi) the result came from. 197 // We need to work out which HeapNumber (or smi) the result came from.
198 Label compare_nan, set_value; 198 Label compare_nan, set_value, ool_min, ool_max;
199 __ BranchF(nullptr, &compare_nan, eq, f0, f2); 199 __ BranchF(nullptr, &compare_nan, eq, f0, f2);
200 __ Move(t0, t1, f0); 200 __ Move(t0, t1, f0);
201 if (kind == MathMaxMinKind::kMin) { 201 if (kind == MathMaxMinKind::kMin) {
202 __ MinNaNCheck_d(f0, f0, f2); 202 __ Float64Min(f0, f0, f2, &ool_min);
203 } else { 203 } else {
204 DCHECK(kind == MathMaxMinKind::kMax); 204 DCHECK(kind == MathMaxMinKind::kMax);
205 __ MaxNaNCheck_d(f0, f0, f2); 205 __ Float64Max(f0, f0, f2, &ool_max);
206 } 206 }
207 __ jmp(&done);
208
209 __ bind(&ool_min);
210 __ Float64MinOutOfLine(f0, f0, f2);
211 __ jmp(&done);
212
213 __ bind(&ool_max);
214 __ Float64MaxOutOfLine(f0, f0, f2);
215
216 __ bind(&done);
207 __ Move(at, t8, f0); 217 __ Move(at, t8, f0);
208 __ Branch(&set_value, ne, t0, Operand(at)); 218 __ Branch(&set_value, ne, t0, Operand(at));
209 __ Branch(&set_value, ne, t1, Operand(t8)); 219 __ Branch(&set_value, ne, t1, Operand(t8));
210 __ jmp(&loop); 220 __ jmp(&loop);
211 __ bind(&set_value); 221 __ bind(&set_value);
212 __ mov(t2, a2); 222 __ mov(t2, a2);
213 __ jmp(&loop); 223 __ jmp(&loop);
214 224
215 // At least one side is NaN, which means that the result will be NaN too. 225 // At least one side is NaN, which means that the result will be NaN too.
216 __ bind(&compare_nan); 226 __ bind(&compare_nan);
(...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 __ break_(0xCC); 2976 __ break_(0xCC);
2967 } 2977 }
2968 } 2978 }
2969 2979
2970 #undef __ 2980 #undef __
2971 2981
2972 } // namespace internal 2982 } // namespace internal
2973 } // namespace v8 2983 } // namespace v8
2974 2984
2975 #endif // V8_TARGET_ARCH_MIPS 2985 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698