mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
[globalisel] Add support for intrinsic_w_chain.
This maps directly to G_INTRINSIC_W_SIDE_EFFECTS. llvm-svn: 313627
This commit is contained in:
parent
0ac8aa21f4
commit
4b1144e7ae
@ -66,6 +66,7 @@ def : GINodeEquiv<G_FPOW, fpow>;
|
||||
def : GINodeEquiv<G_FEXP2, fexp2>;
|
||||
def : GINodeEquiv<G_FLOG2, flog2>;
|
||||
def : GINodeEquiv<G_INTRINSIC, intrinsic_wo_chain>;
|
||||
def : GINodeEquiv<G_INTRINSIC_W_SIDE_EFFECTS, intrinsic_w_chain>;
|
||||
def : GINodeEquiv<G_BR, br>;
|
||||
|
||||
// Specifies the GlobalISel equivalents for SelectionDAG's ComplexPattern.
|
||||
|
@ -0,0 +1,27 @@
|
||||
# RUN: llc -mtriple=i386-- -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s
|
||||
|
||||
--- |
|
||||
define void @read_flags() { ret void }
|
||||
...
|
||||
|
||||
---
|
||||
# Check that we select a the x86.flags.read.u32 intrinsic into a RDFLAGS
|
||||
# instruction. Also check that we constrain the register class of the COPY to
|
||||
# gr32.
|
||||
# CHECK-LABEL: name: read_flags
|
||||
name: read_flags
|
||||
legalized: true
|
||||
regBankSelected: true
|
||||
|
||||
# CHECK: registers:
|
||||
# CHECK-NEXT: - { id: 0, class: gr32, preferred-register: '' }
|
||||
registers:
|
||||
- { id: 0, class: gpr }
|
||||
|
||||
# CHECK: body:
|
||||
# CHECK: %0 = RDFLAGS32
|
||||
body: |
|
||||
bb.0:
|
||||
%0(s32) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.x86.flags.read.u32)
|
||||
%rax = COPY %0(s32)
|
||||
...
|
@ -2038,9 +2038,11 @@ GlobalISelEmitter::createAndImportSelDAGMatcher(InstructionMatcher &InsnMatcher,
|
||||
for (unsigned i = 0, e = Src->getNumChildren(); i != e; ++i) {
|
||||
TreePatternNode *SrcChild = Src->getChild(i);
|
||||
|
||||
// For G_INTRINSIC, the operand immediately following the defs is an
|
||||
// intrinsic ID.
|
||||
if (SrcGIOrNull->TheDef->getName() == "G_INTRINSIC" && i == 0) {
|
||||
// For G_INTRINSIC/G_INTRINSIC_W_SIDE_EFFECTS, the operand immediately
|
||||
// following the defs is an intrinsic ID.
|
||||
if ((SrcGIOrNull->TheDef->getName() == "G_INTRINSIC" ||
|
||||
SrcGIOrNull->TheDef->getName() == "G_INTRINSIC_W_SIDE_EFFECTS") &&
|
||||
i == 0) {
|
||||
if (const CodeGenIntrinsic *II = Src->getIntrinsicInfo(CGP)) {
|
||||
OperandMatcher &OM =
|
||||
InsnMatcher.addOperand(OpIdx++, SrcChild->getName(), TempOpIdx);
|
||||
|
Loading…
Reference in New Issue
Block a user