[PATCH] D143467: [PowerPC] Add target feature requirement to builtins

2023-03-31 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added a comment.

It looks good to me, just added a minor question as I was not able to verify 
that.




Comment at: clang/include/clang/Basic/BuiltinsPPC.def:444
+TARGET_BUILTIN(__builtin_altivec_vcmpnew_p, "iiV4iV4i", "", "power9-vector")
+TARGET_BUILTIN(__builtin_altivec_vcmpned_p, "iiV2LLiV2LLi", "", "altivec")
+

amyk wrote:
> Does this need to be `vsx`?
How do we find the appropriate FEATURE for the above 4 builtins?  (first 3 are 
p9 and the 4th one is altivec)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143467/new/

https://reviews.llvm.org/D143467

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D145506: [PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC

2023-03-21 Thread Maryam Moghadas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG155abd0678ab: [PowerPC] Emit 
warn_deprecated_lax_vec_conv_all warning only for PPC (authored by maryammo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145506/new/

https://reviews.llvm.org/D145506

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CodeGen/SystemZ/zvector.c
  clang/test/CodeGen/SystemZ/zvector2.c


Index: clang/test/CodeGen/SystemZ/zvector2.c
===
--- clang/test/CodeGen/SystemZ/zvector2.c
+++ clang/test/CodeGen/SystemZ/zvector2.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
-// RUN:  -O -emit-llvm -o - -W -Wall -Werror 
-Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
+// RUN:  -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
 
 volatile vector float ff, ff2;
 volatile vector bool int bi;
Index: clang/test/CodeGen/SystemZ/zvector.c
===
--- clang/test/CodeGen/SystemZ/zvector.c
+++ clang/test/CodeGen/SystemZ/zvector.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector \
-// RUN: -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all 
\
+// RUN: -emit-llvm -o - -W -Wall -Werror \
 // RUN: %s | opt -S -passes=mem2reg | FileCheck %s
 
 volatile vector signed char sc, sc2;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1775,7 +1775,8 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
-  if (S.isLaxVectorConversion(FromType, ToType) &&
+  if (S.getASTContext().getTargetInfo().getTriple().isPPC() &&
+  S.isLaxVectorConversion(FromType, ToType) &&
   S.anyAltivecTypes(FromType, ToType) &&
   !S.Context.areCompatibleVectorTypes(FromType, ToType) &&
   !InOverloadResolution && !CStyle) {
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -9856,7 +9856,8 @@
 // The default for lax vector conversions with Altivec vectors will
 // change, so if we are converting between vector types where
 // at least one is an Altivec vector, emit a warning.
-if (anyAltivecTypes(RHSType, LHSType) &&
+if (Context.getTargetInfo().getTriple().isPPC() &&
+anyAltivecTypes(RHSType, LHSType) &&
 !Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)
   << RHSType << LHSType;
@@ -9873,9 +9874,10 @@
   const VectorType *VecType = RHSType->getAs();
   if (VecType && VecType->getNumElements() == 1 &&
   isLaxVectorConversion(RHSType, LHSType)) {
-if (VecType->getVectorKind() == VectorType::AltiVecVector ||
-VecType->getVectorKind() == VectorType::AltiVecBool ||
-VecType->getVectorKind() == VectorType::AltiVecPixel)
+if (Context.getTargetInfo().getTriple().isPPC() &&
+(VecType->getVectorKind() == VectorType::AltiVecVector ||
+ VecType->getVectorKind() == VectorType::AltiVecBool ||
+ VecType->getVectorKind() == VectorType::AltiVecPixel))
   Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)
   << RHSType << LHSType;
 ExprResult *VecExpr = &RHS;
@@ -10836,7 +10838,8 @@
   QualType OtherType = LHSVecType ? RHSType : LHSType;
   ExprResult *OtherExpr = LHSVecType ? &RHS : &LHS;
   if (isLaxVectorConversion(OtherType, VecType)) {
-if (anyAltivecTypes(RHSType, LHSType) &&
+if (Context.getTargetInfo().getTriple().isPPC() &&
+anyAltivecTypes(RHSType, LHSType) &&
 !Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(Loc, diag::warn_deprecated_lax_vec_conv_all) << RHSType << LHSType;
 // If we're allowing lax vector conversions, only the total (data) size


Index: clang/test/CodeGen/SystemZ/zvector2.c
===
--- clang/test/CodeGen/SystemZ/zvector2.c
+++ clang/test/CodeGen/SystemZ/zvector2.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
-// RUN:  -O -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
+// RUN:  -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
 
 volatile vector float ff, ff2;
 volatile vector bool int bi;
Index: clang/test/CodeGen/SystemZ/zvector.c
===
--- clang/test/Co

[PATCH] D144611: [PowerPC] Adding test coverage for vector compatibility warning

2023-03-20 Thread Maryam Moghadas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60b117aa8149: [PowerPC] Adding test coverage for vector 
compatibility warning (authored by maryammo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144611/new/

https://reviews.llvm.org/D144611

Files:
  clang/test/Parser/lax-conv.cpp


Index: clang/test/Parser/lax-conv.cpp
===
--- clang/test/Parser/lax-conv.cpp
+++ clang/test/Parser/lax-conv.cpp
@@ -2,6 +2,20 @@
 // RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature 
+altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only 
-verify=expected,novsx %s
 // RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec 
-target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,aix %s
 
+vector bool short vbs;
+vector signed short vss;
+vector unsigned short vus;
+vector bool int vbi;
+vector signed int vsi;
+vector unsigned int vui;
+vector bool long long vbl;
+vector signed long long vsl;
+vector unsigned long long vul;
+vector bool char vbc;
+vector signed char vsc;
+vector unsigned char vuc;
+vector pixel vp;
+
 void dummy(vector unsigned int a);
 template  VEC __attribute__((noinline)) test(vector unsigned 
char a, vector unsigned char b) {
 return (VEC)(a * b);
@@ -65,3 +79,34 @@
   return dummy((vector unsigned int)(ArgExplicitConvAddSame1Full +
  ArgExplicitConvAddSame2Full));
 }
+void test_bool_compat(void) {
+  vbs = vss; // expected-warning {{Implicit conversion between vector types 
(''__vector short' (vector of 8 'short' values)' and ''__vector __bool unsigned 
short' (vector of 8 'unsigned short' values)') is deprecated. In the future, 
the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+  vbs = vus; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned short' (vector of 8 'unsigned short' values)' and 
''__vector __bool unsigned short' (vector of 8 'unsigned short' values)') is 
deprecated. In the future, the behavior implied by 
'-fno-lax-vector-conversions' will be the default.}}
+
+  vbi = vsi; // expected-warning {{Implicit conversion between vector types 
(''__vector int' (vector of 4 'int' values)' and ''__vector __bool unsigned 
int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the 
behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+  vbi = vui; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned int' (vector of 4 'unsigned int' values)' and ''__vector 
__bool unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In 
the future, the behavior implied by '-fno-lax-vector-conversions' will be the 
default.}}
+
+  vbl = vsl; // expected-warning {{Implicit conversion between vector types 
(''__vector long long' (vector of 2 'long long' values)' and ''__vector __bool 
unsigned long long' (vector of 2 'unsigned long long' values)') is deprecated. 
In the future, the behavior implied by '-fno-lax-vector-conversions' will be 
the default.}}
+  vbl = vul; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned long long' (vector of 2 'unsigned long long' values)' and 
''__vector __bool unsigned long long' (vector of 2 'unsigned long long' 
values)') is deprecated. In the future, the behavior implied by 
'-fno-lax-vector-conversions' will be the default.}}
+
+  vbc = vsc; // expected-warning {{Implicit conversion between vector types 
(''__vector signed char' (vector of 16 'signed char' values)' and ''__vector 
__bool unsigned char' (vector of 16 'unsigned char' values)') is deprecated. In 
the future, the behavior implied by '-fno-lax-vector-conversions' will be the 
default.}}
+  vbc = vuc; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned char' (vector of 16 'unsigned char' values)' and 
''__vector __bool unsigned char' (vector of 16 'unsigned char' values)') is 
deprecated. In the future, the behavior implied by 
'-fno-lax-vector-conversions' will be the default.}}
+}
+
+void test_pixel_compat(void) {
+  vp = vbs; // expected-warning {{Implicit conversion between vector types 
(''__vector __bool unsigned short' (vector of 8 'unsigned short' values)' and 
''__vector __pixel ' (vector of 8 'unsigned short' values)') is deprecated. In 
the future, the behavior implied by '-fno-lax-vector-conversions' will be the 
default.}}
+  vp = vss; // expected-warning {{Implicit conversion between vector types 
(''__vector short' (vector of 8 'short' values)' and ''__vector __pixel ' 
(vector of 8 'unsigned short' values)') is deprecated. In the future, the 
behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+  vp = vus; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned short' (vector of 8 'unsigned short' values)' a

[PATCH] D145506: [PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC

2023-03-07 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145506

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CodeGen/SystemZ/zvector.c
  clang/test/CodeGen/SystemZ/zvector2.c


Index: clang/test/CodeGen/SystemZ/zvector2.c
===
--- clang/test/CodeGen/SystemZ/zvector2.c
+++ clang/test/CodeGen/SystemZ/zvector2.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
-// RUN:  -O -emit-llvm -o - -W -Wall -Werror 
-Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
+// RUN:  -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
 
 volatile vector float ff, ff2;
 volatile vector bool int bi;
Index: clang/test/CodeGen/SystemZ/zvector.c
===
--- clang/test/CodeGen/SystemZ/zvector.c
+++ clang/test/CodeGen/SystemZ/zvector.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector \
-// RUN: -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all 
\
+// RUN: -emit-llvm -o - -W -Wall -Werror \
 // RUN: %s | opt -S -passes=mem2reg | FileCheck %s
 
 volatile vector signed char sc, sc2;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1775,7 +1775,8 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
-  if (S.isLaxVectorConversion(FromType, ToType) &&
+  if (S.getASTContext().getTargetInfo().getTriple().isPPC() &&
+  S.isLaxVectorConversion(FromType, ToType) &&
   S.anyAltivecTypes(FromType, ToType) &&
   !S.Context.areCompatibleVectorTypes(FromType, ToType) &&
   !InOverloadResolution && !CStyle) {
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -9841,7 +9841,8 @@
 // The default for lax vector conversions with Altivec vectors will
 // change, so if we are converting between vector types where
 // at least one is an Altivec vector, emit a warning.
-if (anyAltivecTypes(RHSType, LHSType) &&
+if (Context.getTargetInfo().getTriple().isPPC() &&
+anyAltivecTypes(RHSType, LHSType) &&
 !Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)
   << RHSType << LHSType;
@@ -9858,9 +9859,10 @@
   const VectorType *VecType = RHSType->getAs();
   if (VecType && VecType->getNumElements() == 1 &&
   isLaxVectorConversion(RHSType, LHSType)) {
-if (VecType->getVectorKind() == VectorType::AltiVecVector ||
-VecType->getVectorKind() == VectorType::AltiVecBool ||
-VecType->getVectorKind() == VectorType::AltiVecPixel)
+if (Context.getTargetInfo().getTriple().isPPC() &&
+(VecType->getVectorKind() == VectorType::AltiVecVector ||
+ VecType->getVectorKind() == VectorType::AltiVecBool ||
+ VecType->getVectorKind() == VectorType::AltiVecPixel))
   Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)
   << RHSType << LHSType;
 ExprResult *VecExpr = &RHS;
@@ -10821,7 +10823,8 @@
   QualType OtherType = LHSVecType ? RHSType : LHSType;
   ExprResult *OtherExpr = LHSVecType ? &RHS : &LHS;
   if (isLaxVectorConversion(OtherType, VecType)) {
-if (anyAltivecTypes(RHSType, LHSType) &&
+if (Context.getTargetInfo().getTriple().isPPC() &&
+anyAltivecTypes(RHSType, LHSType) &&
 !Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(Loc, diag::warn_deprecated_lax_vec_conv_all) << RHSType << LHSType;
 // If we're allowing lax vector conversions, only the total (data) size


Index: clang/test/CodeGen/SystemZ/zvector2.c
===
--- clang/test/CodeGen/SystemZ/zvector2.c
+++ clang/test/CodeGen/SystemZ/zvector2.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
-// RUN:  -O -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
+// RUN:  -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
 
 volatile vector float ff, ff2;
 volatile vector bool int bi;
Index: clang

[PATCH] D144611: [PowerPC] Adding test coverage for vector compatibility warning

2023-02-22 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is to test D143210  patch to have the 
same vector
compatibility logic for error and warning diagnostics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144611

Files:
  clang/test/Parser/lax-conv.cpp


Index: clang/test/Parser/lax-conv.cpp
===
--- clang/test/Parser/lax-conv.cpp
+++ clang/test/Parser/lax-conv.cpp
@@ -2,6 +2,20 @@
 // RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature 
+altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only 
-verify=expected,novsx %s
 // RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec 
-target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,aix %s
 
+vector bool short vbs;
+vector signed short vss;
+vector unsigned short vus;
+vector bool int vbi;
+vector signed int vsi;
+vector unsigned int vui;
+vector bool long long vbl;
+vector signed long long vsl;
+vector unsigned long long vul;
+vector bool char vbc;
+vector signed char vsc;
+vector unsigned char vuc;
+vector pixel vp;
+
 void dummy(vector unsigned int a);
 template  VEC __attribute__((noinline)) test(vector unsigned 
char a, vector unsigned char b) {
 return (VEC)(a * b);
@@ -65,3 +79,34 @@
   return dummy((vector unsigned int)(ArgExplicitConvAddSame1Full +
  ArgExplicitConvAddSame2Full));
 }
+void test_bool_compat(void) {
+  vbs = vss; // expected-warning {{Implicit conversion between vector types 
(''__vector short' (vector of 8 'short' values)' and ''__vector __bool unsigned 
short' (vector of 8 'unsigned short' values)') is deprecated. In the future, 
the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+  vbs = vus; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned short' (vector of 8 'unsigned short' values)' and 
''__vector __bool unsigned short' (vector of 8 'unsigned short' values)') is 
deprecated. In the future, the behavior implied by 
'-fno-lax-vector-conversions' will be the default.}}
+
+  vbi = vsi; // expected-warning {{Implicit conversion between vector types 
(''__vector int' (vector of 4 'int' values)' and ''__vector __bool unsigned 
int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the 
behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+  vbi = vui; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned int' (vector of 4 'unsigned int' values)' and ''__vector 
__bool unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In 
the future, the behavior implied by '-fno-lax-vector-conversions' will be the 
default.}}
+
+  vbl = vsl; // expected-warning {{Implicit conversion between vector types 
(''__vector long long' (vector of 2 'long long' values)' and ''__vector __bool 
unsigned long long' (vector of 2 'unsigned long long' values)') is deprecated. 
In the future, the behavior implied by '-fno-lax-vector-conversions' will be 
the default.}}
+  vbl = vul; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned long long' (vector of 2 'unsigned long long' values)' and 
''__vector __bool unsigned long long' (vector of 2 'unsigned long long' 
values)') is deprecated. In the future, the behavior implied by 
'-fno-lax-vector-conversions' will be the default.}}
+
+  vbc = vsc; // expected-warning {{Implicit conversion between vector types 
(''__vector signed char' (vector of 16 'signed char' values)' and ''__vector 
__bool unsigned char' (vector of 16 'unsigned char' values)') is deprecated. In 
the future, the behavior implied by '-fno-lax-vector-conversions' will be the 
default.}}
+  vbc = vuc; // expected-warning {{Implicit conversion between vector types 
(''__vector unsigned char' (vector of 16 'unsigned char' values)' and 
''__vector __bool unsigned char' (vector of 16 'unsigned char' values)') is 
deprecated. In the future, the behavior implied by 
'-fno-lax-vector-conversions' will be the default.}}
+}
+
+void test_pixel_compat(void) {
+  vp = vbs; // expected-warning {{Implicit conversion between vector types 
(''__vector __bool unsigned short' (vector of 8 'unsigned short' values)' and 
''__vector __pixel ' (vector of 8 'unsigned short' values)') is deprecated. In 
the future, the behavior implied by '-fno-lax-vector-conversions' will be the 
default.}}
+  vp = vss; // expected-warning {{Implicit conversion between vector types 
(''__vector short' (vector of 8 'short' values)' and ''__vector __pixel ' 
(vector of 8 'unsigned short' values)') is deprecated. In the future, the 
behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+  vp = vus; // expected-warning {{Impli

[PATCH] D143210: [PowerPC] Include vector bool and pixel when emitting lax warning

2023-02-21 Thread Maryam Moghadas via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG02a71b05fc67: [PowerPC] Include vector bool and pixel when 
emitting lax warning (authored by maryammo).

Changed prior to commit:
  https://reviews.llvm.org/D143210?vs=494413&id=499296#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143210/new/

https://reviews.llvm.org/D143210

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CodeGen/SystemZ/zvector.c
  clang/test/CodeGen/SystemZ/zvector2.c

Index: clang/test/CodeGen/SystemZ/zvector2.c
===
--- clang/test/CodeGen/SystemZ/zvector2.c
+++ clang/test/CodeGen/SystemZ/zvector2.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
-// RUN:  -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
+// RUN:  -O -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
 
 volatile vector float ff, ff2;
 volatile vector bool int bi;
Index: clang/test/CodeGen/SystemZ/zvector.c
===
--- clang/test/CodeGen/SystemZ/zvector.c
+++ clang/test/CodeGen/SystemZ/zvector.c
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector -emit-llvm -o - -W -Wall -Werror %s | opt -S -passes=mem2reg | FileCheck %s
+// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector \
+// RUN: -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all \
+// RUN: %s | opt -S -passes=mem2reg | FileCheck %s
 
 volatile vector signed char sc, sc2;
 volatile vector unsigned char uc, uc2;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1770,7 +1770,7 @@
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
   if (S.isLaxVectorConversion(FromType, ToType) &&
   S.anyAltivecTypes(FromType, ToType) &&
-  !S.areSameVectorElemTypes(FromType, ToType) &&
+  !S.Context.areCompatibleVectorTypes(FromType, ToType) &&
   !InOverloadResolution && !CStyle) {
 S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
 << FromType << ToType;
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7987,30 +7987,24 @@
  "expected at least one type to be a vector here");
 
   bool IsSrcTyAltivec =
-  SrcTy->isVectorType() && (SrcTy->castAs()->getVectorKind() ==
-VectorType::AltiVecVector);
+  SrcTy->isVectorType() && ((SrcTy->castAs()->getVectorKind() ==
+ VectorType::AltiVecVector) ||
+(SrcTy->castAs()->getVectorKind() ==
+ VectorType::AltiVecBool) ||
+(SrcTy->castAs()->getVectorKind() ==
+ VectorType::AltiVecPixel));
+
   bool IsDestTyAltivec = DestTy->isVectorType() &&
- (DestTy->castAs()->getVectorKind() ==
-  VectorType::AltiVecVector);
+ ((DestTy->castAs()->getVectorKind() ==
+   VectorType::AltiVecVector) ||
+  (DestTy->castAs()->getVectorKind() ==
+   VectorType::AltiVecBool) ||
+  (DestTy->castAs()->getVectorKind() ==
+   VectorType::AltiVecPixel));
 
   return (IsSrcTyAltivec || IsDestTyAltivec);
 }
 
