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

Side by Side Diff: test/unittests/base/bits-unittest.cc

Issue 648283002: [arm] Add support for SMMLA, SMMLS and SMMUL. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Fix Created 6 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-disasm-arm.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 <limits> 5 #include <limits>
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/macros.h" 8 #include "src/base/macros.h"
9 #include "testing/gtest-support.h" 9 #include "testing/gtest-support.h"
10 10
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SignedSubOverflow32(std::numeric_limits<int32_t>::max(), -1, &val)); 192 SignedSubOverflow32(std::numeric_limits<int32_t>::max(), -1, &val));
193 EXPECT_EQ(std::numeric_limits<int32_t>::min(), val); 193 EXPECT_EQ(std::numeric_limits<int32_t>::min(), val);
194 TRACED_FORRANGE(int32_t, i, 1, 50) { 194 TRACED_FORRANGE(int32_t, i, 1, 50) {
195 TRACED_FORRANGE(int32_t, j, 1, i) { 195 TRACED_FORRANGE(int32_t, j, 1, i) {
196 EXPECT_FALSE(SignedSubOverflow32(i, j, &val)); 196 EXPECT_FALSE(SignedSubOverflow32(i, j, &val));
197 EXPECT_EQ(i - j, val); 197 EXPECT_EQ(i - j, val);
198 } 198 }
199 } 199 }
200 } 200 }
201 201
202
203 TEST(Bits, SignedMulHigh32) {
204 EXPECT_EQ(0, SignedMulHigh32(0, 0));
205 TRACED_FORRANGE(int32_t, i, 1, 50) {
206 TRACED_FORRANGE(int32_t, j, 1, i) { EXPECT_EQ(0, SignedMulHigh32(i, j)); }
207 }
208 EXPECT_EQ(-1073741824, SignedMulHigh32(std::numeric_limits<int32_t>::max(),
209 std::numeric_limits<int32_t>::min()));
210 EXPECT_EQ(-1073741824, SignedMulHigh32(std::numeric_limits<int32_t>::min(),
211 std::numeric_limits<int32_t>::max()));
212 EXPECT_EQ(1, SignedMulHigh32(1024 * 1024 * 1024, 4));
213 EXPECT_EQ(2, SignedMulHigh32(8 * 1024, 1024 * 1024));
214 }
215
216
217 TEST(Bits, SignedMulHighAndAdd32) {
218 TRACED_FORRANGE(int32_t, i, 1, 50) {
219 EXPECT_EQ(i, SignedMulHighAndAdd32(0, 0, i));
220 TRACED_FORRANGE(int32_t, j, 1, i) {
221 EXPECT_EQ(i, SignedMulHighAndAdd32(j, j, i));
222 }
223 EXPECT_EQ(i + 1, SignedMulHighAndAdd32(1024 * 1024 * 1024, 4, i));
224 }
225 }
226
227
228 TEST(Bits, SignedMulHighAndSub32) {
229 TRACED_FORRANGE(int32_t, i, 1, 50) {
230 EXPECT_EQ(i, SignedMulHighAndSub32(0, 0, i));
231 TRACED_FORRANGE(int32_t, j, 1, i) {
232 EXPECT_EQ(i, SignedMulHighAndSub32(j, j, i));
233 }
234 EXPECT_EQ(i - 1, SignedMulHighAndSub32(1024 * 1024 * 1024, 4, i));
235 }
236 }
237
202 } // namespace bits 238 } // namespace bits
203 } // namespace base 239 } // namespace base
204 } // namespace v8 240 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698