Skip to content

Commit

Permalink
Merged master:fc553086287 into amd-gfx:afd574f5030
Browse files Browse the repository at this point in the history
Local branch amd-gfx afd574f Merged master:ed6b578040a into amd-gfx:d6efc5307af
Remote branch master fc55308 [PowerPC][Power10] Fix VINS* (vector insert byte/half/word) instructions to have i32 arguments.
  • Loading branch information
Sw authored and Sw committed Jul 16, 2020
2 parents afd574f + fc55308 commit 1fa313e
Show file tree
Hide file tree
Showing 223 changed files with 2,869 additions and 1,757 deletions.
84 changes: 63 additions & 21 deletions clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -4820,6 +4820,11 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
/// Total number of components in this clause.
unsigned NumComponents;

/// Whether this clause is possible to have user-defined mappers associated.
/// It should be true for map, to, and from clauses, and false for
/// use_device_ptr and is_device_ptr.
const bool SupportsMapper;

/// C++ nested name specifier for the associated user-defined mapper.
NestedNameSpecifierLoc MapperQualifierLoc;

Expand All @@ -4840,19 +4845,21 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
/// NumUniqueDeclarations: number of unique base declarations in this clause;
/// 3) NumComponentLists: number of component lists in this clause; and 4)
/// NumComponents: total number of expression components in the clause.
/// \param SupportsMapper Indicates whether this clause is possible to have
/// user-defined mappers associated.
/// \param MapperQualifierLocPtr C++ nested name specifier for the associated
/// user-defined mapper.
/// \param MapperIdInfoPtr The identifier of associated user-defined mapper.
OMPMappableExprListClause(
OpenMPClauseKind K, const OMPVarListLocTy &Locs,
const OMPMappableExprListSizeTy &Sizes,
const OMPMappableExprListSizeTy &Sizes, bool SupportsMapper = false,
NestedNameSpecifierLoc *MapperQualifierLocPtr = nullptr,
DeclarationNameInfo *MapperIdInfoPtr = nullptr)
: OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc,
Sizes.NumVars),
NumUniqueDeclarations(Sizes.NumUniqueDeclarations),
NumComponentLists(Sizes.NumComponentLists),
NumComponents(Sizes.NumComponents) {
NumComponents(Sizes.NumComponents), SupportsMapper(SupportsMapper) {
if (MapperQualifierLocPtr)
MapperQualifierLoc = *MapperQualifierLocPtr;
if (MapperIdInfoPtr)
Expand Down Expand Up @@ -5051,6 +5058,8 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
/// Get the user-defined mapper references that are in the trailing objects of
/// the class.
MutableArrayRef<Expr *> getUDMapperRefs() {
assert(SupportsMapper &&
"Must be a clause that is possible to have user-defined mappers");
return llvm::makeMutableArrayRef<Expr *>(
static_cast<T *>(this)->template getTrailingObjects<Expr *>() +
OMPVarListClause<T>::varlist_size(),
Expand All @@ -5060,8 +5069,10 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
/// Get the user-defined mappers references that are in the trailing objects
/// of the class.
ArrayRef<Expr *> getUDMapperRefs() const {
assert(SupportsMapper &&
"Must be a clause that is possible to have user-defined mappers");
return llvm::makeArrayRef<Expr *>(
static_cast<T *>(this)->template getTrailingObjects<Expr *>() +
static_cast<const T *>(this)->template getTrailingObjects<Expr *>() +
OMPVarListClause<T>::varlist_size(),
OMPVarListClause<T>::varlist_size());
}
Expand All @@ -5071,6 +5082,8 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
void setUDMapperRefs(ArrayRef<Expr *> DMDs) {
assert(DMDs.size() == OMPVarListClause<T>::varlist_size() &&
"Unexpected number of user-defined mappers.");
assert(SupportsMapper &&
"Must be a clause that is possible to have user-defined mappers");
std::copy(DMDs.begin(), DMDs.end(), getUDMapperRefs().begin());
}

Expand Down Expand Up @@ -5107,6 +5120,12 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
// The list number associated with the current declaration.
ArrayRef<unsigned>::iterator NumListsCur;

// Whether this clause is possible to have user-defined mappers associated.
const bool SupportsMapper;

// The user-defined mapper associated with the current declaration.
ArrayRef<Expr *>::iterator MapperCur;

// Remaining lists for the current declaration.
unsigned RemainingLists = 0;

Expand All @@ -5127,26 +5146,32 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
explicit const_component_lists_iterator(
ArrayRef<ValueDecl *> UniqueDecls, ArrayRef<unsigned> DeclsListNum,
ArrayRef<unsigned> CumulativeListSizes,
MappableExprComponentListRef Components)
MappableExprComponentListRef Components, bool SupportsMapper,
ArrayRef<Expr *> Mappers)
: const_component_lists_iterator::iterator_adaptor_base(
Components.begin()),
DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()),
SupportsMapper(SupportsMapper),
ListSizeCur(CumulativeListSizes.begin()),
ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) {
assert(UniqueDecls.size() == DeclsListNum.size() &&
"Inconsistent number of declarations and list sizes!");
if (!DeclsListNum.empty())
RemainingLists = *NumListsCur;
if (SupportsMapper)
MapperCur = Mappers.begin();
}

/// Construct an iterator that scan lists for a given declaration \a
/// Declaration.
explicit const_component_lists_iterator(
const ValueDecl *Declaration, ArrayRef<ValueDecl *> UniqueDecls,
ArrayRef<unsigned> DeclsListNum, ArrayRef<unsigned> CumulativeListSizes,
MappableExprComponentListRef Components)
MappableExprComponentListRef Components, bool SupportsMapper,
ArrayRef<Expr *> Mappers)
: const_component_lists_iterator(UniqueDecls, DeclsListNum,
CumulativeListSizes, Components) {
CumulativeListSizes, Components,
SupportsMapper, Mappers) {
// Look for the desired declaration. While we are looking for it, we
// update the state so that we know the component where a given list
// starts.
Expand All @@ -5161,6 +5186,9 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
std::advance(ListSizeCur, *NumListsCur - 1);
PrevListSize = *ListSizeCur;
++ListSizeCur;

if (SupportsMapper)
++MapperCur;
}

