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

Side by Side Diff: src/IceInstARM32.h

Issue 1655313002: Subzero: ARM32: lowering of vector insert and extract. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | src/IceInstARM32.cpp » ('j') | src/IceInstARM32.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 /// \brief Declares the InstARM32 and OperandARM32 classes and their subclasses. 11 /// \brief Declares the InstARM32 and OperandARM32 classes and their subclasses.
12 /// 12 ///
13 /// This represents the machine instructions and operands used for ARM32 code 13 /// This represents the machine instructions and operands used for ARM32 code
14 /// selection. 14 /// selection.
15 /// 15 ///
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 17
18 #ifndef SUBZERO_SRC_ICEINSTARM32_H 18 #ifndef SUBZERO_SRC_ICEINSTARM32_H
19 #define SUBZERO_SRC_ICEINSTARM32_H 19 #define SUBZERO_SRC_ICEINSTARM32_H
20 20
21 #include "IceConditionCodesARM32.h" 21 #include "IceConditionCodesARM32.h"
22 #include "IceDefs.h" 22 #include "IceDefs.h"
23 #include "IceInst.h" 23 #include "IceInst.h"
24 #include "IceInstARM32.def" 24 #include "IceInstARM32.def"
25 #include "IceOperand.h" 25 #include "IceOperand.h"
26 #include "IceRegistersARM32.h"
26 27
27 namespace Ice { 28 namespace Ice {
28 namespace ARM32 { 29 namespace ARM32 {
29 30
30 /// Encoding of an ARM 32-bit instruction. 31 /// Encoding of an ARM 32-bit instruction.
31 using IValueT = uint32_t; 32 using IValueT = uint32_t;
32 33
33 /// An Offset value (+/-) used in an ARM 32-bit instruction. 34 /// An Offset value (+/-) used in an ARM 32-bit instruction.
34 using IOffsetT = int32_t; 35 using IOffsetT = int32_t;
35 36
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 And, 383 And,
383 Asr, 384 Asr,
384 Bic, 385 Bic,
385 Br, 386 Br,
386 Call, 387 Call,
387 Clz, 388 Clz,
388 Cmn, 389 Cmn,
389 Cmp, 390 Cmp,
390 Dmb, 391 Dmb,
391 Eor, 392 Eor,
393 Extract,
394 Insert,
392 Label, 395 Label,
393 Ldr, 396 Ldr,
394 Ldrex, 397 Ldrex,
395 Lsl, 398 Lsl,
396 Lsr, 399 Lsr,
397 Mla, 400 Mla,
398 Mls, 401 Mls,
399 Mov, 402 Mov,
400 Movt, 403 Movt,
401 Movw, 404 Movw,
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 void emitSingleDestMultiSource(const Cfg *Func) const; 1349 void emitSingleDestMultiSource(const Cfg *Func) const;
1347 void emitSingleDestSingleSource(const Cfg *Func) const; 1350 void emitSingleDestSingleSource(const Cfg *Func) const;
1348 1351
1349 void emitIASSingleDestSingleSource(const Cfg *Func) const; 1352 void emitIASSingleDestSingleSource(const Cfg *Func) const;
1350 void emitIASScalarVFPMove(const Cfg *Func) const; 1353 void emitIASScalarVFPMove(const Cfg *Func) const;
1351 void emitIASCoreVFPMove(const Cfg *Func) const; 1354 void emitIASCoreVFPMove(const Cfg *Func) const;
1352 1355
1353 Variable *DestHi = nullptr; 1356 Variable *DestHi = nullptr;
1354 }; 1357 };
1355 1358
1359 /// Common methods between InstARM32Extract and InstARM32Insert.
1360 class InstARM32ExtractInsert : public InstARM32Pred {
1361 InstARM32ExtractInsert() = delete;
1362 InstARM32ExtractInsert(const InstARM32ExtractInsert &) = delete;
1363 InstARM32ExtractInsert &operator=(const InstARM32ExtractInsert &) = delete;
1364
1365 protected:
1366 InstARM32ExtractInsert(Cfg *Func, Variable *Dest, uint32_t Index,
1367 CondARM32::Cond Predicate)
1368 : InstARM32Pred(Func, InstARM32::Extract, 2, Dest, Predicate),
Jim Stichnoth 2016/02/03 15:28:37 Since both Insert and Extract have a single source
Eric Holk 2016/02/03 21:02:21 Done. Originally I thought there was going to be
1369 Index(Index) {}
1370
1371 uint32_t Index;
Jim Stichnoth 2016/02/03 15:28:37 const uint32_t Index
John 2016/02/03 16:06:51 const also, why don't you add a const uint32_t N
Eric Holk 2016/02/03 21:02:21 It wasn't immediately clear what the right NumElem
Eric Holk 2016/02/03 21:02:21 Done.
1372
1373 // These next two functions find the D register that maps to the half of the Q
1374 // register that this instruction is accessing.
1375 RegARM32::AllRegisters getDRegister(Variable *Src, uint32_t VectorSize) const;
Jim Stichnoth 2016/02/03 15:28:37 This isn't absolutely clear-cut, but I think it wo
Eric Holk 2016/02/03 21:02:21 I wasn't totally thrilled with the design I used h
Jim Stichnoth 2016/02/03 22:32:21 I was thinking that the common code could determin
John 2016/02/04 15:23:57 what about defining a virtual method in this class
John 2016/02/04 15:23:57 Another issue I'd like to point out here. if this
Jim Stichnoth 2016/02/04 16:44:12 I recalled that in general, we had tried to avoid
John 2016/02/04 16:52:24 I am **not** suggesting this member in lieu of the
1376 uint32_t getDIndex(uint32_t VectorSize) const;
John 2016/02/03 16:06:51 VectorSize to me is always 128-bit. Maybe rename t
Eric Holk 2016/02/03 21:02:21 Done.
1377
1378 // For floating point values, we can read directly from an S register. This
1379 // function finds the right one.
1380 RegARM32::AllRegisters getSRegister(Variable *Src) const;
1381 };
Jim Stichnoth 2016/02/03 15:28:37 Implement classof() for completeness.
Eric Holk 2016/02/03 21:02:21 Does it make sense to have classof here, given tha
Jim Stichnoth 2016/02/03 22:32:21 If you aren't already aware, have a look at http:/
Eric Holk 2016/02/04 20:57:25 Ah, that makes sense. Thanks.
1382
1383 /// Generates vmov Rd, Dn[x] instructions, and their related floating point
1384 /// versions.
1385 class InstARM32Extract final : public InstARM32ExtractInsert {
1386 InstARM32Extract() = delete;
1387 InstARM32Extract(const InstARM32Extract &) = delete;
1388 InstARM32Extract &operator=(const InstARM32Extract &) = delete;
1389
1390 public:
1391 static InstARM32Extract *create(Cfg *Func, Variable *Dest, Variable *Src,
1392 uint32_t Index, CondARM32::Cond Predicate) {
1393 return new (Func->allocate<InstARM32Extract>())
1394 InstARM32Extract(Func, Dest, Src, Index, Predicate);
1395 }
1396 void emit(const Cfg *Func) const override;
1397 static bool classof(const Inst *Inst) { return isClassof(Inst, Extract); }
1398
1399 private:
1400 InstARM32Extract(Cfg *Func, Variable *Dest, Variable *Src, uint32_t Index,
1401 CondARM32::Cond Predicate);
1402 };
1403
1404 /// Generates vmov Dn[x], Rd instructions, and their related floating point
1405 /// versions.
1406 class InstARM32Insert final : public InstARM32ExtractInsert {
1407 InstARM32Insert() = delete;
1408 InstARM32Insert(const InstARM32Insert &) = delete;
1409 InstARM32Insert &operator=(const InstARM32Insert &) = delete;
1410
1411 public:
1412 static InstARM32Insert *create(Cfg *Func, Variable *Dest, Variable *Src0,
1413 uint32_t Index, CondARM32::Cond Predicate) {
1414 return new (Func->allocate<InstARM32Insert>())
1415 InstARM32Insert(Func, Dest, Src0, Index, Predicate);
1416 }
1417 void emit(const Cfg *Func) const override;
1418 static bool classof(const Inst *Inst) { return isClassof(Inst, Insert); }
1419
1420 private:
1421 InstARM32Insert(Cfg *Func, Variable *Dest, Variable *Src0, uint32_t Index,
Jim Stichnoth 2016/02/03 15:28:37 This parameter is named Src0, the one for Extract
Eric Holk 2016/02/03 21:02:21 Done.
1422 CondARM32::Cond Predicate);
1423 };
1424
1356 class InstARM32Vcmp final : public InstARM32Pred { 1425 class InstARM32Vcmp final : public InstARM32Pred {
1357 InstARM32Vcmp() = delete; 1426 InstARM32Vcmp() = delete;
1358 InstARM32Vcmp(const InstARM32Vcmp &) = delete; 1427 InstARM32Vcmp(const InstARM32Vcmp &) = delete;
1359 InstARM32Vcmp &operator=(const InstARM32Vcmp &) = delete; 1428 InstARM32Vcmp &operator=(const InstARM32Vcmp &) = delete;
1360 1429
1361 public: 1430 public:
1362 static InstARM32Vcmp *create(Cfg *Func, Variable *Src0, Variable *Src1, 1431 static InstARM32Vcmp *create(Cfg *Func, Variable *Src0, Variable *Src1,
1363 CondARM32::Cond Predicate) { 1432 CondARM32::Cond Predicate) {
1364 return new (Func->allocate<InstARM32Vcmp>()) 1433 return new (Func->allocate<InstARM32Vcmp>())
1365 InstARM32Vcmp(Func, Src0, Src1, Predicate); 1434 InstARM32Vcmp(Func, Src0, Src1, Predicate);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 // violations and link errors. 1511 // violations and link errors.
1443 1512
1444 template <> void InstARM32Ldr::emit(const Cfg *Func) const; 1513 template <> void InstARM32Ldr::emit(const Cfg *Func) const;
1445 template <> void InstARM32Movw::emit(const Cfg *Func) const; 1514 template <> void InstARM32Movw::emit(const Cfg *Func) const;
1446 template <> void InstARM32Movt::emit(const Cfg *Func) const; 1515 template <> void InstARM32Movt::emit(const Cfg *Func) const;
1447 1516
1448 } // end of namespace ARM32 1517 } // end of namespace ARM32
1449 } // end of namespace Ice 1518 } // end of namespace Ice
1450 1519
1451 #endif // SUBZERO_SRC_ICEINSTARM32_H 1520 #endif // SUBZERO_SRC_ICEINSTARM32_H
OLDNEW
« no previous file with comments | « no previous file | src/IceInstARM32.cpp » ('j') | src/IceInstARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698