@@ -2131,29 +2131,33 @@ defm INT_PTX_ATOM_CAS_16 : F_ATOMIC_3_AS<I16RT, atomic_cmp_swap_i16, "", "cas.b1
2131
2131
2132
2132
// Constructs intrinsic name and instruction asm strings.
2133
2133
multiclass ATOM2N_impl<string OpStr, string IntTypeStr, string TypeStr,
2134
- string ScopeStr, string SpaceStr,
2134
+ string ScopeStr, string SpaceStr, string SemStr,
2135
2135
RegTyInfo t, list<Predicate> Preds> {
2136
2136
defm "" : F_ATOMIC_2<t,
2137
- as_str = !if(!eq(ScopeStr, "gpu"), "", "." # ScopeStr),
2137
+ as_str = !if(!empty(SemStr), "", "." # SemStr)
2138
+ # !if(!eq(ScopeStr, "gpu"), "", "." # ScopeStr),
2138
2139
sem_str = !if(!eq(SpaceStr, "gen"), "", "." # SpaceStr),
2139
2140
op_str = OpStr # "." # TypeStr,
2140
2141
op = !cast<Intrinsic>(
2141
2142
"int_nvvm_atomic_" # OpStr
2142
2143
# "_" # SpaceStr # "_" # IntTypeStr
2143
- # !if(!empty(ScopeStr), "", "_" # ScopeStr)),
2144
+ # !if(!empty(SemStr), "", "_" # SemStr)
2145
+ # !if(!eq(ScopeStr, "gpu"), "", "_" # ScopeStr)),
2144
2146
preds = Preds>;
2145
2147
}
2146
2148
multiclass ATOM3N_impl<string OpStr, string IntTypeStr, string TypeStr,
2147
- string ScopeStr, string SpaceStr,
2149
+ string ScopeStr, string SpaceStr, string SemStr,
2148
2150
RegTyInfo t, list<Predicate> Preds> {
2149
2151
defm "" : F_ATOMIC_3<t,
2150
- as_str = !if(!eq(SpaceStr, "gen"), "", "." # SpaceStr),
2152
+ as_str = !if(!empty(SemStr), "", "." # SemStr)
2153
+ # !if(!eq(SpaceStr, "gen"), "", "." # SpaceStr),
2151
2154
sem_str = !if(!eq(ScopeStr, "gpu"), "", "." # ScopeStr),
2152
2155
op_str = OpStr # "." # TypeStr,
2153
2156
op = !cast<Intrinsic>(
2154
2157
"int_nvvm_atomic_" # OpStr
2155
2158
# "_" # SpaceStr # "_" # IntTypeStr
2156
- # !if(!empty(ScopeStr), "", "_" # ScopeStr)),
2159
+ # !if(!empty(SemStr), "", "_" # SemStr)
2160
+ # !if(!eq(ScopeStr, "gpu"), "", "_" # ScopeStr)),
2157
2161
preds = Preds>;
2158
2162
}
2159
2163
@@ -2162,24 +2166,67 @@ multiclass ATOM2S_impl<string OpStr, string IntTypeStr, string TypeStr,
2162
2166
// .gpu scope is default and is currently covered by existing
2163
2167
// atomics w/o explicitly specified scope.
2164
2168
foreach scope = ["cta", "sys"] in {
2165
- // For now we only need variants for generic space pointers.
2166
- foreach space = ["gen"] in {
2167
- defm _#scope#space : ATOM2N_impl<OpStr, IntTypeStr, TypeStr, scope, space,
2169
+ foreach space = ["gen", "global", "shared"] in {
2170
+ defm _#scope#space : ATOM2N_impl<OpStr, IntTypeStr, TypeStr, scope, space, "",
2168
2171
t, !listconcat(Preds, [hasAtomScope])>;
2169
2172
}
2170
2173
}
2174
+
2175
+ // .gpu scope is default as is "gen" space. Add unscoped intrinsics with
2176
+ // explicit address spaces.
2177
+ foreach scope = ["gpu"] in {
2178
+ foreach space = ["gen", "global", "shared"] in {
2179
+ defm _#scope#space : ATOM2N_impl<OpStr, IntTypeStr, TypeStr, scope, space,
2180
+ "", t, Preds>;
2181
+ }
2182
+ }
2183
+
2184
+ // Intrinsics with semantics, in all scopes and address spaces. Note the
2185
+ // separate predicates which keep these loops apart.
2186
+ foreach sem = ["acquire", "release", "acq_rel"] in {
2187
+ foreach scope = ["gpu", "cta", "sys"] in {
2188
+ // For now we only need variants for generic space pointers.
2189
+ foreach space = ["gen", "global", "shared"] in {
2190
+ defm _#sem#scope#space :
2191
+ ATOM2N_impl<OpStr, IntTypeStr, TypeStr, scope, space, sem,
2192
+ t, !listconcat(Preds, [hasAtomScope, hasAtomSemantics])>;
2193
+ }
2194
+ }
2195
+ }
2171
2196
}
2197
+
2172
2198
multiclass ATOM3S_impl<string OpStr, string IntTypeStr, string TypeStr,
2173
2199
RegTyInfo t, list<Predicate> Preds> {
2174
2200
// No need to define ".gpu"-scoped atomics. They do the same thing
2175
2201
// as the regular, non-scoped atomics defined elsewhere.
2176
2202
foreach scope = ["cta", "sys"] in {
2177
- // For now we only need variants for generic space pointers.
2178
- foreach space = ["gen"] in {
2179
- defm _#scope#space : ATOM3N_impl<OpStr, IntTypeStr, TypeStr, scope, space,
2203
+ foreach space = ["gen", "global", "shared"] in {
2204
+ defm _#scope#space : ATOM3N_impl<OpStr, IntTypeStr, TypeStr, scope, space, "",
2180
2205
t, !listconcat(Preds,[hasAtomScope])>;
2181
2206
}
2182
2207
}
2208
+
2209
+ // .gpu scope is default as is "gen" space. Add unscoped intrinsics with
2210
+ // explicit address spaces.
2211
+ foreach scope = ["gpu"] in {
2212
+ foreach space = ["gen", "global", "shared"] in {
2213
+ defm _#scope#space : ATOM3N_impl<OpStr, IntTypeStr, TypeStr, scope, space,
2214
+ "", t, Preds>;
2215
+ }
2216
+ }
2217
+
2218
+ // Intrinsics with semantics, in all scopes and address spaces. Note the
2219
+ // separate predicates which keep these loops apart.
2220
+ foreach sem = ["acquire", "release", "acq_rel"] in {
2221
+ foreach scope = ["gpu", "cta", "sys"] in {
2222
+ // For now we only need variants for generic space pointers.
2223
+ foreach space = ["gen", "global", "shared"] in {
2224
+ defm _#sem#scope#space :
2225
+ ATOM3N_impl<OpStr, IntTypeStr, TypeStr, scope, space, sem,
2226
+ t, !listconcat(Preds, [hasAtomScope, hasAtomSemantics])>;
2227
+ }
2228
+ }
2229
+ }
2183
2230
}
2184
2231
2185
2232
// atom.add
@@ -2216,6 +2263,7 @@ multiclass ATOM2_minmax_impl<string OpStr> {
2216
2263
// atom.{inc,dec}
2217
2264
multiclass ATOM2_incdec_impl<string OpStr> {
2218
2265
defm _u32 : ATOM2S_impl<OpStr, "i", "u32", I32RT, []>;
2266
+ defm _u64 : ATOM2S_impl<OpStr, "i", "u64", I64RT, []>;
2219
2267
}
2220
2268
2221
2269
// atom.cas
0 commit comments