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

Side by Side Diff: src/assembler_ia32.h

Issue 656983002: emitIAS for Shld and Shrd and the ternary and three-address ops. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: stuff Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Modified by the Subzero authors. 5 // Modified by the Subzero authors.
6 // 6 //
7 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ----------------===// 7 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ----------------===//
8 // 8 //
9 // The Subzero Code Generator 9 // The Subzero Code Generator
10 // 10 //
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 const Address &); 375 const Address &);
376 typedef void (AssemblerX86::*TypedEmitGPRImm)(Type, GPRRegister, 376 typedef void (AssemblerX86::*TypedEmitGPRImm)(Type, GPRRegister,
377 const Immediate &); 377 const Immediate &);
378 struct GPREmitterRegOp { 378 struct GPREmitterRegOp {
379 TypedEmitGPRGPR GPRGPR; 379 TypedEmitGPRGPR GPRGPR;
380 TypedEmitGPRAddr GPRAddr; 380 TypedEmitGPRAddr GPRAddr;
381 TypedEmitGPRImm GPRImm; 381 TypedEmitGPRImm GPRImm;
382 }; 382 };
383 383
384 struct GPREmitterShiftOp { 384 struct GPREmitterShiftOp {
385 // Technically, Addr/GPR and Addr/Imm are also allowed, but */Addr are not.
386 // In practice, we always normalize the Dest to a Register first.
385 TypedEmitGPRGPR GPRGPR; 387 TypedEmitGPRGPR GPRGPR;
386 TypedEmitGPRImm GPRImm; 388 TypedEmitGPRImm GPRImm;
387 // Technically, Addr/GPR and Addr/Imm are also allowed, but */Addr are not. 389 };
388 // In practice, we always normalize the Dest to a Register first. 390
391 typedef void (AssemblerX86::*TypedEmitGPRGPRImm)(Type, GPRRegister,
392 GPRRegister,
393 const Immediate &);
394 struct GPREmitterShiftD {
395 // Technically AddrGPR and AddrGPRImm are also allowed, but in practice
396 // we always normalize Dest to a Register first.
397 TypedEmitGPRGPR GPRGPR;
398 TypedEmitGPRGPRImm GPRGPRImm;
389 }; 399 };
390 400
391 typedef void (AssemblerX86::*TypedEmitAddrGPR)(Type, const Address &, 401 typedef void (AssemblerX86::*TypedEmitAddrGPR)(Type, const Address &,
392 GPRRegister); 402 GPRRegister);
393 typedef void (AssemblerX86::*TypedEmitAddrImm)(Type, const Address &, 403 typedef void (AssemblerX86::*TypedEmitAddrImm)(Type, const Address &,
394 const Immediate &); 404 const Immediate &);
395 struct GPREmitterAddrOp { 405 struct GPREmitterAddrOp {
396 TypedEmitAddrGPR AddrGPR; 406 TypedEmitAddrGPR AddrGPR;
397 TypedEmitAddrImm AddrImm; 407 TypedEmitAddrImm AddrImm;
398 }; 408 };
(...skipping 27 matching lines...) Expand all
426 436
427 // Cross Xmm/GPR cast instructions. 437 // Cross Xmm/GPR cast instructions.
428 template <typename DReg_t, typename SReg_t> struct CastEmitterRegOp { 438 template <typename DReg_t, typename SReg_t> struct CastEmitterRegOp {
429 typedef void (AssemblerX86::*TypedEmitRegs)(Type, DReg_t, SReg_t); 439 typedef void (AssemblerX86::*TypedEmitRegs)(Type, DReg_t, SReg_t);
430 typedef void (AssemblerX86::*TypedEmitAddr)(Type, DReg_t, const Address &); 440 typedef void (AssemblerX86::*TypedEmitAddr)(Type, DReg_t, const Address &);
431 441
432 TypedEmitRegs RegReg; 442 TypedEmitRegs RegReg;
433 TypedEmitAddr RegAddr; 443 TypedEmitAddr RegAddr;
434 }; 444 };
435 445
446 // Three operand (potentially) cross Xmm/GPR instructions.
447 // The last operand must be an immediate.
448 template <typename DReg_t, typename SReg_t> struct ThreeOpImmEmitter {
449 typedef void (AssemblerX86::*TypedEmitRegRegImm)(Type, DReg_t, SReg_t,
450 const Immediate &);
451 typedef void (AssemblerX86::*TypedEmitRegAddrImm)(Type, DReg_t,
452 const Address &,
453 const Immediate &);
454
455 TypedEmitRegRegImm RegRegImm;
456 TypedEmitRegAddrImm RegAddrImm;
457 };
458
436 /* 459 /*
437 * Emit Machine Instructions. 460 * Emit Machine Instructions.
438 */ 461 */
439 void call(GPRRegister reg); 462 void call(GPRRegister reg);
440 void call(const Address &address); 463 void call(const Address &address);
441 void call(Label *label); 464 void call(Label *label);
442 void call(const ConstantRelocatable *label); 465 void call(const ConstantRelocatable *label);
443 466
444 static const intptr_t kCallExternalLabelSize = 5; 467 static const intptr_t kCallExternalLabelSize = 5;
445 468
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 void unpckhpd(XmmRegister dst, XmmRegister src); 586 void unpckhpd(XmmRegister dst, XmmRegister src);
564 587
565 void set1ps(XmmRegister dst, GPRRegister tmp, const Immediate &imm); 588 void set1ps(XmmRegister dst, GPRRegister tmp, const Immediate &imm);
566 void shufps(XmmRegister dst, XmmRegister src, const Immediate &mask); 589 void shufps(XmmRegister dst, XmmRegister src, const Immediate &mask);
567 590
568 void minpd(XmmRegister dst, XmmRegister src); 591 void minpd(XmmRegister dst, XmmRegister src);
569 void maxpd(XmmRegister dst, XmmRegister src); 592 void maxpd(XmmRegister dst, XmmRegister src);
570 void sqrtpd(XmmRegister dst); 593 void sqrtpd(XmmRegister dst);
571 void shufpd(XmmRegister dst, XmmRegister src, const Immediate &mask); 594 void shufpd(XmmRegister dst, XmmRegister src, const Immediate &mask);
572 595
596 void pshufd(Type Ty, XmmRegister dst, XmmRegister src, const Immediate &mask);
597 void pshufd(Type Ty, XmmRegister dst, const Address &src,
598 const Immediate &mask);
599 void shufps(Type Ty, XmmRegister dst, XmmRegister src, const Immediate &mask);
600 void shufps(Type Ty, XmmRegister dst, const Address &src,
601 const Immediate &mask);
602
573 void cvtdq2ps(Type, XmmRegister dst, XmmRegister src); 603 void cvtdq2ps(Type, XmmRegister dst, XmmRegister src);
574 void cvtdq2ps(Type, XmmRegister dst, const Address &src); 604 void cvtdq2ps(Type, XmmRegister dst, const Address &src);
575 605
576 void cvttps2dq(Type, XmmRegister dst, XmmRegister src); 606 void cvttps2dq(Type, XmmRegister dst, XmmRegister src);
577 void cvttps2dq(Type, XmmRegister dst, const Address &src); 607 void cvttps2dq(Type, XmmRegister dst, const Address &src);
578 608
579 void cvtsi2ss(Type DestTy, XmmRegister dst, GPRRegister src); 609 void cvtsi2ss(Type DestTy, XmmRegister dst, GPRRegister src);
580 void cvtsi2ss(Type DestTy, XmmRegister dst, const Address &src); 610 void cvtsi2ss(Type DestTy, XmmRegister dst, const Address &src);
581 611
582 void cvtfloat2float(Type SrcTy, XmmRegister dst, XmmRegister src); 612 void cvtfloat2float(Type SrcTy, XmmRegister dst, XmmRegister src);
(...skipping 14 matching lines...) Expand all
597 void xorpd(XmmRegister dst, const Address &src); 627 void xorpd(XmmRegister dst, const Address &src);
598 void xorpd(XmmRegister dst, XmmRegister src); 628 void xorpd(XmmRegister dst, XmmRegister src);
599 void xorps(XmmRegister dst, const Address &src); 629 void xorps(XmmRegister dst, const Address &src);
600 void xorps(XmmRegister dst, XmmRegister src); 630 void xorps(XmmRegister dst, XmmRegister src);
601 631
602 void andpd(XmmRegister dst, const Address &src); 632 void andpd(XmmRegister dst, const Address &src);
603 void andpd(XmmRegister dst, XmmRegister src); 633 void andpd(XmmRegister dst, XmmRegister src);
604 634
605 void orpd(XmmRegister dst, XmmRegister src); 635 void orpd(XmmRegister dst, XmmRegister src);
606 636
607 void pextrd(GPRRegister dst, XmmRegister src, const Immediate &imm); 637 void insertps(Type Ty, XmmRegister dst, XmmRegister src,
638 const Immediate &imm);
639 void insertps(Type Ty, XmmRegister dst, const Address &src,
640 const Immediate &imm);
641
642 void pinsr(Type Ty, XmmRegister dst, GPRRegister src, const Immediate &imm);
643 void pinsr(Type Ty, XmmRegister dst, const Address &src,
644 const Immediate &imm);
645
646 void pextr(Type Ty, GPRRegister dst, XmmRegister src, const Immediate &imm);
647 void pextr(Type Ty, GPRRegister dst, const Address &src,
648 const Immediate &imm);
649
608 void pmovsxdq(XmmRegister dst, XmmRegister src); 650 void pmovsxdq(XmmRegister dst, XmmRegister src);
609 651
610 void pcmpeq(Type Ty, XmmRegister dst, XmmRegister src); 652 void pcmpeq(Type Ty, XmmRegister dst, XmmRegister src);
611 void pcmpeq(Type Ty, XmmRegister dst, const Address &src); 653 void pcmpeq(Type Ty, XmmRegister dst, const Address &src);
612 void pcmpgt(Type Ty, XmmRegister dst, XmmRegister src); 654 void pcmpgt(Type Ty, XmmRegister dst, XmmRegister src);
613 void pcmpgt(Type Ty, XmmRegister dst, const Address &src); 655 void pcmpgt(Type Ty, XmmRegister dst, const Address &src);
614 656
615 enum RoundingMode { 657 enum RoundingMode {
616 kRoundToNearest = 0x0, 658 kRoundToNearest = 0x0,
617 kRoundDown = 0x1, 659 kRoundDown = 0x1,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 void shl(Type Ty, const Address &operand, GPRRegister shifter); 750 void shl(Type Ty, const Address &operand, GPRRegister shifter);
709 751
710 void shr(Type Ty, GPRRegister reg, const Immediate &imm); 752 void shr(Type Ty, GPRRegister reg, const Immediate &imm);
711 void shr(Type Ty, GPRRegister operand, GPRRegister shifter); 753 void shr(Type Ty, GPRRegister operand, GPRRegister shifter);
712 void shr(Type Ty, const Address &operand, GPRRegister shifter); 754 void shr(Type Ty, const Address &operand, GPRRegister shifter);
713 755
714 void sar(Type Ty, GPRRegister reg, const Immediate &imm); 756 void sar(Type Ty, GPRRegister reg, const Immediate &imm);
715 void sar(Type Ty, GPRRegister operand, GPRRegister shifter); 757 void sar(Type Ty, GPRRegister operand, GPRRegister shifter);
716 void sar(Type Ty, const Address &address, GPRRegister shifter); 758 void sar(Type Ty, const Address &address, GPRRegister shifter);
717 759
718 void shld(GPRRegister dst, GPRRegister src); 760 void shld(Type Ty, GPRRegister dst, GPRRegister src);
719 void shld(GPRRegister dst, GPRRegister src, const Immediate &imm); 761 void shld(Type Ty, GPRRegister dst, GPRRegister src, const Immediate &imm);
720 void shld(const Address &operand, GPRRegister src); 762 void shld(Type Ty, const Address &operand, GPRRegister src);
721 void shrd(GPRRegister dst, GPRRegister src); 763 void shrd(Type Ty, GPRRegister dst, GPRRegister src);
722 void shrd(GPRRegister dst, GPRRegister src, const Immediate &imm); 764 void shrd(Type Ty, GPRRegister dst, GPRRegister src, const Immediate &imm);
723 void shrd(const Address &dst, GPRRegister src); 765 void shrd(Type Ty, const Address &dst, GPRRegister src);
724 766
725 void neg(Type Ty, GPRRegister reg); 767 void neg(Type Ty, GPRRegister reg);
726 void neg(Type Ty, const Address &addr); 768 void neg(Type Ty, const Address &addr);
727 void notl(GPRRegister reg); 769 void notl(GPRRegister reg);
728 770
729 void bsf(Type Ty, GPRRegister dst, GPRRegister src); 771 void bsf(Type Ty, GPRRegister dst, GPRRegister src);
730 void bsf(Type Ty, GPRRegister dst, const Address &src); 772 void bsf(Type Ty, GPRRegister dst, const Address &src);
731 void bsr(Type Ty, GPRRegister dst, GPRRegister src); 773 void bsr(Type Ty, GPRRegister dst, GPRRegister src);
732 void bsr(Type Ty, GPRRegister dst, const Address &src); 774 void bsr(Type Ty, GPRRegister dst, const Address &src);
733 775
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { 878 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) {
837 buffer_.EmitFixup(fixup); 879 buffer_.EmitFixup(fixup);
838 } 880 }
839 881
840 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } 882 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); }
841 883
842 } // end of namespace x86 884 } // end of namespace x86
843 } // end of namespace Ice 885 } // end of namespace Ice
844 886
845 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ 887 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_
OLDNEW
« src/IceInstX8632.cpp ('K') | « src/IceInstX8632.cpp ('k') | src/assembler_ia32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698