1 // RUN: llvm-tblgen -gen-global-isel -I %p/../../include -I %p/Common %s -o - | FileCheck %s
4 include "llvm/Target/Target.td"
5 include "GlobalISelEmitterCommon.td"
7 let TargetPrefix = "mytarget" in {
8 def int_mytarget_anyptr : Intrinsic<[llvm_i32_ty], [llvm_anyptr_ty]>;
11 // Ensure that llvm_anyptr_ty on an intrinsic results in a
12 // GIM_CheckPointerToAny rather than a GIM_CheckType.
14 // CHECK: GIM_CheckIntrinsicID, /*MI*/0, /*Op*/1, Intrinsic::mytarget_anyptr,
15 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
16 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/MyTarget::GPR32RegClassID,
17 // CHECK-NEXT: // MIs[0] src
18 // CHECK-NEXT: GIM_CheckPointerToAny, /*MI*/0, /*Op*/2, /*SizeInBits*/32,
19 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/2, /*RC*/MyTarget::GPR32RegClassID,
20 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIPFP_MI_Predicate_frag_anyptr,
21 // CHECK-NEXT: // (intrinsic_w_chain:{ *:[i32] } {{[0-9]+}}:{ *:[iPTR] }, GPR32:{ *:[i32] }:$src)<<P:Predicate_frag_anyptr>> => (ANYLOAD:{ *:[i32] } GPR32:{ *:[i32] }:$src)
22 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/MyTarget::ANYLOAD,
23 let hasSideEffects = 1 in {
24 def ANYLOAD : I<(outs GPR32:$dst), (ins GPR32:$src1),
25 [(set GPR32:$dst, (load GPR32:$src1))]>;
28 def frag_anyptr : PatFrag<(ops node:$src),
29 (int_mytarget_anyptr node:$src),
30 [{ return true; // C++ code }]> {
31 let GISelPredicateCode = [{ return true; // C++ code }];
34 def : Pat<(frag_anyptr GPR32:$src),
35 (p0 (ANYLOAD GPR32:$src))>;