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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1412293006: Add AND(register) and AND(immediate) to ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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.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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // add{s}<c> <Rd>, sp, #<RotatedImm8> 458 // add{s}<c> <Rd>, sp, #<RotatedImm8>
459 // 459 //
460 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 460 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
461 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. 461 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8.
462 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) 462 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
463 // Conditions of rule violated. 463 // Conditions of rule violated.
464 return setNeedsTextFixup(); 464 return setNeedsTextFixup();
465 emitType01(Cond, kInstTypeDataImmediate, Add, SetFlags, Rn, Rd, Src1Value); 465 emitType01(Cond, kInstTypeDataImmediate, Add, SetFlags, Rn, Rd, Src1Value);
466 return; 466 return;
467 } 467 }
468 }; 468 }
469 }
470
471 void AssemblerARM32::and_(const Operand *OpRd, const Operand *OpRn,
472 const Operand *OpSrc1, bool SetFlags,
473 CondARM32::Cond Cond) {
474 IValueT Rd;
475 if (decodeOperand(OpRd, Rd) != DecodedAsRegister)
476 return setNeedsTextFixup();
477 IValueT Rn;
478 if (decodeOperand(OpRn, Rn) != DecodedAsRegister)
479 return setNeedsTextFixup();
480 constexpr IValueT And = 0; // 0000
481 IValueT Src1Value;
482 // TODO(kschimpf) Other possible decodings of add.
483 switch (decodeOperand(OpSrc1, Src1Value)) {
484 default:
485 return setNeedsTextFixup();
486 case DecodedAsRegister: {
487 // AND (register) - ARM section A8.8.14, encoding A1:
488 // and{s}<c> <Rd>, <Rn>{, <shift>}
489 //
490 // cccc0000000snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn,
491 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags.
492 constexpr IValueT Imm5 = 0;
493 Src1Value = encodeShiftRotateImm5(Src1Value, OperandARM32::kNoShift, Imm5);
494 if (((Rd == RegARM32::Encoded_Reg_pc) && SetFlags))
495 // Conditions of rule violated.
496 return setNeedsTextFixup();
497 emitType01(Cond, kInstTypeDataRegister, And, SetFlags, Rn, Rd, Src1Value);
498 return;
499 }
500 case DecodedAsRotatedImm8: {
501 // AND (Immediate) - ARM section A8.8.13, encoding A1:
502 // and{s}<c> <Rd>, <Rn>, #<RotatedImm8>
503 //
504 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
505 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8.
506 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
507 // Conditions of rule violated.
508 return setNeedsTextFixup();
509 emitType01(Cond, kInstTypeDataImmediate, And, SetFlags, Rn, Rd, Src1Value);
510 return;
511 }
512 }
469 } 513 }
470 514
471 void AssemblerARM32::b(Label *L, CondARM32::Cond Cond) { 515 void AssemblerARM32::b(Label *L, CondARM32::Cond Cond) {
472 emitBranch(L, Cond, false); 516 emitBranch(L, Cond, false);
473 } 517 }
474 518
475 void AssemblerARM32::bkpt(uint16_t Imm16) { 519 void AssemblerARM32::bkpt(uint16_t Imm16) {
476 // BKPT - ARM section A*.8.24 - encoding A1: 520 // BKPT - ARM section A*.8.24 - encoding A1:
477 // bkpt #<Imm16> 521 // bkpt #<Imm16>
478 // 522 //
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 // Conditions of rule violated. 778 // Conditions of rule violated.
735 return setNeedsTextFixup(); 779 return setNeedsTextFixup();
736 emitType01(Cond, kInstTypeDataImmediate, Sub, SetFlags, Rn, Rd, Src1Value); 780 emitType01(Cond, kInstTypeDataImmediate, Sub, SetFlags, Rn, Rd, Src1Value);
737 return; 781 return;
738 } 782 }
739 } 783 }
740 } 784 }
741 785
742 } // end of namespace ARM32 786 } // end of namespace ARM32
743 } // end of namespace Ice 787 } // 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