[PATCH] D115670: Correct behavior of Vector boolean-operations, implement vector operator-
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 13 13:56:41 PST 2021
erichkeane added a comment.
To add:
I DID just try to fix that thing:
[ekeane1 at scsel-clx-24 clang]$ git diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 2b69c3727852..330772d2b10a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -12265,6 +12265,8 @@ QualType Sema::GetSignedVectorType(QualType V) {
return Context.getExtVectorType(Context.ShortTy, VTy->getNumElements());
else if (TypeSize == Context.getTypeSize(Context.IntTy))
return Context.getExtVectorType(Context.IntTy, VTy->getNumElements());
+ else if (TypeSize == Context.getTypeSize(Context.Int128Ty))
+ return Context.getExtVectorType(Context.Int128Ty, VTy->getNumElements());
else if (TypeSize == Context.getTypeSize(Context.LongTy))
return Context.getExtVectorType(Context.LongTy, VTy->getNumElements());
assert(TypeSize == Context.getTypeSize(Context.LongLongTy) &&
@@ -12272,7 +12274,10 @@ QualType Sema::GetSignedVectorType(QualType V) {
return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements());
}
- if (TypeSize == Context.getTypeSize(Context.LongLongTy))
+ if (TypeSize == Context.getTypeSize(Context.Int128Ty))
+ return Context.getVectorType(Context.Int128Ty, VTy->getNumElements(),
+ VectorType::GenericVector);
+ else if (TypeSize == Context.getTypeSize(Context.LongLongTy))
return Context.getVectorType(Context.LongLongTy, VTy->getNumElements(),
VectorType::GenericVector);
else if (TypeSize == Context.getTypeSize(Context.LongTy))
[ekeane1 at scsel-clx-24 clang]$
I then compiled:
using VecTy = __int128 __attribute__((vector_size(32)));
constexpr auto F() {
VecTy V{1,2};
return V <= 2;
}
auto bar() {
constexpr auto Var = F();
return Var;
}
And got:
; Function Attrs: mustprogress noinline nounwind optnone
define dso_local <2 x i128> @_Z3barv() #0 {
entry:
%Var = alloca <2 x i128>, align 32
store <2 x i128> <i128 18446744073709551615, i128 18446744073709551615>, <2 x i128>* %Var, align 32
ret <2 x i128> <i128 18446744073709551615, i128 18446744073709551615>
}
I believe that is the uint64 'max value', right? So would that would be what you mean?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115670/new/
https://reviews.llvm.org/D115670
More information about the cfe-commits
mailing list