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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/arm64/instruction-selector-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/arm64/code-generator-arm64.cc
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc
index 52d61367a49c3c63a6732626cf92ada2ba4bc795..796fd58d7a24a2dbe7f075824cf58a4d7c243f26 100644
--- a/src/compiler/arm64/code-generator-arm64.cc
+++ b/src/compiler/arm64/code-generator-arm64.cc
@@ -822,12 +822,16 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
i.InputFloat32Register(1));
break;
case kArm64Float32Max:
- __ Fmax(i.OutputFloat32Register(), i.InputFloat32Register(0),
- i.InputFloat32Register(1));
+ // (b < a) ? a : b
+ __ Fcmp(i.InputFloat32Register(1), i.InputFloat32Register(0));
+ __ Fcsel(i.OutputFloat32Register(), i.InputFloat32Register(0),
+ i.InputFloat32Register(1), lo);
break;
case kArm64Float32Min:
- __ Fmin(i.OutputFloat32Register(), i.InputFloat32Register(0),
- i.InputFloat32Register(1));
+ // (a < b) ? a : b
+ __ Fcmp(i.InputFloat32Register(0), i.InputFloat32Register(1));
+ __ Fcsel(i.OutputFloat32Register(), i.InputFloat32Register(0),
+ i.InputFloat32Register(1), lo);
break;
case kArm64Float32Abs:
__ Fabs(i.OutputFloat32Register(), i.InputFloat32Register(0));
@@ -873,12 +877,16 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
break;
}
case kArm64Float64Max:
- __ Fmax(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
- i.InputDoubleRegister(1));
+ // (b < a) ? a : b
+ __ Fcmp(i.InputDoubleRegister(1), i.InputDoubleRegister(0));
+ __ Fcsel(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
+ i.InputDoubleRegister(1), lo);
break;
case kArm64Float64Min:
- __ Fmin(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
- i.InputDoubleRegister(1));
+ // (a < b) ? a : b
+ __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
+ __ Fcsel(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
+ i.InputDoubleRegister(1), lo);
break;
case kArm64Float64Abs:
__ Fabs(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
« 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