-// This returns true if both vectors have the same element type.
-bool Sema::areSameVectorElemTypes(QualType SrcTy, QualType DestTy) {
-  assert((DestTy->isVectorType() || SrcTy->isVectorType()) &&
- "expected at least one type to be a vector here");
-
-  uint64_t SrcLen, DestLen;
-  QualType SrcEltTy, DestEltTy;
-  if (!breakDownVectorType(SrcTy, SrcLen, SrcEltTy))
-return false;
-  if (!breakDownVectorType(DestTy, DestLen, DestEltTy))
-return false;
-
-  return (SrcEltTy == DestEltTy);
-}
-
 /// Are the two types lax-compatible vector types?  That is, given
 /// that one of them is a vector, do they have equal storage sizes,
 /// where the storage size is the number of elements times the element
@@ -9848,7 +9842,7 @@
 // change, so if we are converting between vector types where
 // at least one is an Altivec vector, emit a warning.
 if (anyAltivecTypes(RHSType, LHSType) &&
-!areSameVectorElemTypes(RHSType, LHSType))
+!Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(RHS.get()->getExprLoc(), di

[PATCH] D144293: [PowerPC] Fix the implicit casting for the emulated intrinsics

2023-02-21 Thread Maryam Moghadas via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGee815ff2ce8d: [PowerPC] Fix the implicit casting for the 
emulated intrinsics (authored by maryammo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144293/new/

https://reviews.llvm.org/D144293

Files:
  clang/lib/Headers/ppc_wrappers/emmintrin.h
  clang/lib/Headers/ppc_wrappers/smmintrin.h
  clang/test/CodeGen/PowerPC/ppc-smmintrin.c


Index: clang/test/CodeGen/PowerPC/ppc-smmintrin.c
===
--- clang/test/CodeGen/PowerPC/ppc-smmintrin.c
+++ clang/test/CodeGen/PowerPC/ppc-smmintrin.c
@@ -73,7 +73,7 @@
 
 // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x 
i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 
noundef signext %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8
-// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext 
%[[TRUNC]])
+// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext 
%[[TRUNC]])
 // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char 
