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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1422253003: Add UMULL to ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 1 month 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/IceAssemblerARM32.h ('k') | src/IceInstARM32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
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 B12 = 1 << 12; 44 static constexpr IValueT B12 = 1 << 12;
45 static constexpr IValueT B13 = 1 << 13; 45 static constexpr IValueT B13 = 1 << 13;
46 static constexpr IValueT B14 = 1 << 14; 46 static constexpr IValueT B14 = 1 << 14;
47 static constexpr IValueT B15 = 1 << 15; 47 static constexpr IValueT B15 = 1 << 15;
48 static constexpr IValueT B20 = 1 << 20; 48 static constexpr IValueT B20 = 1 << 20;
49 static constexpr IValueT B21 = 1 << 21; 49 static constexpr IValueT B21 = 1 << 21;
50 static constexpr IValueT B22 = 1 << 22; 50 static constexpr IValueT B22 = 1 << 22;
51 static constexpr IValueT B23 = 1 << 23;
51 static constexpr IValueT B24 = 1 << 24; 52 static constexpr IValueT B24 = 1 << 24;
52 static constexpr IValueT B25 = 1 << 25; 53 static constexpr IValueT B25 = 1 << 25;
53 static constexpr IValueT B26 = 1 << 26; 54 static constexpr IValueT B26 = 1 << 26;
54 static constexpr IValueT B27 = 1 << 27; 55 static constexpr IValueT B27 = 1 << 27;
55 56
56 // Constants used for the decoding or encoding of the individual fields of 57 // Constants used for the decoding or encoding of the individual fields of
57 // instructions. Based on ARM section A5.1. 58 // instructions. Based on ARM section A5.1.
58 static constexpr IValueT L = 1 << 20; // load (or store) 59 static constexpr IValueT L = 1 << 20; // load (or store)
59 static constexpr IValueT W = 1 << 21; // writeback base register 60 static constexpr IValueT W = 1 << 21; // writeback base register
60 // (or leave unchanged) 61 // (or leave unchanged)
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) 998 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
998 return setNeedsTextFixup(); 999 return setNeedsTextFixup();
999 IValueT Rn; 1000 IValueT Rn;
1000 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) 1001 if (decodeOperand(OpRn, Rn) != DecodedAsRegister)
1001 return setNeedsTextFixup(); 1002 return setNeedsTextFixup();
1002 IValueT Rm; 1003 IValueT Rm;
1003 if (decodeOperand(OpSrc1, Rm) != DecodedAsRegister) 1004 if (decodeOperand(OpSrc1, Rm) != DecodedAsRegister)
1004 return setNeedsTextFixup(); 1005 return setNeedsTextFixup();
1005 if (Rd == RegARM32::Encoded_Reg_pc || Rn == RegARM32::Encoded_Reg_pc || 1006 if (Rd == RegARM32::Encoded_Reg_pc || Rn == RegARM32::Encoded_Reg_pc ||
1006 Rm == RegARM32::Encoded_Reg_pc) 1007 Rm == RegARM32::Encoded_Reg_pc)
1007 llvm::report_fatal_error("Sdiv instruction unpredictable on pc"); 1008 llvm::report_fatal_error("Udiv instruction unpredictable on pc");
1008 // Assembler registers rd, rn, rm are encoded as rn, rm, rs. 1009 // Assembler registers rd, rn, rm are encoded as rn, rm, rs.
1009 constexpr IValueT Opcode = B21; 1010 constexpr IValueT Opcode = B21;
1010 emitDivOp(Cond, Opcode, Rd, Rn, Rm); 1011 emitDivOp(Cond, Opcode, Rd, Rn, Rm);
1011 } 1012 }
1012 1013
1013 void AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn, 1014 void AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn,
1014 const Operand *OpSrc1, bool SetFlags, 1015 const Operand *OpSrc1, bool SetFlags,
1015 CondARM32::Cond Cond) { 1016 CondARM32::Cond Cond) {
1016 // SUB (register) - ARM section A8.8.223, encoding A1: 1017 // SUB (register) - ARM section A8.8.223, encoding A1:
1017 // sub{s}<c> <Rd>, <Rn>, <Rm>{, <shift>} 1018 // sub{s}<c> <Rd>, <Rn>, <Rm>{, <shift>}
(...skipping 24 matching lines...) Expand all
1042 // 1043 //
1043 // TST (immediate) - ARM section A8.8.240, encoding A1: 1044 // TST (immediate) - ARM section A8.8.240, encoding A1:
1044 // tst<c> <Rn>, #<RotatedImm8> 1045 // tst<c> <Rn>, #<RotatedImm8>
1045 // 1046 //
1046 // cccc00110001nnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, and 1047 // cccc00110001nnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, and
1047 // iiiiiiiiiiii defines RotatedImm8. 1048 // iiiiiiiiiiii defines RotatedImm8.
1048 constexpr IValueT Opcode = B3; // ie. 1000 1049 constexpr IValueT Opcode = B3; // ie. 1000
1049 emitCompareOp(Opcode, OpRn, OpSrc1, Cond); 1050 emitCompareOp(Opcode, OpRn, OpSrc1, Cond);
1050 } 1051 }
1051 1052
1053 void AssemblerARM32::umull(const Operand *OpRdLo, const Operand *OpRdHi,
1054 const Operand *OpRn, const Operand *OpRm,
1055 CondARM32::Cond Cond) {
1056 // UMULL - ARM section A8.8.257, encoding A1:
1057 // umull<c> <RdLo>, <RdHi>, <Rn>, <Rm>
1058 //
1059 // cccc0000100shhhhllllmmmm1001nnnn where hhhh=RdHi, llll=RdLo, nnnn=Rn,
1060 // mmmm=Rm, and s=SetFlags
1061 IValueT RdLo;
1062 IValueT RdHi;
1063 IValueT Rn;
1064 IValueT Rm;
1065 if (decodeOperand(OpRdLo, RdLo) != DecodedAsRegister ||
1066 decodeOperand(OpRdHi, RdHi) != DecodedAsRegister ||
1067 decodeOperand(OpRn, Rn) != DecodedAsRegister ||
1068 decodeOperand(OpRm, Rm) != DecodedAsRegister)
1069 return setNeedsTextFixup();
1070 if (RdHi == RegARM32::Encoded_Reg_pc || RdLo == RegARM32::Encoded_Reg_pc ||
1071 Rn == RegARM32::Encoded_Reg_pc || Rm == RegARM32::Encoded_Reg_pc ||
1072 RdHi == RdLo)
1073 llvm::report_fatal_error("Umull instruction unpredictable on pc");
1074 constexpr bool SetFlags = false;
1075 emitMulOp(Cond, B23, RdLo, RdHi, Rn, Rm, SetFlags);
1076 }
1077
1052 } // end of namespace ARM32 1078 } // end of namespace ARM32
1053 } // end of namespace Ice 1079 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698