Skip to content

Commit 155abd0

Browse files
committed
[PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC
This patch is to isolate the lax vector conversions warning only for PPC, the reason is that SystemZ wants different logic in terms of vector bool compatibility. Reviewed By: lei Differential Revision: https://reviews.llvm.org/D145506
1 parent 382eb7c commit 155abd0

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9856,7 +9856,8 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS,
98569856
// The default for lax vector conversions with Altivec vectors will
98579857
// change, so if we are converting between vector types where
98589858
// at least one is an Altivec vector, emit a warning.
9859-
if (anyAltivecTypes(RHSType, LHSType) &&
9859+
if (Context.getTargetInfo().getTriple().isPPC() &&
9860+
anyAltivecTypes(RHSType, LHSType) &&
98609861
!Context.areCompatibleVectorTypes(RHSType, LHSType))
98619862
Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)
98629863
<< RHSType << LHSType;
@@ -9873,9 +9874,10 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS,
98739874
const VectorType *VecType = RHSType->getAs<VectorType>();
98749875
if (VecType && VecType->getNumElements() == 1 &&
98759876
isLaxVectorConversion(RHSType, LHSType)) {
9876-
if (VecType->getVectorKind() == VectorType::AltiVecVector ||
9877-
VecType->getVectorKind() == VectorType::AltiVecBool ||
9878-
VecType->getVectorKind() == VectorType::AltiVecPixel)
9877+
if (Context.getTargetInfo().getTriple().isPPC() &&
9878+
(VecType->getVectorKind() == VectorType::AltiVecVector ||
9879+
VecType->getVectorKind() == VectorType::AltiVecBool ||
9880+
VecType->getVectorKind() == VectorType::AltiVecPixel))
98799881
Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)
98809882
<< RHSType << LHSType;
98819883
ExprResult *VecExpr = &RHS;
@@ -10836,7 +10838,8 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
1083610838
QualType OtherType = LHSVecType ? RHSType : LHSType;
1083710839
ExprResult *OtherExpr = LHSVecType ? &RHS : &LHS;
1083810840
if (isLaxVectorConversion(OtherType, VecType)) {
10839-
if (anyAltivecTypes(RHSType, LHSType) &&
10841+
if (Context.getTargetInfo().getTriple().isPPC() &&
10842+
anyAltivecTypes(RHSType, LHSType) &&
1084010843
!Context.areCompatibleVectorTypes(RHSType, LHSType))
1084110844
Diag(Loc, diag::warn_deprecated_lax_vec_conv_all) << RHSType << LHSType;
1084210845
// If we're allowing lax vector conversions, only the total (data) size

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,8 @@ static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
17751775
if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
17761776
(S.isLaxVectorConversion(FromType, ToType) &&
17771777
!ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
1778-
if (S.isLaxVectorConversion(FromType, ToType) &&
1778+
if (S.getASTContext().getTargetInfo().getTriple().isPPC() &&
1779+
S.isLaxVectorConversion(FromType, ToType) &&
17791780
S.anyAltivecTypes(FromType, ToType) &&
17801781
!S.Context.areCompatibleVectorTypes(FromType, ToType) &&
17811782
!InOverloadResolution && !CStyle) {

clang/test/CodeGen/SystemZ/zvector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector \
2-
// RUN: -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all \
2+
// RUN: -emit-llvm -o - -W -Wall -Werror \
33
// RUN: %s | opt -S -passes=mem2reg | FileCheck %s
44

55
volatile vector signed char sc, sc2;

clang/test/CodeGen/SystemZ/zvector2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
2-
// RUN: -O -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
2+
// RUN: -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
33

44
volatile vector float ff, ff2;
55
volatile vector bool int bi;

0 commit comments

Comments
 (0)