vector[16])
 // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16
@@ -232,8 +232,8 @@
 test_round() {
   _mm_round_ps(mn1, 0);
   _mm_round_ss(mn1, mn2, 0);
-  _mm_round_pd(mn1, 0);
-  _mm_round_sd(mn1, mn2, 0);
+  _mm_round_pd(md1, 0);
+  _mm_round_sd(md1, md2, 0);
 }
 
 // CHECK-LABEL: @test_round
Index: clang/lib/Headers/ppc_wrappers/smmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/smmintrin.h
+++ clang/lib/Headers/ppc_wrappers/smmintrin.h
@@ -305,9 +305,9 @@
 extern __inline __m128i
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) {
-  __v16qi __charmask = vec_splats((signed char)__imm8);
+  __v16qu __charmask = vec_splats((unsigned char)__imm8);
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask);
 #ifdef __BIG_ENDIAN__
   __shortmask = vec_reve(__shortmask);
 #endif
Index: clang/lib/Headers/ppc_wrappers/emmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/emmintrin.h
+++ clang/lib/Headers/ppc_wrappers/emmintrin.h
@@ -46,6 +46,7 @@
 
 /* SSE2 */
 typedef __vector double __v2df;
+typedef __vector float __v4f;
 typedef __vector long long __v2di;
 typedef __vector unsigned long long __v2du;
 typedef __vector int __v4si;
@@ -951,7 +952,7 @@
 _mm_cvtpi32_pd(__m64 __A) {
   __v4si __temp;
   __v2di __tmp2;
-  __v2df __result;
+  __v4f __result;
 
   __temp = (__v4si)vec_splats(__A);
   __tmp2 = (__v2di)vec_unpackl(__temp);


Index: clang/test/CodeGen/PowerPC/ppc-smmintrin.c
===
--- clang/test/CodeGen/PowerPC/ppc-smmintrin.c
+++ clang/test/CodeGen/PowerPC/ppc-smmintrin.c
@@ -73,7 +73,7 @@
 
 // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 noundef signext %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8
-// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext %[[TRUNC]])
+// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])
 // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char vector[16])
 // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16
@@ -232,8 +232,8 @@
 test_round() {
   _mm_round_ps(mn1, 0);
   _mm_round_ss(mn1, mn2, 0);
-  _mm_round_pd(mn1, 0);
-  _mm_round_sd(mn1, mn2, 0);
+  _mm_round_pd(md1, 0);
+  _mm_round_sd(md1, md2, 0);
 }
 
 // CHECK-LABEL: @test_round
Index: clang/lib/Headers/ppc_wrappers/smmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/smmintrin.h
+++ clang/lib/Headers/ppc_wrappers/smmintrin.h
@@ -305,9 +305,9 @@
 extern __inline __m128i
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) {
-  __v16qi __charmask = vec_splats((signed char)__imm8);
+  __v16qu __charmask = vec_splats((unsigned char)__imm8);
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask);
 #ifdef __BIG_ENDIAN__
   __shortmask = vec_reve(__shortmask);
 #endif
Index: clang/lib/Headers/ppc_wrappers/emmintrin.h
===

[PATCH] D144293: [PowerPC] Fix the implicit casting for the emulated intrinsics

2023-02-21 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 499273.
maryammo added a comment.

Address review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144293/new/

https://reviews.llvm.org/D144293

Files:
  clang/lib/Headers/ppc_wrappers/emmintrin.h
  clang/lib/Headers/ppc_wrappers/smmintrin.h
  clang/test/CodeGen/PowerPC/ppc-smmintrin.c


Index: clang/test/CodeGen/PowerPC/ppc-smmintrin.c
===
--- clang/test/CodeGen/PowerPC/ppc-smmintrin.c
+++ clang/test/CodeGen/PowerPC/ppc-smmintrin.c
@@ -73,7 +73,7 @@
 
 // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x 
i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 
noundef signext %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8
-// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext 
%[[TRUNC]])
+// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext 
%[[TRUNC]])
 // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char 
vector[16])
 // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16
@@ -232,8 +232,8 @@
 test_round() {
   _mm_round_ps(mn1, 0);
   _mm_round_ss(mn1, mn2, 0);
-  _mm_round_pd(mn1, 0);
-  _mm_round_sd(mn1, mn2, 0);
+  _mm_round_pd(md1, 0);
+  _mm_round_sd(md1, md2, 0);
 }
 
 // CHECK-LABEL: @test_round
Index: clang/lib/Headers/ppc_wrappers/smmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/smmintrin.h
+++ clang/lib/Headers/ppc_wrappers/smmintrin.h
@@ -305,9 +305,9 @@
 extern __inline __m128i
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) {
-  __v16qi __charmask = vec_splats((signed char)__imm8);
+  __v16qu __charmask = vec_splats((unsigned char)__imm8);
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask);
 #ifdef __BIG_ENDIAN__
   __shortmask = vec_reve(__shortmask);
 #endif
Index: clang/lib/Headers/ppc_wrappers/emmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/emmintrin.h
+++ clang/lib/Headers/ppc_wrappers/emmintrin.h
@@ -46,6 +46,7 @@
 
 /* SSE2 */
 typedef __vector double __v2df;
+typedef __vector float __v4f;
 typedef __vector long long __v2di;
 typedef __vector unsigned long long __v2du;
 typedef __vector int __v4si;
