150
|
1 // RUN: llvm-tblgen -gen-global-isel -warn-on-skipped-patterns -optimize-match-table=false -I %p/../../include -I %p/Common %s -o - | FileCheck -check-prefix=GISEL %s
|
|
2
|
|
3 include "llvm/Target/Target.td"
|
|
4 include "GlobalISelEmitterCommon.td"
|
|
5
|
|
6 def shiftl_1 : SDNodeXForm<timm, [{
|
|
7 return CurDAG->getTargetConstant(N->getZExtValue() << 1, SDLoc(N), MVT::i32);
|
|
8 }]>;
|
|
9
|
|
10 def gi_shiftl_1 : GICustomOperandRenderer<"renderShiftImml1">,
|
|
11 GISDNodeXFormEquiv<shiftl_1>;
|
|
12
|
|
13
|
207
|
14 def int_mytarget_sleep : Intrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
|
|
15 def int_mytarget_foo : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [ImmArg<ArgIndex<1>>, IntrNoMem]>;
|
150
|
16
|
|
17
|
|
18 def SLEEP : I<(outs), (ins i32imm:$src0), []>;
|
|
19 def FOO : I<(outs GPR32:$dst), (ins GPR32:$src0, i32imm:$src1), []>;
|
|
20
|
|
21 // GISEL: GIM_CheckOpcode, /*MI*/0, TargetOpcode::G_INTRINSIC,
|
|
22 // GISEL: GIM_CheckIntrinsicID, /*MI*/0, /*Op*/1, Intrinsic::mytarget_foo,
|
|
23 // GISEL: GIM_CheckIsImm, /*MI*/0, /*Op*/3,
|
|
24 // GISEL: GIR_CustomOperandRenderer, /*InsnID*/0, /*OldInsnID*/0, /*OpIdx*/3, /*OperandRenderer*/GICR_renderShiftImml1, // src1
|
|
25 def : Pat<
|
|
26 (int_mytarget_foo i32:$src0, (i32 timm:$src1)),
|
|
27 (FOO GPR32:$src0, (shiftl_1 $src1))
|
|
28 >;
|
|
29
|
|
30 // GISEL: GIM_CheckOpcode, /*MI*/0, TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS,
|
|
31 // GISEL: GIM_CheckIntrinsicID, /*MI*/0, /*Op*/0, Intrinsic::mytarget_sleep,
|
|
32 // GISEL: GIM_CheckIsImm, /*MI*/0, /*Op*/1,
|
|
33 // GISEL: GIR_CustomOperandRenderer, /*InsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, /*OperandRenderer*/GICR_renderShiftImml1, // src0
|
|
34 def : Pat<
|
|
35 (int_mytarget_sleep (i32 timm:$src0)),
|
|
36 (SLEEP (shiftl_1 $src0))
|
|
37 >;
|