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

Side by Side Diff: src/base/bits.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 | « src/base/bits.h ('k') | test/cctest/test-assembler-arm.cc » ('j') | 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/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/base/logging.h" 6 #include "src/base/logging.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace base { 9 namespace base {
10 namespace bits { 10 namespace bits {
11 11
12 uint32_t RoundUpToPowerOfTwo32(uint32_t value) { 12 uint32_t RoundUpToPowerOfTwo32(uint32_t value) {
13 DCHECK_LE(value, 0x80000000u); 13 DCHECK_LE(value, 0x80000000u);
14 value = value - 1; 14 value = value - 1;
15 value = value | (value >> 1); 15 value = value | (value >> 1);
16 value = value | (value >> 2); 16 value = value | (value >> 2);
17 value = value | (value >> 4); 17 value = value | (value >> 4);
18 value = value | (value >> 8); 18 value = value | (value >> 8);
19 value = value | (value >> 16); 19 value = value | (value >> 16);
20 return value + 1; 20 return value + 1;
21 } 21 }
22 22
23
24 int32_t SignedMulHigh32(int32_t lhs, int32_t rhs) {
25 int64_t const value = static_cast<int64_t>(lhs) * static_cast<int64_t>(rhs);
26 return bit_cast<int32_t, uint32_t>(bit_cast<uint64_t>(value) >> 32u);
27 }
28
29
30 int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs, int32_t acc) {
31 return bit_cast<int32_t>(bit_cast<uint32_t>(acc) +
32 bit_cast<uint32_t>(SignedMulHigh32(lhs, rhs)));
33 }
34
35
36 int32_t SignedMulHighAndSub32(int32_t lhs, int32_t rhs, int32_t acc) {
37 return bit_cast<int32_t>(bit_cast<uint32_t>(acc) -
38 bit_cast<uint32_t>(SignedMulHigh32(lhs, rhs)));
39 }
40
41
23 } // namespace bits 42 } // namespace bits
24 } // namespace base 43 } // namespace base
25 } // namespace v8 44 } // namespace v8
OLDNEW
« no previous file with comments | « src/base/bits.h ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698