@@ -951,7 +952,7 @@
 _mm_cvtpi32_pd(__m64 __A) {
   __v4si __temp;
   __v2di __tmp2;
-  __v2df __result;
+  __v4f __result;
 
   __temp = (__v4si)vec_splats(__A);
   __tmp2 = (__v2di)vec_unpackl(__temp);


Index: clang/test/CodeGen/PowerPC/ppc-smmintrin.c
===
--- clang/test/CodeGen/PowerPC/ppc-smmintrin.c
+++ clang/test/CodeGen/PowerPC/ppc-smmintrin.c
@@ -73,7 +73,7 @@
 
 // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 noundef signext %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8
-// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext %[[TRUNC]])
+// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])
 // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char vector[16])
 // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16
@@ -232,8 +232,8 @@
 test_round() {
   _mm_round_ps(mn1, 0);
   _mm_round_ss(mn1, mn2, 0);
-  _mm_round_pd(mn1, 0);
-  _mm_round_sd(mn1, mn2, 0);
+  _mm_round_pd(md1, 0);
+  _mm_round_sd(md1, md2, 0);
 }
 
 // CHECK-LABEL: @test_round
Index: clang/lib/Headers/ppc_wrappers/smmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/smmintrin.h
+++ clang/lib/Headers/ppc_wrappers/smmintrin.h
@@ -305,9 +305,9 @@
 extern __inline __m128i
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) {
-  __v16qi __charmask = vec_splats((signed char)__imm8);
+  __v16qu __charmask = vec_splats((unsigned char)__imm8);
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask);
 #ifdef __BIG_ENDIAN__
   __shortmask = vec_reve(__shortmask);
 #endif
Index: clang/lib/Headers/ppc_wrappers/emmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/emmintrin.h
+++ clang/lib/Headers/ppc_wrappers/emmintrin.h
@

[PATCH] D144293: [PowerPC] Fix the implicit casting for the emulated intrinsics

2023-02-21 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added inline comments.



Comment at: clang/lib/Headers/ppc_wrappers/smmintrin.h:310
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask);
 #ifdef __BIG_ENDIAN__

