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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1429073005: Add MLA instruction to ARM integerated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove tabs. 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
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 Type01Checks RuleChecks) { 386 Type01Checks RuleChecks) {
387 IValueT Rd; 387 IValueT Rd;
388 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) 388 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
389 return setNeedsTextFixup(); 389 return setNeedsTextFixup();
390 IValueT Rn; 390 IValueT Rn;
391 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) 391 if (decodeOperand(OpRn, Rn) != DecodedAsRegister)
392 return setNeedsTextFixup(); 392 return setNeedsTextFixup();
393 emitType01(Opcode, Rd, Rn, OpSrc1, SetFlags, Cond, RuleChecks); 393 emitType01(Opcode, Rd, Rn, OpSrc1, SetFlags, Cond, RuleChecks);
394 } 394 }
395 395
396 void AssemblerARM32::emitType01(IValueT Opcode, IValueT Rd, 396 void AssemblerARM32::emitType01(IValueT Opcode, IValueT Rd, IValueT Rn,
397 IValueT Rn, const Operand *OpSrc1, 397 const Operand *OpSrc1, bool SetFlags,
398 bool SetFlags, CondARM32::Cond Cond, 398 CondARM32::Cond Cond, Type01Checks RuleChecks) {
399 Type01Checks RuleChecks) {
400 switch (RuleChecks) { 399 switch (RuleChecks) {
401 case NoChecks: 400 case NoChecks:
402 break; 401 break;
403 case RdIsPcAndSetFlags: 402 case RdIsPcAndSetFlags:
404 if (((Rd == RegARM32::Encoded_Reg_pc) && SetFlags)) 403 if (((Rd == RegARM32::Encoded_Reg_pc) && SetFlags))
405 // Conditions of rule violated. 404 // Conditions of rule violated.
406 return setNeedsTextFixup(); 405 return setNeedsTextFixup();
407 break; 406 break;
408 } 407 }
409 408
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 // 879 //
881 // ORR (register) - ARM Section A8.8.123, encoding A1: 880 // ORR (register) - ARM Section A8.8.123, encoding A1:
882 // orr{s}<c> <Rd>, <Rn>, #<RotatedImm8> 881 // orr{s}<c> <Rd>, <Rn>, #<RotatedImm8>
883 // 882 //
884 // cccc0001100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 883 // cccc0001100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
885 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. 884 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8.
886 constexpr IValueT Orr = B3 | B2; // i.e. 1100 885 constexpr IValueT Orr = B3 | B2; // i.e. 1100
887 emitType01(Orr, OpRd, OpRn, OpSrc1, SetFlags, Cond); 886 emitType01(Orr, OpRd, OpRn, OpSrc1, SetFlags, Cond);
888 } 887 }
889 888
889 void AssemblerARM32::mla(const Operand *OpRd, const Operand *OpRn,
890 const Operand *OpRm, const Operand *OpRa,
891 CondARM32::Cond Cond) {
892 IValueT Rd;
893 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
894 return setNeedsTextFixup();
895 IValueT Rn;
896 if (decodeOperand(OpRn, Rn) != DecodedAsRegister)
897 return setNeedsTextFixup();
898 IValueT Rm;
899 if (decodeOperand(OpRm, Rm) != DecodedAsRegister)
900 return setNeedsTextFixup();
901 IValueT Ra;
902 if (decodeOperand(OpRa, Ra) != DecodedAsRegister)
903 return setNeedsTextFixup();
904 // MLA - ARM section A8.8.114, encoding A1.
905 // mla{s}<c> <Rd>, <Rn>, <Rm>, <Ra>
906 //
907 // cccc0000001sddddaaaammmm1001nnnn where cccc=Cond, s=SetFlags, dddd=Rd,
908 // aaaa=Ra, mmmm=Rm, and nnnn=Rn.
909 if (Rd == RegARM32::Encoded_Reg_pc || Rn == RegARM32::Encoded_Reg_pc ||
910 Rm == RegARM32::Encoded_Reg_pc || Ra == RegARM32::Encoded_Reg_pc)
911 llvm::report_fatal_error("Mul instruction unpredictable on pc");
912 constexpr IValueT MlaOpcode = B21;
913 bool SetFlags = false;
Jim Stichnoth 2015/11/05 00:15:04 constexpr
Karl 2015/11/05 16:28:20 Done.
914 // Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd.
915 emitMulOp(Cond, MlaOpcode, Ra, Rd, Rn, Rm, SetFlags);
916 }
917
890 void AssemblerARM32::mul(const Operand *OpRd, const Operand *OpRn, 918 void AssemblerARM32::mul(const Operand *OpRd, const Operand *OpRn,
891 const Operand *OpSrc1, bool SetFlags, 919 const Operand *OpSrc1, bool SetFlags,
892 CondARM32::Cond Cond) { 920 CondARM32::Cond Cond) {
893 IValueT Rd; 921 IValueT Rd;
894 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) 922 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
895 return setNeedsTextFixup(); 923 return setNeedsTextFixup();
896 IValueT Rn; 924 IValueT Rn;
897 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) 925 if (decodeOperand(OpRn, Rn) != DecodedAsRegister)
898 return setNeedsTextFixup(); 926 return setNeedsTextFixup();
899 IValueT Rm; 927 IValueT Rm;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 // tst<c> <Rn>, #<RotatedImm8> 998 // tst<c> <Rn>, #<RotatedImm8>
971 // 999 //
972 // cccc00110001nnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, and 1000 // cccc00110001nnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, and
973 // iiiiiiiiiiii defines RotatedImm8. 1001 // iiiiiiiiiiii defines RotatedImm8.
974 constexpr IValueT Opcode = B3; // ie. 1000 1002 constexpr IValueT Opcode = B3; // ie. 1000
975 emitCompareOp(Opcode, OpRn, OpSrc1, Cond); 1003 emitCompareOp(Opcode, OpRn, OpSrc1, Cond);
976 } 1004 }
977 1005
978 } // end of namespace ARM32 1006 } // end of namespace ARM32
979 } // end of namespace Ice 1007 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.h » ('j') | src/IceInstARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698