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)); |