amyk wrote:
> Potentially silly question, but is it intentionally for that mask for be 
> signed?
In altivec header, `vec_unpackh` 's parameter is either `signed char` or `bool 
char`,  so we need explicit casting since `__charmask` is `unsigned char`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144293/new/

https://reviews.llvm.org/D144293

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144293: [PowerPC] Fix the implicit casting for the emulated intrinsics

2023-02-17 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, kbarton, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch is to fix some implicit castings for emulated intrinsics
so that there are no lax-vector-conversions errors and warnings.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144293

Files:
  clang/lib/Headers/ppc_wrappers/emmintrin.h
  clang/lib/Headers/ppc_wrappers/smmintrin.h
  clang/test/CodeGen/PowerPC/ppc-smmintrin.c


Index: clang/test/CodeGen/PowerPC/ppc-smmintrin.c
===
--- clang/test/CodeGen/PowerPC/ppc-smmintrin.c
+++ clang/test/CodeGen/PowerPC/ppc-smmintrin.c
@@ -73,7 +73,7 @@
 
 // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x 
i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 
noundef signext %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8
-// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext 
%[[TRUNC]])
+// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext 
%[[TRUNC]])
 // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char 
vector[16])
 // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16
@@ -232,8 +232,8 @@
 test_round() {
   _mm_round_ps(mn1, 0);
   _mm_round_ss(mn1, mn2, 0);
-  _mm_round_pd(mn1, 0);
-  _mm_round_sd(mn1, mn2, 0);
+  _mm_round_pd(md1, 0);
+  _mm_round_sd(md1, md2, 0);
 }
 
 // CHECK-LABEL: @test_round
Index: clang/lib/Headers/ppc_wrappers/smmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/smmintrin.h
+++ clang/lib/Headers/ppc_wrappers/smmintrin.h
@@ -305,9 +305,9 @@
 extern __inline __m128i
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) {
-  __v16qi __charmask = vec_splats((signed char)__imm8);
+  __v16qu __charmask = vec_splats((unsigned char)__imm8);
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask);
 #ifdef __BIG_ENDIAN__
   __shortmask = vec_reve(__shortmask);
 #endif
Index: clang/lib/Headers/ppc_wrappers/emmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/emmintrin.h
+++ clang/lib/Headers/ppc_wrappers/emmintrin.h
@@ -54,6 +54,7 @@
 typedef __vector unsigned short __v8hu;
 typedef __vector signed char __v16qi;
 typedef __vector unsigned char __v16qu;
+typedef __vector float __v2f;
 
 /* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components.  */
@@ -951,7 +952,7 @@
 _mm_cvtpi32_pd(__m64 __A) {
   __v4si __temp;
   __v2di __tmp2;
-  __v2df __result;
+  __v2f __result;
 
   __temp = (__v4si)vec_splats(__A);
   __tmp2 = (__v2di)vec_unpackl(__temp);


Index: clang/test/CodeGen/PowerPC/ppc-smmintrin.c
===
--- clang/test/CodeGen/PowerPC/ppc-smmintrin.c
+++ clang/test/CodeGen/PowerPC/ppc-smmintrin.c
@@ -73,7 +73,7 @@
 
 // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 noundef signext %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8
-// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext %[[TRUNC]])
+// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])
 // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}})
 // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char vector[16])
 // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16
@@ -232,8 +232,8 @@
 test_round() {
   _mm_round_ps(mn1, 0);
   _mm_round_ss(mn1, mn2, 0);
-  _mm_round_pd(mn1, 0);
-  _mm_round_sd(mn1, mn2, 0);
+  _mm_round_pd(md1, 0);
+  _mm_round_sd(md1, md2, 0);
 }
 
 // CHECK-LABEL: @test_round
Index: clang/lib/Headers/ppc_wrappers/smmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/smmintrin.h
+++ clang/lib/Headers/ppc_wrappers/smmintrin.h
@@ -305,9 +305,9 @@
 extern __inline __m128i
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) {
-  __v16qi __charmask = vec_splats((signed char)__imm8);
+  __v16qu __charmask = vec_splats((unsigned char)__imm8);
   __charmask = vec_gb(__charmask);
-  __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask);
+  __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__char

[PATCH] D143210: [PowerPC] Include vector bool and pixel when emitting lax warning

2023-02-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:9845
 if (anyAltivecTypes(RHSType, LHSType) &&
-!areSameVectorElemTypes(RHSType, LHSType))
+!Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all)

amyk wrote:
> Might be a silly question, but what does it mean to be a "compatible" vector 
> type?
`areCompatibleVectorTypes` is defined in lib/AST/ASTContext.cpp,  it considers 
all vectors with the same unqualified types to be compatible, also vectors with 
the same number of elements where neither of them is vector bool/pixel or some 
specific SVE types are compatible.  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143210/new/

https://reviews.llvm.org/D143210

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143210: PowerPC] Include vector bool and pixel when emitting lax warning

2023-02-02 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch is to fix some missing lax-vector-conversion warnings including
cases that involve vector bool and vector pixel, also to fix the vector
compatibility check for the warnings.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143210

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CodeGen/SystemZ/zvector.c
  clang/test/CodeGen/SystemZ/zvector2.c

Index: clang/test/CodeGen/SystemZ/zvector2.c
===
--- clang/test/CodeGen/SystemZ/zvector2.c
+++ clang/test/CodeGen/SystemZ/zvector2.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
-// RUN:  -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
+// RUN:  -O -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all %s | FileCheck %s
 
 volatile vector float ff, ff2;
 volatile vector bool int bi;
Index: clang/test/CodeGen/SystemZ/zvector.c
===
--- clang/test/CodeGen/SystemZ/zvector.c
+++ clang/test/CodeGen/SystemZ/zvector.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector -emit-llvm -o - -W -Wall -Werror %s | opt -S -passes=mem2reg | FileCheck %s
+// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -fzvector -emit-llvm -o - -W -Wall -Werror -Wno-error=deprecate-lax-vec-conv-all \
+// RUN: %s | opt -S -passes=mem2reg | FileCheck %s
 
 volatile vector signed char sc, sc2;
 volatile vector unsigned char uc, uc2;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1770,7 +1770,7 @@
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
   if (S.isLaxVectorConversion(FromType, ToType) &&
   S.anyAltivecTypes(FromType, ToType) &&
-  !S.areSameVectorElemTypes(FromType, ToType) &&
+  !S.Context.areCompatibleVectorTypes(FromType, ToType) &&
   !InOverloadResolution && !CStyle) {
 S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
 << FromType << ToType;
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7987,30 +7987,24 @@
  "expected at least one type to be a vector here");
 
   bool IsSrcTyAltivec =
-  SrcTy->isVectorType() && (SrcTy->castAs()->getVectorKind() ==
-VectorType::AltiVecVector);
+  SrcTy->isVectorType() && ((SrcTy->castAs()->getVectorKind() ==
+ VectorType::AltiVecVector) ||
+(SrcTy->castAs()->getVectorKind() ==
+ VectorType::AltiVecBool) ||
+(SrcTy->castAs()->getVectorKind() ==
+ VectorType::AltiVecPixel));
+
   bool IsDestTyAltivec = DestTy->isVectorType() &&
- (DestTy->castAs()->getVectorKind() ==
-  VectorType::AltiVecVector);
+ ((DestTy->castAs()->getVectorKind() ==
+   VectorType::AltiVecVector) ||
+  (DestTy->castAs()->getVectorKind() ==
+   VectorType::AltiVecBool) ||
+  (DestTy->castAs()->getVectorKind() ==
+   VectorType::AltiVecPixel));
 
   return (IsSrcTyAltivec || IsDestTyAltivec);
 }
 
-// This returns true if both vectors have the same element type.
-bool Sema::areSameVectorElemTypes(QualType SrcTy, QualType DestTy) {
-  assert((DestTy->isVectorType() || SrcTy->isVectorType()) &&
- "expected at least one type to be a vector here");
-
-  uint64_t SrcLen, DestLen;
-  QualType SrcEltTy, DestEltTy;
-  if (!breakDownVectorType(SrcTy, SrcLen, SrcEltTy))
-return false;
-  if (!breakDownVectorType(DestTy, DestLen, DestEltTy))
-return false;
-
-  return (SrcEltTy == DestEltTy);
-}
-
 /// Are the two types lax-compatible vector types?  That is, given
 /// that one of them is a vector, do they have equal storage sizes,
 /// where the storage size is the number of elements times the element
@@ -9848,7 +9842,7 @@
 // change, so if we are converting between vector types where
 // at least one is an Altivec vector, emit a warning.
 if (anyAltivecTypes(RHSType, LHSType) &&
-!areSameVectorElemTypes(RHSType, LHSType))
+!Context.areCompatibleVectorTypes(RHSType, LHSType))
   Diag(RHS.get()->getExprLoc(), diag::warn_deprecated_lax_vec_conv_all

[PATCH] D142222: [PowerPC] Remove the lax warning for explicit casts

2023-01-20 Thread Maryam Moghadas via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b4ed4905017: [PowerPC] Remove the lax warning for explicit 
casts (authored by maryammo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D14/new/

https://reviews.llvm.org/D14

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Parser/lax-conv.cpp

Index: clang/test/Parser/lax-conv.cpp
===
--- /dev/null
+++ clang/test/Parser/lax-conv.cpp
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,novsx %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,aix %s
+
+void dummy(vector unsigned int a);
+template  VEC __attribute__((noinline)) test(vector unsigned char a, vector unsigned char b) {
+return (VEC)(a * b);
+}
+vector unsigned int test1(vector unsigned char RetImplicitConv) {
+  return RetImplicitConv; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test2(vector unsigned char RetImplicitConvAddConst) {
+  return RetImplicitConvAddConst + 5; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test3(vector unsigned char RetExplicitConv) {
+  return (vector unsigned int)RetExplicitConv;
+}
+vector unsigned int test4(vector unsigned char RetExplicitConvAddConst) {
+  return (vector unsigned int)RetExplicitConvAddConst + 5;
+}
+vector unsigned int test5(vector unsigned char RetImplicitConvAddSame1,
+  vector unsigned char RetImplicitConvAddSame2) {
+  return RetImplicitConvAddSame1 + RetImplicitConvAddSame2; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test6(vector unsigned char RetExplicitConvAddSame1,
+  vector unsigned char RetExplicitConvAddSame2) {
+  return (vector unsigned int)RetExplicitConvAddSame1 +
+ (vector unsigned int)RetExplicitConvAddSame2;
+}
+vector unsigned int test7(vector unsigned char RetExplicitConvAddSame1Full,
+  vector unsigned char RetExplicitConvAddSame2Full) {
+  return (vector unsigned int)(RetExplicitConvAddSame1Full +
+   RetExplicitConvAddSame2Full);
+}
+vector unsigned char test8(vector unsigned char a, vector unsigned char b) {
+return test(a, b);
+}
+
+vector unsigned long long test9(vector unsigned char a, vector unsigned char b) {
+return test(a, b);
+}
+void test1a(vector unsigned char ArgImplicitConv) {
+  return dummy(ArgImplicitConv); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test2a(vector unsigned char ArgImplicitConvAddConst) {
+  return dummy(ArgImplicitConvAddConst + 5); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test3a(vector unsigned char ArgExplicitConv) {
+  return dummy((vector unsigned int)ArgExplicitConv);
+}
+void test4a(vector unsigned char ArgExplicitConvAddConst) {
+  return dummy((vector unsigned int)ArgExplicitConvAddConst + 5);
+}
+void test5a(vector unsigned char ArgImplicitConvAddSame1,
+vector unsigned char ArgImplicitConvAddSame2) {
+  return dummy(ArgImplicitConvAddSame1 + ArgImplicitConvAddSame2); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsig

[PATCH] D142222: [PowerPC] Remove the lax warning for explicit casts

2023-01-20 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 490895.
maryammo added a comment.

Adding test for template


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D14/new/

https://reviews.llvm.org/D14

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Parser/lax-conv.cpp

Index: clang/test/Parser/lax-conv.cpp
===
--- /dev/null
+++ clang/test/Parser/lax-conv.cpp
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,novsx %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,aix %s
+
+void dummy(vector unsigned int a);
+template  VEC __attribute__((noinline)) test(vector unsigned char a, vector unsigned char b) {
+return (VEC)(a * b);
+}
+vector unsigned int test1(vector unsigned char RetImplicitConv) {
+  return RetImplicitConv; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test2(vector unsigned char RetImplicitConvAddConst) {
+  return RetImplicitConvAddConst + 5; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test3(vector unsigned char RetExplicitConv) {
+  return (vector unsigned int)RetExplicitConv;
+}
+vector unsigned int test4(vector unsigned char RetExplicitConvAddConst) {
+  return (vector unsigned int)RetExplicitConvAddConst + 5;
+}
+vector unsigned int test5(vector unsigned char RetImplicitConvAddSame1,
+  vector unsigned char RetImplicitConvAddSame2) {
+  return RetImplicitConvAddSame1 + RetImplicitConvAddSame2; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test6(vector unsigned char RetExplicitConvAddSame1,
+  vector unsigned char RetExplicitConvAddSame2) {
+  return (vector unsigned int)RetExplicitConvAddSame1 +
+ (vector unsigned int)RetExplicitConvAddSame2;
+}
+vector unsigned int test7(vector unsigned char RetExplicitConvAddSame1Full,
+  vector unsigned char RetExplicitConvAddSame2Full) {
+  return (vector unsigned int)(RetExplicitConvAddSame1Full +
+   RetExplicitConvAddSame2Full);
+}
+vector unsigned char test8(vector unsigned char a, vector unsigned char b) {
+return test(a, b);
+}
+
+vector unsigned long long test9(vector unsigned char a, vector unsigned char b) {
+return test(a, b);
+}
+void test1a(vector unsigned char ArgImplicitConv) {
+  return dummy(ArgImplicitConv); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test2a(vector unsigned char ArgImplicitConvAddConst) {
+  return dummy(ArgImplicitConvAddConst + 5); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test3a(vector unsigned char ArgExplicitConv) {
+  return dummy((vector unsigned int)ArgExplicitConv);
+}
+void test4a(vector unsigned char ArgExplicitConvAddConst) {
+  return dummy((vector unsigned int)ArgExplicitConvAddConst + 5);
+}
+void test5a(vector unsigned char ArgImplicitConvAddSame1,
+vector unsigned char ArgImplicitConvAddSame2) {
+  return dummy(ArgImplicitConvAddSame1 + ArgImplicitConvAddSame2); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by 

[PATCH] D142222: [PowerPC] Remove the lax warning for explicit casts

2023-01-20 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch is to remove the erroneous lax vector conversion warning for CStyle; 
explicit; casts
that was added as part of D126540 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D14

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Parser/lax-conv.cpp

Index: clang/test/Parser/lax-conv.cpp
===
--- /dev/null
+++ clang/test/Parser/lax-conv.cpp
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature -vsx -fsyntax-only -verify=expected,novsx %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -target-feature -vsx -fsyntax-only -verify=expected,aix %s
+
+void dummy(vector unsigned int a);
+
+vector unsigned int test1(vector unsigned char RetImplicitConv) {
+  return RetImplicitConv; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test2(vector unsigned char RetImplicitConvAddConst) {
+  return RetImplicitConvAddConst + 5; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test3(vector unsigned char RetExplicitConv) {
+  return (vector unsigned int)RetExplicitConv;
+}
+vector unsigned int test4(vector unsigned char RetExplicitConvAddConst) {
+  return (vector unsigned int)RetExplicitConvAddConst + 5;
+}
+vector unsigned int test5(vector unsigned char RetImplicitConvAddSame1,
+  vector unsigned char RetImplicitConvAddSame2) {
+  return RetImplicitConvAddSame1 + RetImplicitConvAddSame2; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test6(vector unsigned char RetExplicitConvAddSame1,
+  vector unsigned char RetExplicitConvAddSame2) {
+  return (vector unsigned int)RetExplicitConvAddSame1 +
+ (vector unsigned int)RetExplicitConvAddSame2;
+}
+vector unsigned int test7(vector unsigned char RetExplicitConvAddSame1Full,
+  vector unsigned char RetExplicitConvAddSame2Full) {
+  return (vector unsigned int)(RetExplicitConvAddSame1Full +
+   RetExplicitConvAddSame2Full);
+}
+void test1a(vector unsigned char ArgImplicitConv) {
+  return dummy(ArgImplicitConv); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test2a(vector unsigned char ArgImplicitConvAddConst) {
+  return dummy(ArgImplicitConvAddConst + 5); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test3a(vector unsigned char ArgExplicitConv) {
+  return dummy((vector unsigned int)ArgExplicitConv);
+}
+void test4a(vector unsigned char ArgExplicitConvAddConst) {
+  return dummy((vector unsigned int)ArgExplicitConvAddConst + 5);
+}
+void test5a(vector unsigned char ArgImplicitConvAddSame1,
+vector unsigned char ArgImplicitConvAddSame2) {
+  return dummy(ArgImplicitConvAddSame1 + ArgImplicitConvAddSame2); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test6a(vector unsigned char ArgExplicitConvAddSame1,
+vector unsigned char ArgExplicitConvAddS

[PATCH] D135859: [Includecleaner] Introduce RefType to ast walking

2022-11-09 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added a comment.

@kadircet, this commit causes failure on 
https://lab.llvm.org/buildbot/#/builders/121 which is possible to reproduce 
locally, can you please take a look?

[

  35/111] Linking CXX executable 
tools/clang/tools/extra/include-cleaner/unittests/ClangIncludeCleanerTests
  FAILED: 
tools/clang/tools/extra/include-cleaner/unittests/ClangIncludeCleanerTests 
  : && /usr/lib64/ccache/c++  -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation 
-fdiagnostics-color -ffunction-sections -fdata-sections -fno-common 
-Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -Wl,--gc-sections 
tools/clang/tools/extra/include-cleaner/unittests/CMakeFiles/ClangIncludeCleanerTests.dir/AnalysisTest.cpp.o
 
tools/clang/tools/extra/include-cleaner/unittests/CMakeFiles/ClangIncludeCleanerTests.dir/RecordTest.cpp.o
 
tools/clang/tools/extra/include-cleaner/unittests/CMakeFiles/ClangIncludeCleanerTests.dir/WalkASTTest.cpp.o
  -o tools/clang/tools/extra/include-cleaner/unittests/ClangIncludeCleanerTests 
 
-Wl,-rpath,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
  -lpthread  lib/libllvm_gtest_main.so.16git  -lpthread  
lib/libclangIncludeCleaner.so.16git  lib/libclangTesting.so.16git  
lib/libLLVMTestingSupport.so.16git  
lib/libclangToolingInclusionsStdlib.so.16git  lib/libllvm_gtest.so.16git  
lib/libclangFrontend.so.16git  lib/libclangAST.so.16git  
lib/libclangBasic.so.16git  lib/libLLVMSupport.so.16git  
-Wl,-rpath-link,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
 && :
  /usr/bin/ld: 
tools/clang/tools/extra/include-cleaner/unittests/CMakeFiles/ClangIncludeCleanerTests.dir/RecordTest.cpp.o:
 undefined reference to symbol '_ZTVN5clang18PPChainedCallbacksE'
  
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib/libclangLex.so.16git:
 error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  [79/111] cd 
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/bindings/python
 && /usr/local/bin/cmake -E env 
CLANG_LIBRARY_PATH=/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
 /usr/bin/python3.6 -m unittest discover
  ..
  
  
  cmake -G Ninja ../llvm-project/llvm -DCMAKE_BUILD_TYPE=Release 
-DLLVM_ENABLE_ASSERTIONS=True '-DLLVM_LIT_ARGS='"'"'-v'"'"'' 
-DCMAKE_INSTALL_PREFIX=../stage1.install -DLLVM_ENABLE_ASSERTIONS=ON 
-DLLVM_ENABLE_RUNTIMES=compiler-rt -DBUILD_SHARED_LIBS=ON 
-DLLVM_CCACHE_BUILD=ON '-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;llvm'
  
  ...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135859/new/

https://reviews.llvm.org/D135859

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136723: [include-cleaner] Record main-file macro occurences and includes

2022-11-08 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added a comment.

This commit causes build failure on  
`https://lab.llvm.org/buildbot/#/builders/121/builds/24947`  :

  [43/635] Building CXX object 
