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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1517863002: Add translation of REV in ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reformat source. Created 5 years 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 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 23 matching lines...) Expand all
34 34
35 // The following define individual bits. 35 // The following define individual bits.
36 static constexpr IValueT B0 = 1; 36 static constexpr IValueT B0 = 1;
37 static constexpr IValueT B1 = 1 << 1; 37 static constexpr IValueT B1 = 1 << 1;
38 static constexpr IValueT B2 = 1 << 2; 38 static constexpr IValueT B2 = 1 << 2;
39 static constexpr IValueT B3 = 1 << 3; 39 static constexpr IValueT B3 = 1 << 3;
40 static constexpr IValueT B4 = 1 << 4; 40 static constexpr IValueT B4 = 1 << 4;
41 static constexpr IValueT B5 = 1 << 5; 41 static constexpr IValueT B5 = 1 << 5;
42 static constexpr IValueT B6 = 1 << 6; 42 static constexpr IValueT B6 = 1 << 6;
43 static constexpr IValueT B7 = 1 << 7; 43 static constexpr IValueT B7 = 1 << 7;
44 static constexpr IValueT B8 = 1 << 8;
45 static constexpr IValueT B9 = 1 << 9;
46 static constexpr IValueT B10 = 1 << 10;
47 static constexpr IValueT B11 = 1 << 11;
44 static constexpr IValueT B12 = 1 << 12; 48 static constexpr IValueT B12 = 1 << 12;
45 static constexpr IValueT B13 = 1 << 13; 49 static constexpr IValueT B13 = 1 << 13;
46 static constexpr IValueT B14 = 1 << 14; 50 static constexpr IValueT B14 = 1 << 14;
47 static constexpr IValueT B15 = 1 << 15; 51 static constexpr IValueT B15 = 1 << 15;
48 static constexpr IValueT B16 = 1 << 16; 52 static constexpr IValueT B16 = 1 << 16;
49 static constexpr IValueT B17 = 1 << 17; 53 static constexpr IValueT B17 = 1 << 17;
50 static constexpr IValueT B18 = 1 << 18; 54 static constexpr IValueT B18 = 1 << 18;
51 static constexpr IValueT B19 = 1 << 19; 55 static constexpr IValueT B19 = 1 << 19;
52 static constexpr IValueT B20 = 1 << 20; 56 static constexpr IValueT B20 = 1 << 20;
53 static constexpr IValueT B21 = 1 << 21; 57 static constexpr IValueT B21 = 1 << 21;
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 IValueT Rm = encodeRegister(OpSrc1, "Rm", MulName); 1588 IValueT Rm = encodeRegister(OpSrc1, "Rm", MulName);
1585 verifyRegNotPc(Rd, "Rd", MulName); 1589 verifyRegNotPc(Rd, "Rd", MulName);
1586 verifyRegNotPc(Rn, "Rn", MulName); 1590 verifyRegNotPc(Rn, "Rn", MulName);
1587 verifyRegNotPc(Rm, "Rm", MulName); 1591 verifyRegNotPc(Rm, "Rm", MulName);
1588 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. 1592 // Assembler registers rd, rn, rm are encoded as rn, rm, rs.
1589 constexpr IValueT MulOpcode = 0; 1593 constexpr IValueT MulOpcode = 0;
1590 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags, 1594 emitMulOp(Cond, MulOpcode, RegARM32::Encoded_Reg_r0, Rd, Rn, Rm, SetFlags,
1591 MulName); 1595 MulName);
1592 } 1596 }
1593 1597
1598 void AssemblerARM32::rev(const Operand *OpRd, const Operand *OpSrc,
1599 CondARM32::Cond Cond) {
1600 // REV - ARM section A8.8.145, encoding A1:
1601 // rev <Rd>, <Rm>
1602 //
1603 // cccc011010111111dddd11110011mmmm where cccc=Cond, dddd=Rn, and mmmm=Rm.
1604 constexpr const char *RevName = "rev";
1605 IValueT Rd = encodeRegister(OpRd, "Rd", RevName);
1606 IValueT Rm = encodeRegister(OpSrc, "Rm", RevName);
1607 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
1608 constexpr IValueT Opcode = B26 | B25 | B23 | B21 | B20 | B19 | B18 | B17 |
1609 B16 | B11 | B10 | B9 | B8 | B5 | B4;
1610 IValueT Encoding =
1611 (Cond << kConditionShift) | Opcode | (Rd << kRdShift) | (Rm << kRmShift);
1612 emitInst(Encoding);
1613 }
1614
1594 void AssemblerARM32::rsb(const Operand *OpRd, const Operand *OpRn, 1615 void AssemblerARM32::rsb(const Operand *OpRd, const Operand *OpRn,
1595 const Operand *OpSrc1, bool SetFlags, 1616 const Operand *OpSrc1, bool SetFlags,
1596 CondARM32::Cond Cond) { 1617 CondARM32::Cond Cond) {
1597 // RSB (immediate) - ARM section A8.8.152, encoding A1. 1618 // RSB (immediate) - ARM section A8.8.152, encoding A1.
1598 // rsb{s}<c> <Rd>, <Rn>, #<RotatedImm8> 1619 // rsb{s}<c> <Rd>, <Rn>, #<RotatedImm8>
1599 // 1620 //
1600 // cccc0010011snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 1621 // cccc0010011snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
1601 // s=setFlags and iiiiiiiiiiii defines the RotatedImm8 value. 1622 // s=setFlags and iiiiiiiiiiii defines the RotatedImm8 value.
1602 // 1623 //
1603 // RSB (register) - ARM section A8.8.163, encoding A1. 1624 // RSB (register) - ARM section A8.8.163, encoding A1.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 1725
1705 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, 1726 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0,
1706 CondARM32::Cond Cond) { 1727 CondARM32::Cond Cond) {
1707 constexpr const char *UxtName = "uxt"; 1728 constexpr const char *UxtName = "uxt";
1708 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; 1729 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21;
1709 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); 1730 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName);
1710 } 1731 }
1711 1732
1712 } // end of namespace ARM32 1733 } // end of namespace ARM32
1713 } // end of namespace Ice 1734 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | tests_lit/assembler/arm32/rev.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698