@@ -33,6 +33,9 @@ def AS_match {
3333 code shared = [{
3434 return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_SHARED);
3535 }];
36+ code shared_cluster = [{
37+ return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_SHARED_CLUSTER);
38+ }];
3639 code global = [{
3740 return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_GLOBAL);
3841 }];
@@ -2039,10 +2042,11 @@ class ATOMIC_GLOBAL_CHK <dag frag>
20392042 : PatFrag<!setdagop(frag, ops), frag, AS_match.global>;
20402043class ATOMIC_SHARED_CHK <dag frag>
20412044 : PatFrag<!setdagop(frag, ops), frag, AS_match.shared>;
2045+ class ATOMIC_SHARED_CLUSTER_CHK <dag frag>
2046+ : PatFrag<!setdagop(frag, ops), frag, AS_match.shared_cluster>;
20422047class ATOMIC_GENERIC_CHK <dag frag>
20432048 : PatFrag<!setdagop(frag, ops), frag, AS_match.generic>;
20442049
2045-
20462050multiclass F_ATOMIC_2<RegTyInfo t, string sem_str, string as_str, string op_str,
20472051 SDPatternOperator op, list<Predicate> preds> {
20482052 defvar asm_str = "atom" # sem_str # as_str # "." # op_str # " \t$dst, [$addr], $b;";
@@ -2094,13 +2098,15 @@ multiclass F_ATOMIC_2_AS<RegTyInfo t, SDPatternOperator frag, string op_str, lis
20942098 defvar frag_pat = (frag node:$a, node:$b);
20952099 defm _G : F_ATOMIC_2<t, "", ".global", op_str, ATOMIC_GLOBAL_CHK<frag_pat>, preds>;
20962100 defm _S : F_ATOMIC_2<t, "", ".shared", op_str, ATOMIC_SHARED_CHK<frag_pat>, preds>;
2101+ defm _S_C : F_ATOMIC_2<t, "", ".shared::cluster", op_str, ATOMIC_SHARED_CLUSTER_CHK<frag_pat>, !listconcat([hasClusters], preds)>;
20972102 defm _GEN : F_ATOMIC_2<t, "", "", op_str, ATOMIC_GENERIC_CHK<frag_pat>, preds>;
20982103}
20992104
21002105multiclass F_ATOMIC_3_AS<RegTyInfo t, SDPatternOperator frag, string sem_str, string op_str, list<Predicate> preds = []> {
21012106 defvar frag_pat = (frag node:$a, node:$b, node:$c);
21022107 defm _G : F_ATOMIC_3<t, sem_str, ".global", op_str, ATOMIC_GLOBAL_CHK<frag_pat>, preds>;
21032108 defm _S : F_ATOMIC_3<t, sem_str, ".shared", op_str, ATOMIC_SHARED_CHK<frag_pat>, preds>;
2109+ defm _S_C : F_ATOMIC_3<t, sem_str, ".shared::cluster", op_str, ATOMIC_SHARED_CLUSTER_CHK<frag_pat>, !listconcat([hasClusters], preds)>;
21042110 defm _GEN : F_ATOMIC_3<t, sem_str, "", op_str, ATOMIC_GENERIC_CHK<frag_pat>, preds>;
21052111}
21062112
@@ -2381,25 +2387,32 @@ def INT_PTX_LDG_G_v4i32_ELE : VLDG_G_ELE_V4<"u32", Int32Regs>;
23812387def INT_PTX_LDG_G_v4f32_ELE : VLDG_G_ELE_V4<"f32", Float32Regs>;
23822388
23832389
2384- multiclass NG_TO_G<string Str> {
2385- def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
2386- "cvta." # Str # ".u32 \t$result, $src;", []>;
2387- def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
2388- "cvta." # Str # ".u64 \t$result, $src;", []>;
2390+ multiclass NG_TO_G<string Str, bit Supports32 = 1, list<Predicate> Preds = []> {
2391+ if Supports32 then
2392+ def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
2393+ "cvta." # Str # ".u32 \t$result, $src;", []>, Requires<Preds>;
2394+
2395+ def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
2396+ "cvta." # Str # ".u64 \t$result, $src;", []>, Requires<Preds>;
23892397}
23902398
2391- multiclass G_TO_NG<string Str> {
2392- def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
2393- "cvta.to." # Str # ".u32 \t$result, $src;", []>;
2394- def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
2395- "cvta.to." # Str # ".u64 \t$result, $src;", []>;
2399+ multiclass G_TO_NG<string Str, bit Supports32 = 1, list<Predicate> Preds = []> {
2400+ if Supports32 then
2401+ def "" : NVPTXInst<(outs Int32Regs:$result), (ins Int32Regs:$src),
2402+ "cvta.to." # Str # ".u32 \t$result, $src;", []>, Requires<Preds>;
2403+
2404+ def _64 : NVPTXInst<(outs Int64Regs:$result), (ins Int64Regs:$src),
2405+ "cvta.to." # Str # ".u64 \t$result, $src;", []>, Requires<Preds>;
23962406}
23972407
23982408foreach space = ["local", "shared", "global", "const", "param"] in {
23992409 defm cvta_#space : NG_TO_G<space>;
24002410 defm cvta_to_#space : G_TO_NG<space>;
24012411}
24022412
2413+ defm cvta_shared_cluster : NG_TO_G<"shared::cluster", false, [hasClusters]>;
2414+ defm cvta_to_shared_cluster : G_TO_NG<"shared::cluster", false, [hasClusters]>;
2415+
24032416def : Pat<(int_nvvm_ptr_param_to_gen i32:$src),
24042417 (cvta_param $src)>;
24052418
0 commit comments