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

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 1132033002: [turbofan] Float32Abs and Float64Abs are supported by all backends. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
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 <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 4932 matching lines...) Expand 10 before | Expand all | Expand 10 after
4943 CHECK_EQ(expected, result); 4943 CHECK_EQ(expected, result);
4944 } 4944 }
4945 } 4945 }
4946 } 4946 }
4947 4947
4948 4948
4949 TEST(RunFloat32Abs) { 4949 TEST(RunFloat32Abs) {
4950 float input = -1.0; 4950 float input = -1.0;
4951 float result = 0.0; 4951 float result = 0.0;
4952 RawMachineAssemblerTester<int32_t> m; 4952 RawMachineAssemblerTester<int32_t> m;
4953 if (!m.machine()->HasFloat32Abs()) return;
4954 m.StoreToPointer(&result, kMachFloat32, 4953 m.StoreToPointer(&result, kMachFloat32,
4955 m.Float32Abs(m.LoadFromPointer(&input, kMachFloat32))); 4954 m.Float32Abs(m.LoadFromPointer(&input, kMachFloat32)));
4956 m.Return(m.Int32Constant(0)); 4955 m.Return(m.Int32Constant(0));
4957 FOR_FLOAT32_INPUTS(i) { 4956 FOR_FLOAT32_INPUTS(i) {
4958 input = *i; 4957 input = *i;
4959 float expected = std::abs(input); 4958 float expected = std::abs(input);
4960 CHECK_EQ(0, m.Call()); 4959 CHECK_EQ(0, m.Call());
4961 CheckFloatEq(expected, result); 4960 CheckFloatEq(expected, result);
4962 } 4961 }
4963 } 4962 }
4964 4963
4965 4964
4966 TEST(RunFloat64Abs) { 4965 TEST(RunFloat64Abs) {
4967 double input = -1.0; 4966 double input = -1.0;
4968 double result = 0.0; 4967 double result = 0.0;
4969 RawMachineAssemblerTester<int32_t> m; 4968 RawMachineAssemblerTester<int32_t> m;
4970 if (!m.machine()->HasFloat64Abs()) return;
4971 m.StoreToPointer(&result, kMachFloat64, 4969 m.StoreToPointer(&result, kMachFloat64,
4972 m.Float64Abs(m.LoadFromPointer(&input, kMachFloat64))); 4970 m.Float64Abs(m.LoadFromPointer(&input, kMachFloat64)));
4973 m.Return(m.Int32Constant(0)); 4971 m.Return(m.Int32Constant(0));
4974 FOR_FLOAT64_INPUTS(i) { 4972 FOR_FLOAT64_INPUTS(i) {
4975 input = *i; 4973 input = *i;
4976 double expected = std::abs(input); 4974 double expected = std::abs(input);
4977 CHECK_EQ(0, m.Call()); 4975 CHECK_EQ(0, m.Call());
4978 CheckDoubleEq(expected, result); 4976 CheckDoubleEq(expected, result);
4979 } 4977 }
4980 } 4978 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 m.Return(m.Int32Constant(0)); 5142 m.Return(m.Int32Constant(0));
5145 for (size_t i = 0; i < arraysize(kValues); ++i) { 5143 for (size_t i = 0; i < arraysize(kValues); ++i) {
5146 input = kValues[i]; 5144 input = kValues[i];
5147 CHECK_EQ(0, m.Call()); 5145 CHECK_EQ(0, m.Call());
5148 double expected = round(kValues[i]); 5146 double expected = round(kValues[i]);
5149 CHECK_EQ(expected, result); 5147 CHECK_EQ(expected, result);
5150 } 5148 }
5151 } 5149 }
5152 5150
5153 #endif // V8_TURBOFAN_TARGET 5151 #endif // V8_TURBOFAN_TARGET
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | test/unittests/compiler/common-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698