tools/clang/tools/extra/include-cleaner/lib/CMakeFiles/obj.clangIncludeCleaner.dir/Types.cpp.o
  FAILED: 
tools/clang/tools/extra/include-cleaner/lib/CMakeFiles/obj.clangIncludeCleaner.dir/Types.cpp.o
 
  CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/lib64/ccache/c++  
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools/clang/tools/extra/include-cleaner/lib 
-I/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/lib
 
-I/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/include
 -Itools/clang/include -Iinclude 
-I/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/include
 
-I/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/include
 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden 
-Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings 
-Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long 
-Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
-Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment 
-Wno-misleading-indentation -fdiagnostics-color -ffunction-sections 
-fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 
-DNDEBUG-fno-exceptions -fno-rtti -UNDEBUG -std=c++17 -MD -MT 
tools/clang/tools/extra/include-cleaner/lib/CMakeFiles/obj.clangIncludeCleaner.dir/Types.cpp.o
 -MF 
tools/clang/tools/extra/include-cleaner/lib/CMakeFiles/obj.clangIncludeCleaner.dir/Types.cpp.o.d
 -o 
tools/clang/tools/extra/include-cleaner/lib/CMakeFiles/obj.clangIncludeCleaner.dir/Types.cpp.o
 -c 
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/lib/Types.cpp
  In file included from 
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/lib/Types.cpp:9:
  
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h:84:10:
 error: declaration of ‘clang::include_cleaner::Symbol 
clang::include_cleaner::SymbolReference::Symbol’ [-fpermissive]
 Symbol Symbol;
^~
  
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h:51:8:
 error: changes meaning of ‘Symbol’ from ‘struct 
clang::include_cleaner::Symbol’ [-fpermissive]
   struct Symbol {
  ^~
  
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/lib/Types.cpp:
 In function ‘llvm::raw_ostream& 
clang::include_cleaner::operator<<(llvm::raw_ostream&, const 
clang::include_cleaner::SymbolReference&)’:
  
/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/include-cleaner/lib/Types.cpp:51:51:
 warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
  /*Width=*/CHAR_BIT *


I was able to reproduce the failure and by reverting this commit locally it 
passed, can you please take a look? @sammccall


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136723/new/

https://reviews.llvm.org/D136723

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-16 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437740.
maryammo added a comment.

Address review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+  S.anyAltivecTypes(FromType, ToType) &&
+  !S.areSameVectorElemTypes(FromType, ToType) &&
+  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7712,6 +7712,36 @@
   return (SrcLen * SrcEltSize == DestLen * DestEltSize);
 }
 
+// This returns true if at least one of the types is an altiv

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:7723
+
+  if (SrcTy->isVectorType()) {
+VectorType::VectorKind SrcVecKind =

maryammo wrote:
> lei wrote:
> > do we really need this check since we have an assert above?
> Yes, without this check there is gonna be a compile time failure for cases 
> where SrcTy is not vector but we wanna cast it to vector 
> 'SrcTy->castAs()' 
the assert checks of either of them is a vector but then we wanna check if at 
least one of them is altivec. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:7723
+
+  if (SrcTy->isVectorType()) {
+VectorType::VectorKind SrcVecKind =

lei wrote:
> do we really need this check since we have an assert above?
Yes, without this check there is gonna be a compile time failure for cases 
where SrcTy is not vector but we wanna cast it to vector 
'SrcTy->castAs()' 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437317.
maryammo added a comment.

Fixing unintentional merge from previous commit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+  S.areAnyVectorTypesAltivec(FromType, ToType) &&
+  !S.areVectorTypesSameElmType(FromType, ToType) &&
+  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7712,6 +7712,43 @@
   return (SrcLen * SrcEltSize == DestLen * DestEltSize);
 }
 
+// This returns true if a

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437313.
maryammo added a comment.
Herald added a subscriber: kbarton.

clang-format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/altivec.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+  S.areAnyVectorTypesAltivec(FromType, ToType) &&
+  !S.areVectorTypesSameElmType(FromType, ToType) &&
+  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ 

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437311.
maryammo added a comment.

NFC


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+	  S.areAnyVectorTypesAltivec(FromType, ToType) &&
+  !S.areVectorTypesSameElmType(FromType, ToType) &&
+	  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7712,6 +7712,43 @@
   return (SrcLen * SrcEltSize == DestLen * DestEltSize);
 }
 
+// This returns true if at least one of the types is an altivec vector.
+bool Sema:

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437310.
maryammo added a comment.

NFC


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+	  S.areAnyVectorTypesAltivec(FromType, ToType) &&
+  !S.areVectorTypesSameElmType(FromType, ToType) &&
+	  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
@@ -15285,3 +15294,4 @@
 return false;
   return true;
 }
+
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7712,6 +7712,43 @@
   return (SrcLen * SrcEltSize == DestLen * DestEltSize);
 }
 
+// This returns

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437303.
maryammo marked an inline comment as not done.
maryammo added a comment.

Address the review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+	  S.areAnyVectorTypesAltivec(FromType, ToType) &&
+  !S.areVectorTypesSameElmType(FromType, ToType) &&
+	  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7712,6 +7712,43 @@
   return (SrcLen * SrcEltSize == DestLen * DestEltSize);
 }
 
+// This retu

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:7715
 
