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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1879463003: Add "vmov.<dt> <Qd>, #<imm>" to integrated ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 8 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.cpp » ('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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 IValueT getYInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY & 0x1; } 210 IValueT getYInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY & 0x1; }
211 211
212 IValueT getXXXXInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY >> 1; } 212 IValueT getXXXXInRegXXXXY(IValueT RegXXXXY) { return RegXXXXY >> 1; }
213 213
214 IValueT getYInRegYXXXX(IValueT RegYXXXX) { return RegYXXXX >> 4; } 214 IValueT getYInRegYXXXX(IValueT RegYXXXX) { return RegYXXXX >> 4; }
215 215
216 IValueT getXXXXInRegYXXXX(IValueT RegYXXXX) { return RegYXXXX & 0x0f; } 216 IValueT getXXXXInRegYXXXX(IValueT RegYXXXX) { return RegYXXXX & 0x0f; }
217 217
218 // Figures out Op/Cmode values for given Value. Returns true if able to encode.
219 bool encodeAdvSIMDExpandImm(IValueT Value, Type ElmtTy, IValueT &Op,
220 IValueT &Cmode, IValueT &Imm8) {
221 // TODO(kschimpf): Handle other shifted 8-bit values.
222 constexpr IValueT Imm8Mask = 0xFF;
223 if ((Value & IValueT(~Imm8Mask)) != 0)
224 return false;
225 Imm8 = Value;
226 switch (ElmtTy) {
227 case IceType_i16:
228 Op = 0;
229 Cmode = 8; // 100:0
230 return true;
231 case IceType_i32:
232 Op = 0;
233 Cmode = 0; // 000:0
234 return true;
235 default:
236 return false;
237 }
238 }
239
218 // Defines layouts of an operand representing a (register) memory address, 240 // Defines layouts of an operand representing a (register) memory address,
219 // possibly modified by an immediate value. 241 // possibly modified by an immediate value.
220 enum EncodedImmAddress { 242 enum EncodedImmAddress {
221 // Address modified by a rotated immediate 8-bit value. 243 // Address modified by a rotated immediate 8-bit value.
222 RotatedImm8Address, 244 RotatedImm8Address,
223 245
224 // Alternate encoding for RotatedImm8Address, where the offset is divided by 4 246 // Alternate encoding for RotatedImm8Address, where the offset is divided by 4
225 // before encoding. 247 // before encoding.
226 RotatedImm8Div4Address, 248 RotatedImm8Div4Address,
227 249
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 if (encodeAddress(OpAddress, Address, TInfo, NoImmOffsetAddress) != 2725 if (encodeAddress(OpAddress, Address, TInfo, NoImmOffsetAddress) !=
2704 EncodedAsImmRegOffset) 2726 EncodedAsImmRegOffset)
2705 llvm::report_fatal_error(std::string(Vld1qr) + ": malform memory address"); 2727 llvm::report_fatal_error(std::string(Vld1qr) + ": malform memory address");
2706 const IValueT Rn = mask(Address, kRnShift, 4); 2728 const IValueT Rn = mask(Address, kRnShift, 4);
2707 constexpr IValueT Rm = RegARM32::Reg_pc; 2729 constexpr IValueT Rm = RegARM32::Reg_pc;
2708 constexpr IValueT Opcode = B26 | B21; 2730 constexpr IValueT Opcode = B26 | B21;
2709 constexpr IValueT Align = 0; // use default alignment. 2731 constexpr IValueT Align = 0; // use default alignment.
2710 emitVMem1Op(Opcode, Dd, Rn, Rm, DRegListSize2, ElmtSize, Align, Vld1qr); 2732 emitVMem1Op(Opcode, Dd, Rn, Rm, DRegListSize2, ElmtSize, Align, Vld1qr);
2711 } 2733 }
2712 2734
2735 bool AssemblerARM32::vmovqc(const Operand *OpQd, const ConstantInteger32 *Imm) {
2736 // VMOV (immediate) - ARM section A8.8.320, encoding A1:
2737 // VMOV.<dt> <Qd>, #<Imm>
2738 // 1111001x1D000yyyddddcccc01p1zzzz where Qd=Ddddd, Imm=xyyyzzzz, cmode=cccc,
2739 // and Op=p.
2740 constexpr const char *Vmovc = "vmovc";
2741 const IValueT Dd = mapQRegToDReg(encodeQRegister(OpQd, "Qd", Vmovc));
2742 IValueT Value = Imm->getValue();
2743 const Type VecTy = OpQd->getType();
2744 if (!isVectorType(VecTy))
2745 return false;
2746
2747 IValueT Op;
2748 IValueT Cmode;
2749 IValueT Imm8;
2750 if (!encodeAdvSIMDExpandImm(Value, typeElementType(VecTy), Op, Cmode, Imm8))
2751 return false;
2752 if (Op == 0 && mask(Cmode, 0, 1) == 1)
2753 return false;
2754 if (Op == 1 && Cmode != 13)
2755 return false;
2756 const IValueT Encoding =
2757 (0xF << kConditionShift) | B25 | B23 | B6 | B4 |
2758 (mask(Imm8, 7, 1) << 24) | (getYInRegYXXXX(Dd) << 22) |
2759 (mask(Imm8, 4, 3) << 16) | (getXXXXInRegYXXXX(Dd) << 12) | (Cmode << 8) |
2760 (Op << 5) | mask(Imm8, 0, 4);
2761 emitInst(Encoding);
2762 return true;
2763 }
2764
2713 void AssemblerARM32::vmovd(const Operand *OpDd, 2765 void AssemblerARM32::vmovd(const Operand *OpDd,
2714 const OperandARM32FlexFpImm *OpFpImm, 2766 const OperandARM32FlexFpImm *OpFpImm,
2715 CondARM32::Cond Cond) { 2767 CondARM32::Cond Cond) {
2716 // VMOV (immediate) - ARM section A8.8.339, encoding A2: 2768 // VMOV (immediate) - ARM section A8.8.339, encoding A2:
2717 // vmov<c>.f64 <Dd>, #<imm> 2769 // vmov<c>.f64 <Dd>, #<imm>
2718 // 2770 //
2719 // cccc11101D11xxxxdddd10110000yyyy where cccc=Cond, ddddD=Sn, xxxxyyyy=imm. 2771 // cccc11101D11xxxxdddd10110000yyyy where cccc=Cond, ddddD=Sn, xxxxyyyy=imm.
2720 constexpr const char *Vmovd = "vmovd"; 2772 constexpr const char *Vmovd = "vmovd";
2721 IValueT Dd = encodeSRegister(OpDd, "Dd", Vmovd); 2773 IValueT Dd = encodeSRegister(OpDd, "Dd", Vmovd);
2722 IValueT Imm8 = OpFpImm->getModifiedImm(); 2774 IValueT Imm8 = OpFpImm->getModifiedImm();
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 constexpr const char *Vsqrts = "vsqrts"; 3252 constexpr const char *Vsqrts = "vsqrts";
3201 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsqrts); 3253 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsqrts);
3202 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsqrts); 3254 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsqrts);
3203 constexpr IValueT VsqrtsOpcode = B23 | B21 | B20 | B16 | B7 | B6; 3255 constexpr IValueT VsqrtsOpcode = B23 | B21 | B20 | B16 | B7 | B6;
3204 constexpr IValueT S0 = 0; 3256 constexpr IValueT S0 = 0;
3205 emitVFPsss(Cond, VsqrtsOpcode, Sd, S0, Sm); 3257 emitVFPsss(Cond, VsqrtsOpcode, Sd, S0, Sm);
3206 } 3258 }
3207 3259
3208 } // end of namespace ARM32 3260 } // end of namespace ARM32
3209 } // end of namespace Ice 3261 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698