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

Side by Side Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 2616613002: [turbofan] Add constant-folding for Float64RoundDown. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | 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/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/base/division-by-constant.h" 7 #include "src/base/division-by-constant.h"
8 #include "src/base/ieee754.h" 8 #include "src/base/ieee754.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/typer.h" 10 #include "src/compiler/typer.h"
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0))); 2078 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0)));
2079 ASSERT_TRUE(r.Changed()); 2079 ASSERT_TRUE(r.Changed());
2080 EXPECT_THAT(r.replacement(), 2080 EXPECT_THAT(r.replacement(),
2081 IsFloat32LessThanOrEqual(IsFloat32Constant(x), p0)); 2081 IsFloat32LessThanOrEqual(IsFloat32Constant(x), p0));
2082 } 2082 }
2083 } 2083 }
2084 } 2084 }
2085 2085
2086 2086
2087 // ----------------------------------------------------------------------------- 2087 // -----------------------------------------------------------------------------
2088 // Float64RoundDown
2089
2090 TEST_F(MachineOperatorReducerTest, Float64RoundDownWithConstant) {
2091 TRACED_FOREACH(double, x, kFloat64Values) {
2092 Reduction r = Reduce(graph()->NewNode(
2093 machine()->Float64RoundDown().placeholder(), Float64Constant(x)));
2094 ASSERT_TRUE(r.Changed());
2095 EXPECT_THAT(r.replacement(), IsFloat64Constant(Floor(x)));
2096 }
2097 }
2098
2099 // -----------------------------------------------------------------------------
2088 // Store 2100 // Store
2089 2101
2090
2091 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { 2102 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
2092 const StoreRepresentation rep(MachineRepresentation::kWord8, kNoWriteBarrier); 2103 const StoreRepresentation rep(MachineRepresentation::kWord8, kNoWriteBarrier);
2093 Node* const base = Parameter(0); 2104 Node* const base = Parameter(0);
2094 Node* const index = Parameter(1); 2105 Node* const index = Parameter(1);
2095 Node* const value = Parameter(2); 2106 Node* const value = Parameter(2);
2096 Node* const effect = graph()->start(); 2107 Node* const effect = graph()->start();
2097 Node* const control = graph()->start(); 2108 Node* const control = graph()->start();
2098 TRACED_FOREACH(uint32_t, x, kUint32Values) { 2109 TRACED_FOREACH(uint32_t, x, kUint32Values) {
2099 Node* const node = 2110 Node* const node =
2100 graph()->NewNode(machine()->Store(rep), base, index, 2111 graph()->NewNode(machine()->Store(rep), base, index,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 Reduction r = Reduce(node); 2188 Reduction r = Reduce(node);
2178 ASSERT_TRUE(r.Changed()); 2189 ASSERT_TRUE(r.Changed());
2179 EXPECT_THAT(r.replacement(), 2190 EXPECT_THAT(r.replacement(),
2180 IsStore(rep, base, index, value, effect, control)); 2191 IsStore(rep, base, index, value, effect, control));
2181 } 2192 }
2182 } 2193 }
2183 2194
2184 } // namespace compiler 2195 } // namespace compiler
2185 } // namespace internal 2196 } // namespace internal
2186 } // namespace v8 2197 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698