+bool Sema::areAnyVectorTypesAltivec(QualType SrcTy, QualType DestTy) {
+  assert(DestTy->isVectorType() || SrcTy->isVectorType());

lei wrote:
> maryammo wrote:
> > amyk wrote:
> > > Can we add some brief documentation for this function, like what is done 
> > > for other functions in this file?
> > sure
> feels like this should be written to just take either 1 param or multiple 
> params via vararg.. since the 2 arg are not really related in any way.
I am not sure what you mean, can you please elaborate on that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:7715
 
+bool Sema::areAnyVectorTypesAltivec(QualType SrcTy, QualType DestTy) {
+  assert(DestTy->isVectorType() || SrcTy->isVectorType());

amyk wrote:
> Can we add some brief documentation for this function, like what is done for 
> other functions in this file?
sure



Comment at: clang/lib/Sema/SemaExpr.cpp:7716
+bool Sema::areAnyVectorTypesAltivec(QualType SrcTy, QualType DestTy) {
+  assert(DestTy->isVectorType() || SrcTy->isVectorType());
+

amyk wrote:
> Can we add a message to this `assert()`?
I followed what was done for other similar functions like : 
areMatrixTypesOfTheSameDimension



Comment at: clang/lib/Sema/SemaExpr.cpp:7716
+bool Sema::areAnyVectorTypesAltivec(QualType SrcTy, QualType DestTy) {
+  assert(DestTy->isVectorType() || SrcTy->isVectorType());
+

maryammo wrote:
> amyk wrote:
> > Can we add a message to this `assert()`?
> I followed what was done for other similar functions like : 
> areMatrixTypesOfTheSameDimension
same as others



Comment at: clang/lib/Sema/SemaExpr.cpp:7722
+  if (SrcTy->isVectorType())
+  {
+VectorType::VectorKind SrcVecKind = 
SrcTy->castAs()->getVectorKind();

amyk wrote:
> nit: Can we put braces on the same line? (And same goes for 7727)
sure



Comment at: clang/lib/Sema/SemaExpr.cpp:7735
+
+bool Sema::areVectorTypesSameElmType(QualType SrcTy, QualType DestTy) {
+  assert(DestTy->isVectorType() || SrcTy->isVectorType());

amyk wrote:
> Can we add some brief documentation for this function, like what is done for 
> other functions in this file?
sure



Comment at: clang/lib/Sema/SemaExpr.cpp:7736
+bool Sema::areVectorTypesSameElmType(QualType SrcTy, QualType DestTy) {
+  assert(DestTy->isVectorType() || SrcTy->isVectorType());
+

amyk wrote:
> Can we add a message to this assert?
I followed what was done for other similar functions like : 
areMatrixTypesOfTheSameDimension



Comment at: clang/lib/Sema/SemaOverload.cpp:13027
   // end up here.
+  //
   return SemaRef.BuildCallExpr(/*Scope*/ nullptr, NewFn.get(), LParenLoc,

amyk wrote:
> amyk wrote:
> > Unnecessary change?
> Unnecessary change?
yes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-06-15 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 437161.
maryammo added a comment.

Tune the logic to emit warning when at least one of the vectors is altivec one 
and overloading resolution is done


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,13 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (S.isLaxVectorConversion(FromType, ToType) &&
+	  S.areAnyVectorTypesAltivec(FromType, ToType) &&
+  !S.areVectorTypesSameElmType(FromType, ToType) &&
+	  !InOverloadResolution) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1916,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
@@ -13014,6 +13023,7 @@
   // This shouldn't cause an infinite loop because we're giving it
   // an expression with viable lookup results, which should never
   // end up here.
+  //
   return SemaRef.BuildCallExpr(/*Scope*/ 

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-05-27 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 432553.
maryammo added a comment.

NFC update


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126540/new/

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,14 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (!InOverloadResolution &&
+  FromType->castAs()->getVectorKind() ==
+  VectorType::AltiVecVector &&
+  ToType->castAs()->getVectorKind() ==
+  VectorType::AltiVecVector) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1917,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
@@ -13014,6 +13024,7 @@
   // This shouldn't cause an infinite loop because we're giving it
   // an expression with viable lookup results, which should never
   // end up here.
+  //
   return SemaRef.BuildCallExpr(/*Scope*/ nullptr, NewFn.get(), LParenLoc,
MultiExprArg(Args.data(), Args.size()),
 

[PATCH] D126540: PowerPC] Emit warning for incompatible vector types that are currently diagnosed with -fno-lax-vector-conversions

2022-05-27 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch is the last prerequisite to switch the default behaviour to 
-fno-lax-vector-conversions in the future.
The first path ;D124093 ; fixed the altivec 
implicit castings.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126540

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp

Index: clang/test/Parser/cxx-altivec.cpp
===
--- clang/test/Parser/cxx-altivec.cpp
+++ clang/test/Parser/cxx-altivec.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature +vsx -target-cpu pwr7 -fsyntax-only -verify=expected,nonaix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -Wno-deprecate-lax-vec-conv-all -target-feature -vsx -target-cpu pwr7 -fsyntax-only -verify=expected,novsx -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -Wno-deprecate-lax-vec-conv-all -target-feature +altivec -fsyntax-only -verify=expected,aix -std=c++11 %s
 #include 
 
 __vector char vv_c;
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1617,8 +1617,9 @@
 ///
 /// \param ICK Will be set to the vector conversion kind, if this is a vector
 /// conversion.
-static bool IsVectorConversion(Sema &S, QualType FromType,
-   QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
+   ImplicitConversionKind &ICK, Expr *From,
+   bool InOverloadResolution) {
   // We need at least one of these types to be a vector type to have a vector
   // conversion.
   if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -1660,6 +1661,14 @@
 if (S.Context.areCompatibleVectorTypes(FromType, ToType) ||
 (S.isLaxVectorConversion(FromType, ToType) &&
  !ToType->hasAttr(attr::ArmMveStrictPolymorphism))) {
+  if (!InOverloadResolution &&
+  FromType->castAs()->getVectorKind() ==
+  VectorType::AltiVecVector &&
+  ToType->castAs()->getVectorKind() ==
+  VectorType::AltiVecVector) {
+S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all)
+<< FromType << ToType;
+  }
   ICK = ICK_Vector_Conversion;
   return true;
 }
@@ -1908,7 +1917,8 @@
  InOverloadResolution, FromType)) {
 // Pointer to member conversions (4.11).
 SCS.Second = ICK_Pointer_Member;
-  } else if (IsVectorConversion(S, FromType, ToType, SecondICK)) {
+  } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From,
+InOverloadResolution)) {
 SCS.Second = SecondICK;
 FromType = ToType.getUnqualifiedType();
   } else if (!S.getLangOpts().CPlusPlus &&
@@ -13014,6 +13024,7 @@
   // This shouldn't cause an inf

[PATCH] D124093: [PowerPC] Fixing implicit castings in altivec for -fno-lax-vector-conversions

2022-05-21 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added a comment.

In D124093#3528639 , @amyk wrote:

> I was wondering where are the test cases in this patch. Did they get missed 
> when updating the revision?

The test case's modification were not needed as part of addressing Nemanja's 
comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124093/new/

https://reviews.llvm.org/D124093

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D124093: [PowerPC] Fixing implicit castings in altivec for -fno-lax-vector-conversions

2022-04-25 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 425086.
maryammo added a comment.

[PowerPC] Address the review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124093/new/

https://reviews.llvm.org/D124093

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/altivec.h

Index: clang/lib/Headers/altivec.h
===
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -311,7 +311,7 @@
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
-  return __builtin_altivec_vadduqm(__a, __b);
+  return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b);
 }
 #elif defined(__VSX__)
 static __inline__ vector signed long long __ATTRS_o_ai
@@ -325,9 +325,9 @@
   (vector unsigned int)__a + (vector unsigned int)__b;
   vector unsigned int __carry = __builtin_altivec_vaddcuw(
   (vector unsigned int)__a, (vector unsigned int)__b);
-  __carry = __builtin_shufflevector((vector unsigned char)__carry,
-(vector unsigned char)__carry, 0, 0, 0, 7,
-0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
+  __carry = (vector unsigned int)__builtin_shufflevector(
+  (vector unsigned char)__carry, (vector unsigned char)__carry, 0, 0, 0, 7,
+  0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
   return (vector signed long long)(__res + __carry);
 #endif
 }
@@ -358,7 +358,9 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
  vector signed __int128 __c) {
-  return __builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector signed __int128)__builtin_altivec_vaddeuqm(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+  (vector unsigned __int128)__c);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -371,7 +373,9 @@
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_adde_u128(vector unsigned char __a, vector unsigned char __b,
   vector unsigned char __c) {
-  return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector unsigned char)__builtin_altivec_vaddeuqm_c(
+  (vector unsigned char)__a, (vector unsigned char)__b,
+  (vector unsigned char)__c);
 }
 #endif
 
@@ -398,7 +402,9 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
   vector signed __int128 __c) {
-  return __builtin_altivec_vaddecuq(__a, __b, __c);
+  return (vector signed __int128)__builtin_altivec_vaddecuq(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+  (vector unsigned __int128)__c);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -411,7 +417,9 @@
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_addec_u128(vector unsigned char __a, vector unsigned char __b,
vector unsigned char __c) {
-  return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c);
+  return (vector unsigned char)__builtin_altivec_vaddecuq_c(
+  (vector unsigned char)__a, (vector unsigned char)__b,
+  (vector unsigned char)__c);
 }
 
 #ifdef __powerpc64__
@@ -600,7 +608,8 @@
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_addc_u128(vector unsigned char __a, vector unsigned char __b) {
-  return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b);
+  return (vector unsigned char)__builtin_altivec_vaddcuq_c(
+  (vector unsigned char)__a, (vector unsigned char)__b);
 }
 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
 
@@ -824,7 +833,9 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
  vector signed __int128 __c) {
-  return __builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector signed __int128)__builtin_altivec_vaddeuqm(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+  (vector unsigned __int128)__c);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -837,7 +848,8 @@
 
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
-  return __builtin_altivec_vaddcuq(__a, __b);
+  return (vector signed __int128)__builtin_altivec_vaddcuq(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -850,7 +862,9 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
  vector signed __int128 __c) {
-  return __builtin_altivec_vaddecuq(__a, __b, __c);
+  return (vector signed __int128)__builti

[PATCH] D123668: [Testing] TestAST, a helper for writing straight-line AST tests

2022-04-21 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added a comment.

It seems it breaks the  following builds:
https://lab.llvm.org/buildbot/#/builders/121/builds/18618
https://lab.llvm.org/buildbot/#/builders/57/builds/17125


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123668/new/

https://reviews.llvm.org/D123668

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D124093: [PowerPC] Fixing implicit castings in altivec for -fno-lax-vector-conversions

2022-04-20 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 424050.
maryammo added a comment.

[NFC] Fix the formatting


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124093/new/

https://reviews.llvm.org/D124093

Files:
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
  clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c

Index: clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c
===
--- clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c
+++ clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c
@@ -7,7 +7,7 @@
 // RUN:   -triple powerpc64-aix-unknown -emit-llvm %s -o - | FileCheck \
 // RUN:   %s -check-prefix=CHECK-AIX
 // RUN: %clang_cc1 -O2 -target-feature +altivec -target-feature +power8-vector \
-// RUN:   -triple powerpc-aix-unknown -emit-llvm %s -o - | FileCheck \
+// RUN:   -triple powerpc-aix-unknown -emit-llvm -fforce-enable-int128 %s -o - | FileCheck \
 // RUN:   %s -check-prefix=CHECK-AIX
 #include 
 // CHECK-LE-LABEL: @test_subc(
Index: clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
@@ -1952,7 +1952,7 @@
 vector signed __int128 test_vec_rl_s128(void) {
   // CHECK-LABEL: @test_vec_rl_s128(
   // CHECK: sub <1 x i128>
-  // CHECK-NEXT: lshr <1 x i128>
+  // CHECK-NEXT: ashr <1 x i128>
   // CHECK-NEXT: or <1 x i128>
   // CHECK-NEXT: ret <1 x i128>
   return vec_rl(vsi128a, vsi128b);
Index: clang/lib/Headers/altivec.h
===
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -311,7 +311,7 @@
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
-  return __builtin_altivec_vadduqm(__a, __b);
+  return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b);
 }
 #elif defined(__VSX__)
 static __inline__ vector signed long long __ATTRS_o_ai
