summaryrefslogtreecommitdiff
path: root/lib/Target/AArch64/AArch64InstructionSelector.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-10-18 20:03:48 +0000
committerTim Northover <tnorthover@apple.com>2016-10-18 20:03:48 +0000
commit10519cde2d12678553bb92213d0a16e825c58581 (patch)
tree53aab408fd89b9a92dadf02ae7bc02fe17106dca /lib/Target/AArch64/AArch64InstructionSelector.cpp
parent4841e615e39bbd7bcceefbe722117e807f0125f6 (diff)
GlobalISel: select small binary operations on AArch64.
AArch64 actually supports many 8-bit operations under the definition used by GlobalISel: the designated information-carrying bits of a GPR32 get the right value if you just use the normal 32-bit instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/AArch64/AArch64InstructionSelector.cpp')
-rw-r--r--lib/Target/AArch64/AArch64InstructionSelector.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Target/AArch64/AArch64InstructionSelector.cpp b/lib/Target/AArch64/AArch64InstructionSelector.cpp
index ebfd78ba2b2..eb2614d482c 100644
--- a/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ b/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -123,8 +123,13 @@ static unsigned selectBinaryOp(unsigned GenericOpc, unsigned RegBankID,
unsigned OpSize) {
switch (RegBankID) {
case AArch64::GPRRegBankID:
- switch (OpSize) {
- case 32:
+ if (OpSize <= 32) {
+ assert((OpSize == 32 || (GenericOpc != TargetOpcode::G_SDIV &&
+ GenericOpc != TargetOpcode::G_UDIV &&
+ GenericOpc != TargetOpcode::G_LSHR &&
+ GenericOpc != TargetOpcode::G_ASHR)) &&
+ "operation should have been legalized before now");
+
switch (GenericOpc) {
case TargetOpcode::G_OR:
return AArch64::ORRWrr;
@@ -149,7 +154,7 @@ static unsigned selectBinaryOp(unsigned GenericOpc, unsigned RegBankID,
default:
return GenericOpc;
}
- case 64:
+ } else if (OpSize == 64) {
switch (GenericOpc) {
case TargetOpcode::G_OR:
return AArch64::ORRXrr;
@@ -676,7 +681,7 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
unsigned ZeroReg;
unsigned NewOpc;
- if (Ty == LLT::scalar(32)) {
+ if (Ty.isScalar() && Ty.getSizeInBits() <= 32) {
NewOpc = AArch64::MADDWrrr;
ZeroReg = AArch64::WZR;
} else if (Ty == LLT::scalar(64)) {