brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 0878955 Raw
61 lines · plain
1// RUN: llvm-tblgen %s -gen-global-isel -optimize-match-table=false -I %p/../../../include -I %p/../Common | FileCheck %s2 3include "llvm/Target/Target.td"4include "GlobalISelEmitterCommon.td"5 6def InstThreeOperands : I<(outs GPR32:$dst), (ins GPR32:$cond, GPR32:$src,GPR32:$src2), []>;7 8class SrlPF<bit IC>: PatFrag<9  (ops node:$PATFRAG_Src0, node:$src1),10  (srl $PATFRAG_Src0, $src1)>, GISelFlags {11  let GIIgnoreCopies = IC;12}13 14// GIIgnoreCopies on Pattern15//  MIs[1] should be using IgnoreCopies variants.16let GIIgnoreCopies = 1 in17def : Pat<18  (i32 (sub (mul i32:$src0, i32:$src0), i32:$src1)),19  (InstThreeOperands GPR32:$src0, GPR32:$src1, GPR32:$src1)20>, GISelFlags;21 22// GIIgnoreCopies set on "root" PatFrag.23//  MIs[1] and MIs[2] should be using IgnoreCopies variants.24def : Pat<25  (i32 (SrlPF<1> (shl (mul i32:$src0, i32:$src0), i32:$src1), i32:$src0)),26  (InstThreeOperands GPR32:$src0, GPR32:$src1, GPR32:$src1)27>;28 29// GIIgnoreCopies set on "root" PatFrag, but a children PatFrag forces it back to zero.30//    MIs[1] should be using IgnoreCopies variants.31//    MIs[2] should NOT be using them.32def : Pat<33  (i32 (SrlPF<1> (SrlPF<0> (add i32:$src0, i32:$src0), i32:$src1), i32:$src0)),34  (InstThreeOperands GPR32:$src0, GPR32:$src1, GPR32:$src1)35>;36 37// CHECK: GIM_Try38// CHECK:    GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]39// CHECK:    GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_LSHR)40// CHECK:    GIM_RecordInsn, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]41// CHECK:    GIM_CheckOpcode, /*MI*/2, GIMT_Encode2(TargetOpcode::G_ADD)42// CHECK:    GIM_CheckIsSameOperand, /*MI*/2, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/143// CHECK:    GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/144// CHECK:    // (srl:{ *:[i32] } (srl:{ *:[i32] } (add:{ *:[i32] } i32:{ *:[i32] }:$src0, i32:{ *:[i32] }:$src0), i32:{ *:[i32] }:$src1), i32:{ *:[i32] }:$src0)45// CHECK:   GIR_EraseRootFromParent_Done46// CHECK: GIM_Try47// CHECK:   GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]48// CHECK:   GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_SHL)49// CHECK:   GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]50// CHECK:   GIM_CheckOpcode, /*MI*/2, GIMT_Encode2(TargetOpcode::G_MUL)51// CHECK:   GIM_CheckIsSameOperandIgnoreCopies, /*MI*/2, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/152// CHECK:   GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/153// CHECK:   // (srl:{ *:[i32] } (shl:{ *:[i32] } (mul:{ *:[i32] } i32:{ *:[i32] }:$src0, i32:{ *:[i32] }:$src0), i32:{ *:[i32] }:$src1), i32:{ *:[i32] }:$src0)54// CHECK:   GIR_EraseRootFromParent_Done55// CHECK: GIM_Try56// CHECK:   GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]57// CHECK:   GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_MUL)58// CHECK:   GIM_CheckIsSameOperandIgnoreCopies, /*MI*/1, /*OpIdx*/2, /*OtherMI*/1, /*OtherOpIdx*/159// CHECK:   // (sub:{ *:[i32] } (mul:{ *:[i32] } i32:{ *:[i32] }:$src0, i32:{ *:[i32] }:$src0), i32:{ *:[i32] }:$src1)  =>  (InstThreeOperands:{ *:[i32] } GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1, GPR32:{ *:[i32] }:$src1)60// CHECK:   GIR_EraseRootFromParent_Done61