@@ -325,9 +325,9 @@
   (vector unsigned int)__a + (vector unsigned int)__b;
   vector unsigned int __carry = __builtin_altivec_vaddcuw(
   (vector unsigned int)__a, (vector unsigned int)__b);
-  __carry = __builtin_shufflevector((vector unsigned char)__carry,
-(vector unsigned char)__carry, 0, 0, 0, 7,
-0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
+  __carry = (vector unsigned int)__builtin_shufflevector(
+  (vector unsigned char)__carry, (vector unsigned char)__carry, 0, 0, 0, 7,
+  0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
   return (vector signed long long)(__res + __carry);
 #endif
 }
@@ -358,7 +358,9 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
  vector signed __int128 __c) {
-  return __builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector signed __int128)__builtin_altivec_vaddeuqm(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+  (vector unsigned __int128)__c);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -366,14 +368,16 @@
  vector unsigned __int128 __c) {
   return __builtin_altivec_vaddeuqm(__a, __b, __c);
 }
-#endif
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_adde_u128(vector unsigned char __a, vector unsigned char __b,
   vector unsigned char __c) {
-  return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector unsigned char)__builtin_altivec_vaddeuqm(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+  (vector unsigned __int128)__c);
 }
 #endif
+#endif
 
 static __inline__ vector signed int __ATTRS_o_ai
 vec_adde(vector signed int __a, vector signed int __b,
@@ -398,7 +402,9 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
   vector signed __int128 __c) {
-  return __builtin_altivec_vaddecuq(__a, __b, __c);
+  return (vector signed __int128)__builtin_altivec_vaddecuq(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+  (vector unsigned __int128)__c);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -406,13 +412,15 @@
   vector unsigned __int128 __c) {
   return __builtin_altivec_vaddecuq(__a, __b, __c);
 }
-#endif
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_addec_u128(vector unsigned char __a, vector unsigned char __b,
vector unsigned char __c) {
-  return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c);
+  return (vector unsigned char)__builtin_altivec_vaddecuq(
+  (vector unsigned __int128)__a, (vector unsigned __int128)__b,
+ 

[PATCH] D124093: [PowerPC] Fixing implicit castings in altivec for -fno-lax-vector-conversions

2022-04-20 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, kbarton, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

XL considers different vector types to be incompatible with each other.
For example assignment between variables of types vector float and vector
long long or even vector signed int and vector unsigned int are diagnosed.
clang, however does not diagnose such cases and does a simple bitcast between
the two types. This could easily result in program errors. This patch is to
fix the implicit casts in altivec.h so that there is no incompatible vector
type errors whit -fno-lax-vector-conversions, this is the prerequisite patch
to switch the default to -fno-lax-vector-conversions later.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124093

Files:
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
  clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c

Index: clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c
===
--- clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c
+++ clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c
@@ -7,7 +7,7 @@
 // RUN:   -triple powerpc64-aix-unknown -emit-llvm %s -o - | FileCheck \
 // RUN:   %s -check-prefix=CHECK-AIX
 // RUN: %clang_cc1 -O2 -target-feature +altivec -target-feature +power8-vector \
-// RUN:   -triple powerpc-aix-unknown -emit-llvm %s -o - | FileCheck \
+// RUN:   -triple powerpc-aix-unknown -emit-llvm -fforce-enable-int128 %s -o - | FileCheck \
 // RUN:   %s -check-prefix=CHECK-AIX
 #include 
 // CHECK-LE-LABEL: @test_subc(
Index: clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c
@@ -1952,7 +1952,7 @@
 vector signed __int128 test_vec_rl_s128(void) {
   // CHECK-LABEL: @test_vec_rl_s128(
   // CHECK: sub <1 x i128>
-  // CHECK-NEXT: lshr <1 x i128>
+  // CHECK-NEXT: ashr <1 x i128>
   // CHECK-NEXT: or <1 x i128>
   // CHECK-NEXT: ret <1 x i128>
   return vec_rl(vsi128a, vsi128b);
Index: clang/lib/Headers/altivec.h
===
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -311,7 +311,7 @@
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
-  return __builtin_altivec_vadduqm(__a, __b);
+  return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b);
 }
 #elif defined(__VSX__)
 static __inline__ vector signed long long __ATTRS_o_ai
@@ -325,9 +325,10 @@
   (vector unsigned int)__a + (vector unsigned int)__b;
   vector unsigned int __carry = __builtin_altivec_vaddcuw(
   (vector unsigned int)__a, (vector unsigned int)__b);
-  __carry = __builtin_shufflevector((vector unsigned char)__carry,
-(vector unsigned char)__carry, 0, 0, 0, 7,
-0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
+  __carry = (vector unsigned int)__builtin_shufflevector(
+		 (vector unsigned char)__carry,
+ (vector unsigned char)__carry, 0, 0, 0, 7,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
   return (vector signed long long)(__res + __carry);
 #endif
 }
@@ -358,7 +359,10 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
  vector signed __int128 __c) {
-  return __builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector signed __int128)__builtin_altivec_vaddeuqm(
+(vector unsigned __int128)__a,
+		(vector unsigned __int128)__b,
+			(vector unsigned __int128)__c);
 }
 
 static __inline__ vector unsigned __int128 __ATTRS_o_ai
@@ -366,14 +370,17 @@
  vector unsigned __int128 __c) {
   return __builtin_altivec_vaddeuqm(__a, __b, __c);
 }
-#endif
 
 static __inline__ vector unsigned char __attribute__((__always_inline__))
 vec_adde_u128(vector unsigned char __a, vector unsigned char __b,
   vector unsigned char __c) {
-  return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c);
+  return (vector unsigned char)__builtin_altivec_vaddeuqm(
+		   (vector unsigned __int128)__a,
+		   (vector unsigned __int128)__b,
+	   (vector unsigned __int128)__c);
 }
 #endif
+#endif
 
 static __inline__ vector signed int __ATTRS_o_ai
 vec_adde(vector signed int __a, vector signed int __b,
@@ -398,7 +405,10 @@
 static __inline__ vector signed __int128 __ATTRS_o_ai
 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
   

[PATCH] D123300: [Clang] Enable opaque pointers by default

2022-04-12 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo added a comment.

@nikic, it seems breaking the  clang-ppc64le-rhel build

  htps://lab.llvm.org/buildbot/#/builders/57/builds/16776

Can you please take a look?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123300/new/

https://reviews.llvm.org/D123300

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits