1 // RUN: llvm-tblgen -gen-dag-isel -I %p/../../include -I %p/Common %s -o - < %s | FileCheck -check-prefix=SDAG %s
2 // RUN: llvm-tblgen -gen-global-isel -warn-on-skipped-patterns -I %p/../../include -I %p/Common %s -o - < %s | FileCheck -check-prefix=GISEL %s
4 include "llvm/Target/Target.td"
5 include "GlobalISelEmitterCommon.td"
7 // Test the HasNoUse predicate
9 def NO_RET_ATOMIC_ADD : I<(outs), (ins GPR32Op:$src0, GPR32Op:$src1), []>;
12 // SDAG-NEXT: // Predicate_atomic_load_add_no_ret_32
13 // SDAG-NEXT: SDNode *N = Node;
14 // SDAG-NEXT: (void)N;
15 // SDAG-NEXT: if (cast<MemSDNode>(N)->getMemoryVT() != MVT::i32) return false;
16 // SDAG-NEXT: if (!SDValue(N, 0).use_empty()) return false;
17 // SDAG-NEXT: return true;
19 // GISEL: GIM_CheckOpcode, /*MI*/0, TargetOpcode::G_ATOMICRMW_ADD,
20 // GISEL-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
21 // GISEL-NEXT: GIM_CheckType, /*MI*/0, /*Op*/2, /*Type*/GILLT_s32,
22 // GISEL-NEXT: GIM_CheckMemorySizeEqualTo, /*MI*/0, /*MMO*/0, /*Size*/4,
23 // GISEL-NEXT: GIM_CheckHasNoUse, /*MI*/0,
24 // GISEL-NEXT: // MIs[0] src0
25 // GISEL-NEXT: GIM_CheckPointerToAny, /*MI*/0, /*Op*/1, /*SizeInBits*/0,
26 // GISEL-NEXT: // (atomic_load_add:{ *:[i32] } iPTR:{ *:[iPTR] }:$src0, i32:{ *:[i32] }:$src1)<<P:Predicate_atomic_load_add_no_ret_32>> => (NO_RET_ATOMIC_ADD GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1)
27 // GISEL-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/MyTarget::NO_RET_ATOMIC_ADD,
28 // GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
29 // GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // src1
30 // GISEL-NEXT: GIR_MergeMemOperands, /*InsnID*/0, /*MergeInsnID's*/0, GIU_MergeMemOperands_EndOfList,
31 // GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
32 // GISEL-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
33 let HasNoUse = true in
34 defm atomic_load_add_no_ret : binary_atomic_op<atomic_load_add>;
37 (atomic_load_add_no_ret_32 iPTR:$src0, i32:$src1),
38 (NO_RET_ATOMIC_ADD GPR32:$src0, GPR32:$src1)