Skip to content

Commit dd9b51b

Browse files
authored
Revert " Add builtin/intrinsic global_(load|store)_b128"
1 parent 3dd9bde commit dd9b51b

27 files changed

+9
-3883
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,52 +4901,6 @@ for a concrete target, and shall reflect the latter's identity and features.
49014901
Thus, it is possible to author high-level code, in e.g. HIP, that is target
49024902
adaptive in a dynamic fashion, contrary to macro based mechanisms.
49034903
4904-
__builtin_amdgcn_global_load_b128 and __builtin_amdgcn_global_store_b128
4905-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4906-
4907-
Signature:
4908-
4909-
.. code-block:: c
4910-
4911-
typedef __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int v4u;
4912-
typedef v4u __attribute__((address_space(1))) *global_ptr_to_v4u;
4913-
4914-
v4u __builtin_amdgcn_global_load_b128(
4915-
v4u __attribute__((address_space(1))) *src,
4916-
const char *scope);
4917-
4918-
void __builtin_amdgcn_global_store_b128(
4919-
v4u __attribute__((address_space(1))) *dst,
4920-
v4u data,
4921-
const char *scope);
4922-
4923-
Load or store a vector of 4 unsigned integers from or to global memory with
4924-
cache behavior specified by `scope` which must be a string literal.
4925-
4926-
Valid values for `scope` are:
4927-
4928-
===================== ==========================================================
4929-
scope architecture name
4930-
===================== ==========================================================
4931-
``"wavefront"`` wave
4932-
4933-
``"workgroup"`` group
4934-
4935-
``"agent"`` device
4936-
4937-
``""`` (empty string) system
4938-
===================== ==========================================================
4939-
4940-
These builtins are only supported on gfx942 and gfx950 devices.
4941-
4942-
For semantics on gfx942, see Tables 47 and 48 in section 9.1.10 "Memory Scope
4943-
and Temporal Controls" of the "AMD Instinct MI300" Instruction Set Architecture
4944-
Reference.
4945-
4946-
For semantics on gfx950, see Tables 49 and 50 in section 9.1.10 "Memory Scope
4947-
and Temporal Controls" of the CDNA4 Instruction Set Architecture Reference.
4948-
4949-
49504904
ARM/AArch64 Language Extensions
49514905
-------------------------------
49524906

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ BUILTIN(__builtin_amdgcn_raw_buffer_load_b128, "V4UiQbiiIi", "n")
165165

166166
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_load_lds, "vQbv*3IUiiiIiIi", "t", "vmem-to-lds-load-insts")
167167

168-
TARGET_BUILTIN(__builtin_amdgcn_global_load_b128, "V4UiV4Ui*1cC*", "n", "gfx940-insts")
169-
TARGET_BUILTIN(__builtin_amdgcn_global_store_b128, "vV4Ui*1V4UicC*", "n", "gfx940-insts")
170-
171168
//===----------------------------------------------------------------------===//
172169
// Ballot builtins.
173170
//===----------------------------------------------------------------------===//

clang/include/clang/Sema/SemaAMDGPU.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class SemaAMDGPU : public SemaBase {
3030

3131
bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
3232

33-
bool checkScopedMemAccessFunctionCall(CallExpr *TheCall);
34-
3533
bool checkMovDPPFunctionCall(CallExpr *TheCall, unsigned NumArgs,
3634
unsigned NumDataArgs);
3735

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20116,26 +20116,6 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID,
2011620116
llvm::Function *F = CGM.getIntrinsic(IID, {LoadTy});
2011720117
return Builder.CreateCall(F, {Addr});
2011820118
}
20119-
case AMDGPU::BI__builtin_amdgcn_global_load_b128:
20120-
case AMDGPU::BI__builtin_amdgcn_global_store_b128: {
20121-
const bool IsStore =
20122-
BuiltinID == AMDGPU::BI__builtin_amdgcn_global_store_b128;
20123-
LLVMContext &Ctx = CGM.getLLVMContext();
20124-
SmallVector<Value *, 5> Args = {EmitScalarExpr(E->getArg(0))}; // addr
20125-
if (IsStore)
20126-
Args.push_back(EmitScalarExpr(E->getArg(1))); // data
20127-
const unsigned ScopeIdx = E->getNumArgs() - 1;
20128-
StringRef ScopeLit =
20129-
cast<StringLiteral>(E->getArg(ScopeIdx)->IgnoreParenCasts())
20130-
->getString();
20131-
llvm::MDNode *MD =
20132-
llvm::MDNode::get(Ctx, {llvm::MDString::get(Ctx, ScopeLit)});
20133-
Args.push_back(llvm::MetadataAsValue::get(Ctx, MD)); // scope
20134-
llvm::Function *F =
20135-
CGM.getIntrinsic(IsStore ? Intrinsic::amdgcn_global_store_b128
20136-
: Intrinsic::amdgcn_global_load_b128);
20137-
return Builder.CreateCall(F, Args);
20138-
}
2013920119
case AMDGPU::BI__builtin_amdgcn_get_fpenv: {
2014020120
Function *F = CGM.getIntrinsic(Intrinsic::get_fpenv,
2014120121
{llvm::Type::getInt64Ty(getLLVMContext())});

clang/lib/Sema/SemaAMDGPU.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ bool SemaAMDGPU::CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID,
8484
case AMDGPU::BI__builtin_amdgcn_update_dpp: {
8585
return checkMovDPPFunctionCall(TheCall, 6, 2);
8686
}
87-
case AMDGPU::BI__builtin_amdgcn_global_load_b128:
88-
case AMDGPU::BI__builtin_amdgcn_global_store_b128:
89-
return checkScopedMemAccessFunctionCall(TheCall);
9087
default:
9188
return false;
9289
}
@@ -132,19 +129,6 @@ bool SemaAMDGPU::CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID,
132129
return false;
133130
}
134131

135-
bool SemaAMDGPU::checkScopedMemAccessFunctionCall(CallExpr *TheCall) {
136-
bool Fail = false;
137-
// Last argument is a string literal
138-
Expr *Arg = TheCall->getArg(TheCall->getNumArgs() - 1);
139-
auto Scope = dyn_cast<StringLiteral>(Arg->IgnoreParenCasts());
140-
if (!Scope) {
141-
Fail = true;
142-
Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal)
143-
<< Arg->getSourceRange();
144-
}
145-
return Fail;
146-
}
147-
148132
bool SemaAMDGPU::checkMovDPPFunctionCall(CallExpr *TheCall, unsigned NumArgs,
149133
unsigned NumDataArgs) {
150134
assert(NumDataArgs <= 2);

clang/lib/Sema/SemaExpr.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6247,8 +6247,7 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
62476247
return nullptr;
62486248
Expr *Arg = ArgRes.get();
62496249
QualType ArgType = Arg->getType();
6250-
if (!ParamType->isPointerType() ||
6251-
ParamType->getPointeeType().hasAddressSpace() ||
6250+
if (!ParamType->isPointerType() || ParamType.hasAddressSpace() ||
62526251
!ArgType->isPointerType() ||
62536252
!ArgType->getPointeeType().hasAddressSpace() ||
62546253
isPtrSizeAddressSpace(ArgType->getPointeeType().getAddressSpace())) {
@@ -6257,6 +6256,9 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
62576256
}
62586257

62596258
QualType PointeeType = ParamType->getPointeeType();
6259+
if (PointeeType.hasAddressSpace())
6260+
continue;
6261+
62606262
NeedsNewDecl = true;
62616263
LangAS AS = ArgType->getPointeeType().getAddressSpace();
62626264

clang/test/CodeGenOpenCL/builtins-amdgcn-global-load-store.cl

Lines changed: 0 additions & 99 deletions
This file was deleted.

clang/test/SemaOpenCL/builtins-amdgcn-global-load-store-error.cl

Lines changed: 0 additions & 22 deletions
This file was deleted.

clang/test/SemaOpenCL/builtins-amdgcn-global-load-store-target-error.cl

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)