// If we didn't find any declaration, advance the iterator to after the
Expand All @@ -5186,14 +5214,20 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,

// Return the array with the current list. The sizes are cumulative, so the
// array size is the difference between the current size and previous one.
std::pair<const ValueDecl *, MappableExprComponentListRef>
std::tuple<const ValueDecl *, MappableExprComponentListRef,
const ValueDecl *>
operator*() const {
assert(ListSizeCur != ListSizeEnd && "Invalid iterator!");
return std::make_pair(
const ValueDecl *Mapper = nullptr;
if (SupportsMapper && *MapperCur)
Mapper = cast<ValueDecl>(cast<DeclRefExpr>(*MapperCur)->getDecl());
return std::make_tuple(
*DeclCur,
MappableExprComponentListRef(&*this->I, *ListSizeCur - PrevListSize));
MappableExprComponentListRef(&*this->I, *ListSizeCur - PrevListSize),
Mapper);
}
std::pair<const ValueDecl *, MappableExprComponentListRef>
std::tuple<const ValueDecl *, MappableExprComponentListRef,
const ValueDecl *>
operator->() const {
return **this;
}
Expand All @@ -5216,6 +5250,8 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
if (!(--RemainingLists)) {
++DeclCur;
++NumListsCur;
if (SupportsMapper)
++MapperCur;
RemainingLists = *NumListsCur;
assert(RemainingLists && "No lists in the following declaration??");
}
Expand All @@ -5233,13 +5269,15 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
const_component_lists_iterator component_lists_begin() const {
return const_component_lists_iterator(
getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(),
getComponentsRef());
getComponentsRef(), SupportsMapper,
SupportsMapper ? getUDMapperRefs() : llvm::None);
}
const_component_lists_iterator component_lists_end() const {
return const_component_lists_iterator(
ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(),
MappableExprComponentListRef(getComponentsRef().end(),
getComponentsRef().end()));
getComponentsRef().end()),
SupportsMapper, llvm::None);
}
const_component_lists_range component_lists() const {
return {component_lists_begin(), component_lists_end()};
Expand All @@ -5251,7 +5289,8 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
decl_component_lists_begin(const ValueDecl *VD) const {
return const_component_lists_iterator(
VD, getUniqueDeclsRef(), getDeclNumListsRef(),
getComponentListSizesRef(), getComponentsRef());
getComponentListSizesRef(), getComponentsRef(), SupportsMapper,
SupportsMapper ? getUDMapperRefs() : llvm::None);
}
const_component_lists_iterator decl_component_lists_end() const {
return component_lists_end();
Expand Down Expand Up @@ -5399,7 +5438,8 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
SourceLocation MapLoc, const OMPVarListLocTy &Locs,
const OMPMappableExprListSizeTy &Sizes)
: OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes,
&MapperQualifierLoc, &MapperIdInfo),
/*SupportsMapper=*/true, &MapperQualifierLoc,
&MapperIdInfo),
MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {
assert(llvm::array_lengthof(MapTypeModifiers) == MapModifiers.size() &&
"Unexpected number of map type modifiers.");
Expand All @@ -5419,8 +5459,8 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
/// 3) NumComponentLists: number of component lists in this clause; and 4)
/// NumComponents: total number of expression components in the clause.
explicit OMPMapClause(const OMPMappableExprListSizeTy &Sizes)
: OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(),
Sizes) {}
: OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), Sizes,
/*SupportsMapper=*/true) {}

/// Set map-type-modifier for the clause.
///
Expand Down Expand Up @@ -6307,7 +6347,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
const OMPVarListLocTy &Locs,
const OMPMappableExprListSizeTy &Sizes)
: OMPMappableExprListClause(llvm::omp::OMPC_to, Locs, Sizes,
&MapperQualifierLoc, &MapperIdInfo) {}
/*SupportsMapper=*/true, &MapperQualifierLoc,
&MapperIdInfo) {}

/// Build an empty clause.
///
Expand All @@ -6317,8 +6358,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
/// 3) NumComponentLists: number of component lists in this clause; and 4)
/// NumComponents: total number of expression components in the clause.
explicit OMPToClause(const OMPMappableExprListSizeTy &Sizes)
: OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(),
Sizes) {}
: OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes,
/*SupportsMapper=*/true) {}

/// Define the sizes of each trailing object array except the last one. This
/// is required for TrailingObjects to work properly.
Expand Down Expand Up @@ -6426,7 +6467,8 @@ class OMPFromClause final
const OMPVarListLocTy &Locs,
const OMPMappableExprListSizeTy &Sizes)
: OMPMappableExprListClause(llvm::omp::OMPC_from, Locs, Sizes,
&MapperQualifierLoc, &MapperIdInfo) {}
/*SupportsMapper=*/true, &MapperQualifierLoc,
&MapperIdInfo) {}

/// Build an empty clause.
///
Expand All @@ -6437,7 +6479,7 @@ class OMPFromClause final
/// NumComponents: total number of expression components in the clause.
explicit OMPFromClause(const OMPMappableExprListSizeTy &Sizes)
: OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
Sizes) {}
Sizes, /*SupportsMapper=*/true) {}

/// Define the sizes of each trailing object array except the last one. This
/// is required for TrailingObjects to work properly.
Expand Down
12 changes: 6 additions & 6 deletions clang/include/clang/Basic/BuiltinsPPC.def
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,12 @@ BUILTIN(__builtin_altivec_vsldbi, "V16UcV16UcV16UcIi", "")
BUILTIN(__builtin_altivec_vsrdbi, "V16UcV16UcV16UcIi", "")

// P10 Vector Insert built-ins.
BUILTIN(__builtin_altivec_vinsblx, "V16UcV16UcULLiULLi", "")
BUILTIN(__builtin_altivec_vinsbrx, "V16UcV16UcULLiULLi", "")
BUILTIN(__builtin_altivec_vinshlx, "V8UsV8UsULLiULLi", "")
BUILTIN(__builtin_altivec_vinshrx, "V8UsV8UsULLiULLi", "")
BUILTIN(__builtin_altivec_vinswlx, "V4UiV4UiULLiULLi", "")
BUILTIN(__builtin_altivec_vinswrx, "V4UiV4UiULLiULLi", "")
BUILTIN(__builtin_altivec_vinsblx, "V16UcV16UcUiUi", "")
BUILTIN(__builtin_altivec_vinsbrx, "V16UcV16UcUiUi", "")
BUILTIN(__builtin_altivec_vinshlx, "V8UsV8UsUiUi", "")
BUILTIN(__builtin_altivec_vinshrx, "V8UsV8UsUiUi", "")
BUILTIN(__builtin_altivec_vinswlx, "V4UiV4UiUiUi", "")
BUILTIN(__builtin_altivec_vinswrx, "V4UiV4UiUiUi", "")
BUILTIN(__builtin_altivec_vinsdlx, "V2ULLiV2ULLiULLiULLi", "")
BUILTIN(__builtin_altivec_vinsdrx, "V2ULLiV2ULLiULLiULLi", "")
BUILTIN(__builtin_altivec_vinsbvlx, "V16UcV16UcULLiV16Uc", "")
Expand Down
Loading

0 comments on commit 1fa313e

Please sign in to comment.