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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1596613002: Clean up handling of ARM IR instruction "mov". (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit. Created 4 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/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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 }; 189 };
190 190
191 IValueT getEncodedGPRegNum(const Variable *Var) { 191 IValueT getEncodedGPRegNum(const Variable *Var) {
192 assert(Var->hasReg()); 192 assert(Var->hasReg());
193 int32_t Reg = Var->getRegNum(); 193 int32_t Reg = Var->getRegNum();
194 return llvm::isa<Variable64On32>(Var) ? RegARM32::getI64PairFirstGPRNum(Reg) 194 return llvm::isa<Variable64On32>(Var) ? RegARM32::getI64PairFirstGPRNum(Reg)
195 : RegARM32::getEncodedGPR(Reg); 195 : RegARM32::getEncodedGPR(Reg);
196 } 196 }
197 197
198 IValueT getEncodedSRegNum(const Variable *Var) { 198 IValueT getEncodedSRegNum(const Variable *Var) {
199 assert(Var->hasReg());
199 return RegARM32::getEncodedSReg(Var->getRegNum()); 200 return RegARM32::getEncodedSReg(Var->getRegNum());
200 } 201 }
201 202
202 IValueT getEncodedDRegNum(const Variable *Var) { 203 IValueT getEncodedDRegNum(const Variable *Var) {
203 return RegARM32::getEncodedDReg(Var->getRegNum()); 204 return RegARM32::getEncodedDReg(Var->getRegNum());
204 } 205 }
205 206
206 IValueT getYInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY & 0x1; } 207 IValueT getYInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY & 0x1; }
207 208
208 IValueT getXXXXInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY >> 1; } 209 IValueT getXXXXInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY >> 1; }
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 // cccc11101D00nnnndddd101sN0M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn, 2181 // cccc11101D00nnnndddd101sN0M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn,
2181 // and Mmmmm=Rm. 2182 // and Mmmmm=Rm.
2182 constexpr const char *Vdivd = "vdivd"; 2183 constexpr const char *Vdivd = "vdivd";
2183 IValueT Dd = encodeDRegister(OpDd, "Dd", Vdivd); 2184 IValueT Dd = encodeDRegister(OpDd, "Dd", Vdivd);
2184 IValueT Dn = encodeDRegister(OpDn, "Dn", Vdivd); 2185 IValueT Dn = encodeDRegister(OpDn, "Dn", Vdivd);
2185 IValueT Dm = encodeDRegister(OpDm, "Dm", Vdivd); 2186 IValueT Dm = encodeDRegister(OpDm, "Dm", Vdivd);
2186 constexpr IValueT VdivdOpcode = B23; 2187 constexpr IValueT VdivdOpcode = B23;
2187 emitVFPddd(Cond, VdivdOpcode, Dd, Dn, Dm); 2188 emitVFPddd(Cond, VdivdOpcode, Dd, Dn, Dm);
2188 } 2189 }
2189 2190
2191 void AssemblerARM32::vmovsr(const Operand *OpSn, const Operand *OpRt,
2192 CondARM32::Cond Cond) {
2193 // VMOV (between ARM core register and single-precision register)
2194 // ARM seciont A8.8.343, encoding A1.
2195 //
2196 // vmov<c> <Sn>, <Rt>
2197 //
2198 // cccc1110000onnnntttt1010N0010000 where cccc=Cond, nnnnN = Sn, and tttt=Rt.
2199 constexpr const char *Vmovsr = "vmovsr";
2200 IValueT Sn = encodeSRegister(OpSn, "Sn", Vmovsr);
2201 IValueT Rt = encodeGPRegister(OpRt, "Rt", Vmovsr);
2202 assert(Sn < RegARM32::getNumSRegs());
2203 assert(Rt < RegARM32::getNumGPRegs());
2204 assert(CondARM32::isDefined(Cond));
2205 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
2206 IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | B27 | B26 |
2207 B25 | B11 | B9 | B4 | (getXXXXInRegXXXXY(Sn) << 16) |
2208 (Rt << kRdShift) | (getYInRegXXXXY(Sn) << 7);
2209 emitInst(Encoding);
2210 }
2211
2190 void AssemblerARM32::vmuls(const Operand *OpSd, const Operand *OpSn, 2212 void AssemblerARM32::vmuls(const Operand *OpSd, const Operand *OpSn,
2191 const Operand *OpSm, CondARM32::Cond Cond) { 2213 const Operand *OpSm, CondARM32::Cond Cond) {
2192 // VMUL (floating-point) - ARM section A8.8.351, encoding A2: 2214 // VMUL (floating-point) - ARM section A8.8.351, encoding A2:
2193 // vmul<c>.f32 <Sd>, <Sn>, <Sm> 2215 // vmul<c>.f32 <Sd>, <Sn>, <Sm>
2194 // 2216 //
2195 // cccc11100D10nnnndddd101sN0M0mmmm where cccc=Cond, s=0, ddddD=Rd, nnnnN=Rn, 2217 // cccc11100D10nnnndddd101sN0M0mmmm where cccc=Cond, s=0, ddddD=Rd, nnnnN=Rn,
2196 // and mmmmM=Rm. 2218 // and mmmmM=Rm.
2197 constexpr const char *Vmuls = "vmuls"; 2219 constexpr const char *Vmuls = "vmuls";
2198 IValueT Sd = encodeSRegister(OpSd, "Sd", Vmuls); 2220 IValueT Sd = encodeSRegister(OpSd, "Sd", Vmuls);
2199 IValueT Sn = encodeSRegister(OpSn, "Sn", Vmuls); 2221 IValueT Sn = encodeSRegister(OpSn, "Sn", Vmuls);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 // 2311 //
2290 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and 2312 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and
2291 // iiiiiiii=NumConsecRegs. 2313 // iiiiiiii=NumConsecRegs.
2292 constexpr IValueT VpushOpcode = 2314 constexpr IValueT VpushOpcode =
2293 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9; 2315 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9;
2294 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs); 2316 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs);
2295 } 2317 }
2296 2318
2297 } // end of namespace ARM32 2319 } // end of namespace ARM32
2298 } // end of namespace Ice 2320 } // 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