[clang] 5b4ed49 - [PowerPC] Remove the lax warning for explicit casts
Author: Maryam Moghadas Date: 2023-01-20T14:23:54-06:00 New Revision: 5b4ed4905017a052501becfde8dd1fca1e476ee3 URL: https://github.com/llvm/llvm-project/commit/5b4ed4905017a052501becfde8dd1fca1e476ee3 DIFF: https://github.com/llvm/llvm-project/commit/5b4ed4905017a052501becfde8dd1fca1e476ee3.diff LOG: [PowerPC] Remove the lax warning for explicit casts This patch is to remove the erroneous lax vector conversion warning for CStyle; explicit; casts that was added as part of D126540. Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D14 Added: clang/test/Parser/lax-conv.cpp Modified: clang/lib/Sema/SemaOverload.cpp clang/test/Parser/cxx-altivec.cpp Removed: diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 251895076432b..89b5e29ffd614 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1726,7 +1726,7 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType, /// conversion. static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType, ImplicitConversionKind &ICK, Expr *From, - bool InOverloadResolution) { + bool InOverloadResolution, bool CStyle) { // We need at least one of these types to be a vector type to have a vector // conversion. if (!ToType->isVectorType() && !FromType->isVectorType()) @@ -1771,7 +1771,7 @@ static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType, if (S.isLaxVectorConversion(FromType, ToType) && S.anyAltivecTypes(FromType, ToType) && !S.areSameVectorElemTypes(FromType, ToType) && - !InOverloadResolution) { + !InOverloadResolution && !CStyle) { S.Diag(From->getBeginLoc(), diag::warn_deprecated_lax_vec_conv_all) << FromType << ToType; } @@ -2024,7 +2024,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, // Pointer to member conversions (4.11). SCS.Second = ICK_Pointer_Member; } else if (IsVectorConversion(S, FromType, ToType, SecondICK, From, -InOverloadResolution)) { +InOverloadResolution, CStyle)) { SCS.Second = SecondICK; FromType = ToType.getUnqualifiedType(); } else if (!S.getLangOpts().CPlusPlus && diff --git a/clang/test/Parser/cxx-altivec.cpp b/clang/test/Parser/cxx-altivec.cpp index d1aaadc8899c5..11ac15ef46097 100644 --- a/clang/test/Parser/cxx-altivec.cpp +++ b/clang/test/Parser/cxx-altivec.cpp @@ -1,10 +1,10 @@ -// 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 +// 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 #include __vector char vv_c; diff --git a/clang/test/Parser/lax-conv.cpp b/clang/test/Parser/lax-conv.cpp new file mode 100
[clang] 60b117a - [PowerPC] Adding test coverage for vector compatibility warning
Author: Maryam Moghadas Date: 2023-03-20T12:48:45-05:00 New Revision: 60b117aa81493e4f91df11ec2322957ec7800f55 URL: https://github.com/llvm/llvm-project/commit/60b117aa81493e4f91df11ec2322957ec7800f55 DIFF: https://github.com/llvm/llvm-project/commit/60b117aa81493e4f91df11ec2322957ec7800f55.diff LOG: [PowerPC] Adding test coverage for vector compatibility warning This is to test D143210 patch to have the same vector compatibility logic for error and warning diagnostics. Reviewed By: lei Differential Revision: https://reviews.llvm.org/D144611 Added: Modified: clang/test/Parser/lax-conv.cpp Removed: diff --git a/clang/test/Parser/lax-conv.cpp b/clang/test/Parser/lax-conv.cpp index b3b611264928..f784e3fa74e7 100644 --- a/clang/test/Parser/lax-conv.cpp +++ b/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 @@ void test7a(vector unsigned char ArgExplicitConvAddSame1Full, 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-warni
[clang] 155abd0 - [PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC
Author: Maryam Moghadas Date: 2023-03-21T08:51:25-05:00 New Revision: 155abd0678ab8c9f7d11ee175a3ce7a33d107c67 URL: https://github.com/llvm/llvm-project/commit/155abd0678ab8c9f7d11ee175a3ce7a33d107c67 DIFF: https://github.com/llvm/llvm-project/commit/155abd0678ab8c9f7d11ee175a3ce7a33d107c67.diff LOG: [PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC This patch is to isolate the lax vector conversions warning only for PPC, the reason is that SystemZ wants different logic in terms of vector bool compatibility. Reviewed By: lei Differential Revision: https://reviews.llvm.org/D145506 Added: Modified: clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaOverload.cpp clang/test/CodeGen/SystemZ/zvector.c clang/test/CodeGen/SystemZ/zvector2.c Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 963bd43b6e12..40c2a993b8ff 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9856,7 +9856,8 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // 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 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, 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 Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, 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 diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 3f1bb3f57122..18b356c2f9f7 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1775,7 +1775,8 @@ static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType, 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) { diff --git a/clang/test/CodeGen/SystemZ/zvector.c b/clang/test/CodeGen/SystemZ/zvector.c index 33fde545b9d4..2720770624fb 100644 --- a/clang/test/CodeGen/SystemZ/zvector.c +++ b/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; diff --git a/clang/test/CodeGen/SystemZ/zvector2.c b/clang/test/CodeGen/SystemZ/zvector2.c index 93fb1f543430..36cbf228feac 100644 --- a/clang/test/CodeGen/SystemZ/zvector2.c +++ b/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
[clang] ee815ff - [PowerPC] Fix the implicit casting for the emulated intrinsics
Author: Maryam Moghadas Date: 2023-02-21T15:44:57-06:00 New Revision: ee815ff2ce8d0782cf04f5cad1d4038207f661cf URL: https://github.com/llvm/llvm-project/commit/ee815ff2ce8d0782cf04f5cad1d4038207f661cf DIFF: https://github.com/llvm/llvm-project/commit/ee815ff2ce8d0782cf04f5cad1d4038207f661cf.diff LOG: [PowerPC] Fix the implicit casting for the emulated intrinsics This patch is to fix some implicit castings for emulated intrinsics so that there are no lax-vector-conversions errors and warnings. Reviewed By: nemanjai, #powerpc Differential Revision: https://reviews.llvm.org/D144293 Added: Modified: clang/lib/Headers/ppc_wrappers/emmintrin.h clang/lib/Headers/ppc_wrappers/smmintrin.h clang/test/CodeGen/PowerPC/ppc-smmintrin.c Removed: diff --git a/clang/lib/Headers/ppc_wrappers/emmintrin.h b/clang/lib/Headers/ppc_wrappers/emmintrin.h index 0814ea5593bad..fc18ab9d43b15 100644 --- a/clang/lib/Headers/ppc_wrappers/emmintrin.h +++ b/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 @@ extern __inline __m128d _mm_cvtpi32_pd(__m64 __A) { __v4si __temp; __v2di __tmp2; - __v2df __result; + __v4f __result; __temp = (__v4si)vec_splats(__A); __tmp2 = (__v2di)vec_unpackl(__temp); diff --git a/clang/lib/Headers/ppc_wrappers/smmintrin.h b/clang/lib/Headers/ppc_wrappers/smmintrin.h index 6fe6d2a157a59..349b395c4f00b 100644 --- a/clang/lib/Headers/ppc_wrappers/smmintrin.h +++ b/clang/lib/Headers/ppc_wrappers/smmintrin.h @@ -305,9 +305,9 @@ extern __inline int 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 diff --git a/clang/test/CodeGen/PowerPC/ppc-smmintrin.c b/clang/test/CodeGen/PowerPC/ppc-smmintrin.c index 5033526fd3369..220b65c1ce164 100644 --- a/clang/test/CodeGen/PowerPC/ppc-smmintrin.c +++ b/clang/test/CodeGen/PowerPC/ppc-smmintrin.c @@ -73,7 +73,7 @@ test_blend() { // 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 @@ void __attribute__((noinline)) 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 02a71b0 - [PowerPC] Include vector bool and pixel when emitting lax warning
Author: Maryam Moghadas Date: 2023-02-21T22:26:18Z New Revision: 02a71b05fc67326d8ea336aa8ef934de0575be39 URL: https://github.com/llvm/llvm-project/commit/02a71b05fc67326d8ea336aa8ef934de0575be39 DIFF: https://github.com/llvm/llvm-project/commit/02a71b05fc67326d8ea336aa8ef934de0575be39.diff LOG: [PowerPC] Include vector bool and pixel when emitting lax warning 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. Differential Revision: https://reviews.llvm.org/D143210 Added: Modified: 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 Removed: diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 176d92ae6fb1b..ecc031ce116e6 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -12620,7 +12620,6 @@ class Sema final { bool areVectorTypesSameSize(QualType srcType, QualType destType); bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType); bool isLaxVectorConversion(QualType srcType, QualType destType); - bool areSameVectorElemTypes(QualType srcType, QualType destType); bool anyAltivecTypes(QualType srcType, QualType destType); /// type checking declaration initializers (C99 6.7.8) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 12c02e531da3e..af88d460137ae 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -7987,30 +7987,24 @@ bool Sema::anyAltivecTypes(QualType SrcTy, QualType DestTy) { "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 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // 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) << RHSType << LHSType; Kind = CK_BitCast; @@ -9864,7 +9858,9 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, const VectorType *VecType = RHSType->getAs(); if (VecType && VecType->getNumElements() == 1 && isLaxVectorConversion(RHSType, LHSType)) { -if (VecType->getVectorKind() == VectorType::AltiVecVector) +if (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; @
[clang] [llvm] [PowerPC] Support -fpatchable-function-entry (PR #92997)
maryammo wrote: In `PPCTargetMachine::PPCABI computeTargetABI` it specifies the ABI with this ``` switch (TT.getArch()) { case Triple::ppc64le: return PPCTargetMachine::PPC_ABI_ELFv2; case Triple::ppc64: if (TT.isPPC64ELFv2ABI()) return PPCTargetMachine::PPC_ABI_ELFv2; else return PPCTargetMachine::PPC_ABI_ELFv1; default: return PPCTargetMachine::PPC_ABI_UNKNOWN; } ``` `isPPC64ELFv2ABI()` is defined as ``` /// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2. bool isPPC64ELFv2ABI() const { return (getArch() == Triple::ppc64 && ((getOS() == Triple::FreeBSD && (getOSMajorVersion() >= 13 || getOSVersion().empty())) || getOS() == Triple::OpenBSD || isMusl())); } ``` So PPC64 uses ELFv2 for Triple::OpenBSD. We probably want to diagnose this OS for PC64, since with ELFv2 we might emit separate local and global entry points which means only certain values can be passed to -fpatchable-function-entry option. https://github.com/llvm/llvm-project/pull/92997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PowerPC] Support -fpatchable-function-entry (PR #92997)
maryammo wrote: > > So PPC64 can use ELFv2 for `Triple::OpenBSD`. We probably want to diagnose > > this OS for PPC64, since with ELFv2 we might emit separate local and global > > entry points which means only certain values can be passed to > > `-fpatchable-function-entry` option. > > This patch matches the intended end result: NOPs before the global entry and > after the local entry. > > The current way GCC handles `N,M` where M>0 for PPC64 ELFv2 is undesired and > will hopefully be soon changed: > https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651025.html , matching > what I suggested in 2022: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99888#c5 I see, thanks. https://github.com/llvm/llvm-project/pull/92997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PowerPC] Support -fpatchable-function-entry (PR #92997)
maryammo wrote: > > So PPC64 can use ELFv2 for Triple::OpenBSD. We probably want to diagnose > > this OS for PPC64, since with ELFv2 we might emit separate local and global > > entry points which means only certain values can be passed to > > -fpatchable-function-entry option. > > For targets with ABI elfv2 which means there are dual entries, this patch can > generate expected patchable entry: For > -mtriple=powerpc64-unknown-freebsd-unknown > > ``` > .Ltmp0: > nop > nop > f3: # @f3 > .Lfunc_begin0: > .cfi_startproc > .Lfunc_gep0: > addis 2, 12, .TOC.-.Lfunc_gep0@ha > addi 2, 2, .TOC.-.Lfunc_gep0@l > .Lfunc_lep0: > .localentry f3, .Lfunc_lep0-.Lfunc_gep0 > # %bb.0:# %entry > nop > ``` Ok, so there is no NOPs between lep and gep. Thanks for verifying. https://github.com/llvm/llvm-project/pull/92997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PowerPC] Enable indiviual crbits tracking at -O2 (PR #133617)
https://github.com/maryammo edited https://github.com/llvm/llvm-project/pull/133617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PowerPC] Enable indiviual crbits tracking at -O2 (PR #133617)
https://github.com/maryammo edited https://github.com/llvm/llvm-project/pull/133617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PowerPC] Enable indiviual crbits tracking at -O2 (PR #133617)
@@ -1,8 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s -; RUN: llc -verify-machineinstrs -O1 -mcpu=pwr7 < %s | FileCheck %s +; RUN: llc -verify-machineinstrs -O2 -mcpu=pwr7 < %s | FileCheck %s maryammo wrote: Why changing the opt level here? https://github.com/llvm/llvm-project/pull/133617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [PowerPC] Enable indiviual crbits tracking at -O2 (PR #133617)
https://github.com/maryammo commented: Can we have a test where it shows with this PR, the backend computeFSAdditions can override the CRBits passed by frontend? https://github.com/llvm/llvm-project/pull/133617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits