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

Side by Side Diff: src/IceInstARM32.h

Issue 1878943009: Subzero. ARM32. Vector casts. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Adds vcvt assembler lit tests. 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
OLDNEW
1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 Vcvt, 431 Vcvt,
432 Vdiv, 432 Vdiv,
433 Veor, 433 Veor,
434 Vmla, 434 Vmla,
435 Vmls, 435 Vmls,
436 Vmrs, 436 Vmrs,
437 Vmul, 437 Vmul,
438 Vneg, 438 Vneg,
439 Vorr, 439 Vorr,
440 Vshl, 440 Vshl,
441 Vshr,
441 Vsqrt, 442 Vsqrt,
442 Vsub 443 Vsub
443 }; 444 };
444 445
445 static constexpr size_t InstSize = sizeof(uint32_t); 446 static constexpr size_t InstSize = sizeof(uint32_t);
446 447
447 static CondARM32::Cond getOppositeCondition(CondARM32::Cond Cond); 448 static CondARM32::Cond getOppositeCondition(CondARM32::Cond Cond);
448 449
449 /// Called inside derived methods emit() to communicate that multiple 450 /// Called inside derived methods emit() to communicate that multiple
450 /// instructions are being generated. Used by emitIAS() methods to 451 /// instructions are being generated. Used by emitIAS() methods to
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 816
816 public: 817 public:
817 /// Create a vector/FP binary-op instruction like vadd, and vsub. Everything 818 /// Create a vector/FP binary-op instruction like vadd, and vsub. Everything
818 /// must be a register. 819 /// must be a register.
819 static InstARM32ThreeAddrSignAwareFP *create(Cfg *Func, Variable *Dest, 820 static InstARM32ThreeAddrSignAwareFP *create(Cfg *Func, Variable *Dest,
820 Variable *Src0, Variable *Src1) { 821 Variable *Src0, Variable *Src1) {
821 return new (Func->allocate<InstARM32ThreeAddrSignAwareFP>()) 822 return new (Func->allocate<InstARM32ThreeAddrSignAwareFP>())
822 InstARM32ThreeAddrSignAwareFP(Func, Dest, Src0, Src1); 823 InstARM32ThreeAddrSignAwareFP(Func, Dest, Src0, Src1);
823 } 824 }
824 825
826 static InstARM32ThreeAddrSignAwareFP *
827 create(Cfg *Func, Variable *Dest, Variable *Src0, ConstantInteger32 *Src1) {
828 return new (Func->allocate<InstARM32ThreeAddrSignAwareFP>())
829 InstARM32ThreeAddrSignAwareFP(Func, Dest, Src0, Src1);
830 }
831
825 void emitIAS(const Cfg *Func) const override; 832 void emitIAS(const Cfg *Func) const override;
826 void setSignType(InstARM32::FPSign SignType) { this->Sign = SignType; } 833 void setSignType(InstARM32::FPSign SignType) { this->Sign = SignType; }
827 834
828 private: 835 private:
829 InstARM32ThreeAddrSignAwareFP(Cfg *Func, Variable *Dest, Variable *Src0, 836 InstARM32ThreeAddrSignAwareFP(Cfg *Func, Variable *Dest, Variable *Src0,
830 Variable *Src1) 837 Operand *Src1)
831 : InstARM32ThreeAddrFP<K>(Func, Dest, Src0, Src1) {} 838 : InstARM32ThreeAddrFP<K>(Func, Dest, Src0, Src1) {}
832 }; 839 };
833 840
834 /// Instructions of the form x := a op1 (y op2 z). E.g., multiply accumulate. 841 /// Instructions of the form x := a op1 (y op2 z). E.g., multiply accumulate.
835 template <InstARM32::InstKindARM32 K> 842 template <InstARM32::InstKindARM32 K>
836 class InstARM32FourAddrGPR : public InstARM32Pred { 843 class InstARM32FourAddrGPR : public InstARM32Pred {
837 InstARM32FourAddrGPR() = delete; 844 InstARM32FourAddrGPR() = delete;
838 InstARM32FourAddrGPR(const InstARM32FourAddrGPR &) = delete; 845 InstARM32FourAddrGPR(const InstARM32FourAddrGPR &) = delete;
839 InstARM32FourAddrGPR &operator=(const InstARM32FourAddrGPR &) = delete; 846 InstARM32FourAddrGPR &operator=(const InstARM32FourAddrGPR &) = delete;
840 847
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 using InstARM32Vadd = InstARM32ThreeAddrFP<InstARM32::Vadd>; 993 using InstARM32Vadd = InstARM32ThreeAddrFP<InstARM32::Vadd>;
987 using InstARM32Vand = InstARM32ThreeAddrFP<InstARM32::Vand>; 994 using InstARM32Vand = InstARM32ThreeAddrFP<InstARM32::Vand>;
988 using InstARM32Vdiv = InstARM32ThreeAddrFP<InstARM32::Vdiv>; 995 using InstARM32Vdiv = InstARM32ThreeAddrFP<InstARM32::Vdiv>;
989 using InstARM32Veor = InstARM32ThreeAddrFP<InstARM32::Veor>; 996 using InstARM32Veor = InstARM32ThreeAddrFP<InstARM32::Veor>;
990 using InstARM32Vmla = InstARM32FourAddrFP<InstARM32::Vmla>; 997 using InstARM32Vmla = InstARM32FourAddrFP<InstARM32::Vmla>;
991 using InstARM32Vmls = InstARM32FourAddrFP<InstARM32::Vmls>; 998 using InstARM32Vmls = InstARM32FourAddrFP<InstARM32::Vmls>;
992 using InstARM32Vmul = InstARM32ThreeAddrFP<InstARM32::Vmul>; 999 using InstARM32Vmul = InstARM32ThreeAddrFP<InstARM32::Vmul>;
993 using InstARM32Vneg = InstARM32UnaryopSignAwareFP<InstARM32::Vneg>; 1000 using InstARM32Vneg = InstARM32UnaryopSignAwareFP<InstARM32::Vneg>;
994 using InstARM32Vorr = InstARM32ThreeAddrFP<InstARM32::Vorr>; 1001 using InstARM32Vorr = InstARM32ThreeAddrFP<InstARM32::Vorr>;
995 using InstARM32Vshl = InstARM32ThreeAddrSignAwareFP<InstARM32::Vshl>; 1002 using InstARM32Vshl = InstARM32ThreeAddrSignAwareFP<InstARM32::Vshl>;
1003 using InstARM32Vshr = InstARM32ThreeAddrSignAwareFP<InstARM32::Vshr>;
996 using InstARM32Vsub = InstARM32ThreeAddrFP<InstARM32::Vsub>; 1004 using InstARM32Vsub = InstARM32ThreeAddrFP<InstARM32::Vsub>;
997 using InstARM32Ldr = InstARM32LoadBase<InstARM32::Ldr>; 1005 using InstARM32Ldr = InstARM32LoadBase<InstARM32::Ldr>;
998 using InstARM32Ldrex = InstARM32LoadBase<InstARM32::Ldrex>; 1006 using InstARM32Ldrex = InstARM32LoadBase<InstARM32::Ldrex>;
999 /// MovT leaves the bottom bits alone so dest is also a source. This helps 1007 /// MovT leaves the bottom bits alone so dest is also a source. This helps
1000 /// indicate that a previous MovW setting dest is not dead code. 1008 /// indicate that a previous MovW setting dest is not dead code.
1001 using InstARM32Movt = InstARM32TwoAddrGPR<InstARM32::Movt>; 1009 using InstARM32Movt = InstARM32TwoAddrGPR<InstARM32::Movt>;
1002 using InstARM32Movw = InstARM32UnaryopGPR<InstARM32::Movw, false>; 1010 using InstARM32Movw = InstARM32UnaryopGPR<InstARM32::Movw, false>;
1003 using InstARM32Clz = InstARM32UnaryopGPR<InstARM32::Clz, false>; 1011 using InstARM32Clz = InstARM32UnaryopGPR<InstARM32::Clz, false>;
1004 using InstARM32Mvn = InstARM32UnaryopGPR<InstARM32::Mvn, false>; 1012 using InstARM32Mvn = InstARM32UnaryopGPR<InstARM32::Mvn, false>;
1005 using InstARM32Rbit = InstARM32UnaryopGPR<InstARM32::Rbit, false>; 1013 using InstARM32Rbit = InstARM32UnaryopGPR<InstARM32::Rbit, false>;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 Variable *DestHi; 1359 Variable *DestHi;
1352 }; 1360 };
1353 1361
1354 /// Handles fp2int, int2fp, and fp2fp conversions. 1362 /// Handles fp2int, int2fp, and fp2fp conversions.
1355 class InstARM32Vcvt final : public InstARM32Pred { 1363 class InstARM32Vcvt final : public InstARM32Pred {
1356 InstARM32Vcvt() = delete; 1364 InstARM32Vcvt() = delete;
1357 InstARM32Vcvt(const InstARM32Vcvt &) = delete; 1365 InstARM32Vcvt(const InstARM32Vcvt &) = delete;
1358 InstARM32Vcvt &operator=(const InstARM32Vcvt &) = delete; 1366 InstARM32Vcvt &operator=(const InstARM32Vcvt &) = delete;
1359 1367
1360 public: 1368 public:
1361 enum VcvtVariant { S2si, S2ui, Si2s, Ui2s, D2si, D2ui, Si2d, Ui2d, S2d, D2s }; 1369 enum VcvtVariant {
1370 S2si,
1371 S2ui,
1372 Si2s,
1373 Ui2s,
1374 D2si,
1375 D2ui,
1376 Si2d,
1377 Ui2d,
1378 S2d,
1379 D2s,
1380 Vs2si,
1381 Vs2ui,
1382 Vsi2s,
1383 Vui2s,
1384 };
1362 static InstARM32Vcvt *create(Cfg *Func, Variable *Dest, Variable *Src, 1385 static InstARM32Vcvt *create(Cfg *Func, Variable *Dest, Variable *Src,
1363 VcvtVariant Variant, CondARM32::Cond Predicate) { 1386 VcvtVariant Variant, CondARM32::Cond Predicate) {
1364 return new (Func->allocate<InstARM32Vcvt>()) 1387 return new (Func->allocate<InstARM32Vcvt>())
1365 InstARM32Vcvt(Func, Dest, Src, Variant, Predicate); 1388 InstARM32Vcvt(Func, Dest, Src, Variant, Predicate);
1366 } 1389 }
1367 void emit(const Cfg *Func) const override; 1390 void emit(const Cfg *Func) const override;
1368 void emitIAS(const Cfg *Func) const override; 1391 void emitIAS(const Cfg *Func) const override;
1369 void dump(const Cfg *Func) const override; 1392 void dump(const Cfg *Func) const override;
1370 static bool classof(const Inst *Instr) { return isClassof(Instr, Vcvt); } 1393 static bool classof(const Inst *Instr) { return isClassof(Instr, Vcvt); }
1371 1394
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 // violations and link errors. 1607 // violations and link errors.
1585 1608
1586 template <> void InstARM32Ldr::emit(const Cfg *Func) const; 1609 template <> void InstARM32Ldr::emit(const Cfg *Func) const;
1587 template <> void InstARM32Movw::emit(const Cfg *Func) const; 1610 template <> void InstARM32Movw::emit(const Cfg *Func) const;
1588 template <> void InstARM32Movt::emit(const Cfg *Func) const; 1611 template <> void InstARM32Movt::emit(const Cfg *Func) const;
1589 1612
1590 } // end of namespace ARM32 1613 } // end of namespace ARM32
1591 } // end of namespace Ice 1614 } // end of namespace Ice
1592 1615
1593 #endif // SUBZERO_SRC_ICEINSTARM32_H 1616 #endif // SUBZERO_SRC_ICEINSTARM32_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698