1// RUN: llvm-tblgen -gen-global-isel -optimize-match-table=false -I %p/Common -I %p/../../include %s -o - < %s | FileCheck -check-prefix=GISEL %s 2 3include "llvm/Target/Target.td" 4include "GlobalISelEmitterCommon.td" 5 6let TargetPrefix = "mytarget" in { 7def int_mytarget_sleep0 : Intrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>; 8def int_mytarget_sleep1 : Intrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>; 9} 10 11// GISEL: GIM_CheckOpcode, /*MI*/0, TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS, 12// GISEL-NEXT: // MIs[0] Operand 0 13// GISEL-NEXT: GIM_CheckIntrinsicID, /*MI*/0, /*Op*/0, Intrinsic::mytarget_sleep0, 14// GISEL-NEXT: // MIs[0] src 15// GISEL-NEXT: GIM_CheckIsImm, /*MI*/0, /*Op*/1, 16// GISEL-NEXT: // (intrinsic_void {{[0-9]+}}:{ *:[iPTR] }, (timm:{ *:[i32] }):$src) => (SLEEP0 (timm:{ *:[i32] }):$src) 17// GISEL-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/MyTarget::SLEEP0, 18// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src 19def SLEEP0 : I<(outs), (ins i32imm:$src), 20 [(int_mytarget_sleep0 timm:$src)] 21>; 22 23// Test for situation which was crashing in ARM patterns. 24def p_imm : Operand<i32>; 25def SLEEP1 : I<(outs), (ins p_imm:$src), []>; 26 27// FIXME: This should not crash, but should it work or be an error? 28// def : Pat < 29// (int_mytarget_sleep1 timm:$src), 30// (SLEEP1 imm:$src) 31// >; 32