[PATCH] D99298: [AArch64][GlobalISel] Make G_UBFX/G_SBFX legalization check for constants
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 13:59:53 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG56e6eb797599: [AArch64][GlobalISel] Make G_UBFX/G_SBFX legalization check for constants (authored by paquette).
Changed prior to commit:
https://reviews.llvm.org/D99298?vs=333108&id=333117#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99298/new/
https://reviews.llvm.org/D99298
Files:
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
Index: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
===================================================================
--- llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
+++ llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
@@ -47,6 +47,8 @@
MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const;
bool legalizeVectorTrunc(MachineInstr &MI, LegalizerHelper &Helper) const;
+ bool legalizeBitfieldExtract(MachineInstr &MI, MachineRegisterInfo &MRI,
+ LegalizerHelper &Helper) const;
const AArch64Subtarget *ST;
};
} // End llvm namespace.
Index: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -702,7 +702,8 @@
getActionDefinitionsBuilder({G_FSHL, G_FSHR}).lower();
- getActionDefinitionsBuilder({G_SBFX, G_UBFX}).legalFor({s32, s64});
+ getActionDefinitionsBuilder({G_SBFX, G_UBFX}).customFor({s32, s64});
+
computeTables();
verify(*ST.getInstrInfo());
}
@@ -729,6 +730,9 @@
return legalizeSmallCMGlobalValue(MI, MRI, MIRBuilder, Observer);
case TargetOpcode::G_TRUNC:
return legalizeVectorTrunc(MI, Helper);
+ case TargetOpcode::G_SBFX:
+ case TargetOpcode::G_UBFX:
+ return legalizeBitfieldExtract(MI, MRI, Helper);
}
llvm_unreachable("expected switch to return");
@@ -948,3 +952,11 @@
MI.eraseFromParent();
return true;
}
+
+bool AArch64LegalizerInfo::legalizeBitfieldExtract(
+ MachineInstr &MI, MachineRegisterInfo &MRI, LegalizerHelper &Helper) const {
+ // Only legal if we can select immediate forms.
+ // TODO: Lower this otherwise.
+ return getConstantVRegValWithLookThrough(MI.getOperand(2).getReg(), MRI) &&
+ getConstantVRegValWithLookThrough(MI.getOperand(3).getReg(), MRI);
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99298.333117.patch
Type: text/x-patch
Size: 1990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210324/00ee87b4/attachment.bin>
More information about the llvm-commits
mailing list