[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-30 Thread Richard Smith via cfe-commits
https://github.com/zygoloid closed https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-30 Thread via cfe-commits
DaMatrix wrote: @zygoloid can you commit this? I don't have write access to the repository. https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-24 Thread Richard Smith via cfe-commits
https://github.com/zygoloid approved this pull request. Thanks, LGTM https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-24 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 38647e8b00194a59a31eed92b04b229fe24802b6 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH 1/2] [clang] Implement constexpr bit_cast for vectors --- .../inc

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-23 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 72f63b695c9ebd9c7032c4b754ff7965c28fad5c Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH 1/2] [clang] Implement constexpr bit_cast for vectors --- .../inc

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-21 Thread Richard Smith via cfe-commits
@@ -140,11 +140,12 @@ void g28(void) { typedef short v12i16 __attribute((vector_size(24))); typedef long double v2f80 __attribute((vector_size(24))); // CHECK: @g28.a = internal global <1 x i64> - // CHECK: @g28.b = internal global <12 x i16> - // CHECK: @g28.c = inte

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-21 Thread via cfe-commits
@@ -140,11 +140,12 @@ void g28(void) { typedef short v12i16 __attribute((vector_size(24))); typedef long double v2f80 __attribute((vector_size(24))); // CHECK: @g28.a = internal global <1 x i64> - // CHECK: @g28.b = internal global <12 x i16> - // CHECK: @g28.c = inte

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-21 Thread via cfe-commits
@@ -140,11 +140,12 @@ void g28(void) { typedef short v12i16 __attribute((vector_size(24))); typedef long double v2f80 __attribute((vector_size(24))); // CHECK: @g28.a = internal global <1 x i64> - // CHECK: @g28.b = internal global <12 x i16> - // CHECK: @g28.c = inte

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-20 Thread Richard Smith via cfe-commits
@@ -140,11 +140,12 @@ void g28(void) { typedef short v12i16 __attribute((vector_size(24))); typedef long double v2f80 __attribute((vector_size(24))); // CHECK: @g28.a = internal global <1 x i64> - // CHECK: @g28.b = internal global <12 x i16> - // CHECK: @g28.c = inte

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-20 Thread Richard Smith via cfe-commits
https://github.com/zygoloid commented: Thanks, this looks good to me other than a small test coverage (see comment) / diagnostic wording issue. (For future reference, please don't force-push to PR branches; that makes it much harder for your reviewer to see what's changed since their last revi

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-20 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-19 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 72f63b695c9ebd9c7032c4b754ff7965c28fad5c Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- .../include

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-11 Thread Richard Smith via cfe-commits
@@ -7098,6 +7052,69 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const VectorType *VTy = Ty->castAs(); +QualType EltTy = VTy->getElementType(); +unsigned NElts = VTy->getNumElemen

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-11 Thread via cfe-commits
@@ -7098,6 +7052,69 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const VectorType *VTy = Ty->castAs(); +QualType EltTy = VTy->getElementType(); +unsigned NElts = VTy->getNumElemen

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
https://github.com/zygoloid dismissed https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
@@ -138,13 +138,14 @@ void g27(void) { // PR8073 void g28(void) { typedef long long v1i64 __attribute((vector_size(8))); typedef short v12i16 __attribute((vector_size(24))); + typedef unsigned char v24u8 __attribute((vector_size(24))); typedef long double v2f80 __attrib

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
https://github.com/zygoloid commented: Looks good, other than the handling of `x86_fp80`, which doesn't seem to match Clang's current runtime behavior. https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
@@ -138,13 +138,14 @@ void g27(void) { // PR8073 void g28(void) { typedef long long v1i64 __attribute((vector_size(8))); typedef short v12i16 __attribute((vector_size(24))); + typedef unsigned char v24u8 __attribute((vector_size(24))); typedef long double v2f80 __attrib

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
@@ -7307,6 +7324,74 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *VTy, CharUnits Offset) { +QualType EltTy = VTy->getElementType(); +unsigned NElts = VTy->getNumElements(); +unsigned EltSize = +VTy->

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
@@ -7098,6 +7052,69 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const VectorType *VTy = Ty->castAs(); +QualType EltTy = VTy->getElementType(); +unsigned NElts = VTy->getNumElemen

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-10 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 95c018c67b5ca10e86065fc3d0cb60f507626f34 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- .../include

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-09 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From f05f52ed4e74cf857bf07aef5dbd5d0861591a14 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- .../include

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-05 Thread via cfe-commits
@@ -7441,6 +7500,28 @@ static bool handleLValueToRValueBitCast(EvalInfo &Info, APValue &DestValue, return true; } +static bool handleLValueToRValueBitCast(EvalInfo &Info, APValue &DestValue, +APValue &SourceValue, +

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-05 Thread via cfe-commits
@@ -10517,41 +10598,19 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) { return Success(Elts, E); } case CK_BitCast: { -// Evaluate the operand into an APInt we can extract from. -llvm::APInt SValInt; -if (!EvalAndBitcastToAPInt(Info, SE, SVal

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-04 Thread Richard Smith via cfe-commits
@@ -10517,41 +10598,19 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) { return Success(Elts, E); } case CK_BitCast: { -// Evaluate the operand into an APInt we can extract from. -llvm::APInt SValInt; -if (!EvalAndBitcastToAPInt(Info, SE, SVal

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-04 Thread Richard Smith via cfe-commits
https://github.com/zygoloid approved this pull request. Thanks, looks good. Just a couple of minor suggestions. https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-04 Thread Richard Smith via cfe-commits
@@ -7441,6 +7500,28 @@ static bool handleLValueToRValueBitCast(EvalInfo &Info, APValue &DestValue, return true; } +static bool handleLValueToRValueBitCast(EvalInfo &Info, APValue &DestValue, +APValue &SourceValue, +

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-04 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-04 Thread Richard Smith via cfe-commits
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *Ty, CharUnits Offset) { +SmallVector Bytes; +if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes)) + return std::nullopt;

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-03 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From f24c57fdd4e9cd3208c661d2f716c0251cff1c5e Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- .../include

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-03 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From c05ee51f4d930014ac7ff4adb7232ecdaceec7f9 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- .../include

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-03 Thread via cfe-commits
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *Ty, CharUnits Offset) { +SmallVector Bytes; +if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes)) + return std::nullopt;

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-10-01 Thread Richard Smith via cfe-commits
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *Ty, CharUnits Offset) { +SmallVector Bytes; +if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes)) + return std::nullopt;

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-29 Thread via cfe-commits
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *Ty, CharUnits Offset) { +SmallVector Bytes; +if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes)) + return std::nullopt;

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-29 Thread via cfe-commits
@@ -7095,6 +7157,22 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const VectorType *VTy = Ty->castAs(); + +APInt Bits; +if (!BitcastVectorToAPInt(Info, VTy, Val, Bits)) + retu

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *Ty, CharUnits Offset) { +SmallVector Bytes; +if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes)) + return std::nullopt;

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -2732,6 +2732,92 @@ static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E, return true; } +static bool BitcastAPIntToVector(EvalInfo &Info, const VectorType *VTy, + const llvm::APInt &SValInt, + Sm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -2732,6 +2732,92 @@ static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E, return true; } +static bool BitcastAPIntToVector(EvalInfo &Info, const VectorType *VTy, + const llvm::APInt &SValInt, + Sm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -7095,6 +7157,22 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const VectorType *VTy = Ty->castAs(); + +APInt Bits; +if (!BitcastVectorToAPInt(Info, VTy, Val, Bits)) + retu

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -2732,6 +2732,92 @@ static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E, return true; } +static bool BitcastAPIntToVector(EvalInfo &Info, const VectorType *VTy, + const llvm::APInt &SValInt, + Sm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter { return ArrayValue; } + std::optional visit(const VectorType *Ty, CharUnits Offset) { +SmallVector Bytes; +if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes)) + return std::nullopt;

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
@@ -2732,6 +2732,92 @@ static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E, return true; } +static bool BitcastAPIntToVector(EvalInfo &Info, const VectorType *VTy, + const llvm::APInt &SValInt, + Sm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
https://github.com/zygoloid commented: Thanks, I like the code reuse! There are some minor optimization and simplification opportunities in the code you're reusing that might be worth addressing now. I'm worried that vectors with padding (which I think is only vectors of x86 `long double`) ar

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-27 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-24 Thread via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-24 Thread via cfe-commits
@@ -463,3 +463,38 @@ static_assert(bit_cast(ld539) == fivehundredandthirtynine, ""); static_assert(round_trip<__int128_t>(34.0L)); #endif } + +namespace test_vector { + +typedef unsigned uint2 __attribute__((vector_size(2 * sizeof(unsigned; +typedef char byte8 __attribute_

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-24 Thread via cfe-commits
DaMatrix wrote: While attempting to make the result properly endianness-dependent, I noticed that `VectorExprEvaluator::VisitCastExpr` with `CK_BitCast` already had code for this which takes the byte ordering into account (although it also didn't handle bool vectors correctly either). I've now

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-24 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 8768741800aae37a825864e2ee782484ed073ce9 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- clang/lib/A

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-22 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-22 Thread via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-22 Thread via cfe-commits
https://github.com/DaMatrix edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-22 Thread via cfe-commits
@@ -463,3 +463,38 @@ static_assert(bit_cast(ld539) == fivehundredandthirtynine, ""); static_assert(round_trip<__int128_t>(34.0L)); #endif } + +namespace test_vector { + +typedef unsigned uint2 __attribute__((vector_size(2 * sizeof(unsigned; +typedef char byte8 __attribute_

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
@@ -463,3 +463,38 @@ static_assert(bit_cast(ld539) == fivehundredandthirtynine, ""); static_assert(round_trip<__int128_t>(34.0L)); #endif } + +namespace test_vector { + +typedef unsigned uint2 __attribute__((vector_size(2 * sizeof(unsigned; +typedef char byte8 __attribute_

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
@@ -463,3 +463,38 @@ static_assert(bit_cast(ld539) == fivehundredandthirtynine, ""); static_assert(round_trip<__int128_t>(34.0L)); #endif } + +namespace test_vector { + +typedef unsigned uint2 __attribute__((vector_size(2 * sizeof(unsigned; +typedef char byte8 __attribute_

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
@@ -7095,6 +7096,45 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 61f1f5f7325e7cfea8c04ad5c0dea0fdd8c96ab5 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- clang/lib/A

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
https://github.com/zygoloid resolved https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,45 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,40 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); +unsigned VectorLength = Val.getVectorLength(); + +if (VT->isExtVectorBoolType()) {

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
@@ -7095,6 +7096,21 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); + +CharUnits ElemWidth = Info.Ctx.getTypeSizeInChars(VT->getElementType()); +unsign

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From cb7e616dacc1afcdf3357a4a95278479a234be6d Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- clang/lib/A

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread Richard Smith via cfe-commits
https://github.com/zygoloid resolved https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-21 Thread via cfe-commits
https://github.com/DaMatrix updated https://github.com/llvm/llvm-project/pull/66894 >From 99d894e132468a7008e89aaab4847e16b4743bc7 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 2023 22:39:12 +0200 Subject: [PATCH] [clang] Implement constexpr bit_cast for vectors --- clang/lib/A

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-20 Thread Richard Smith via cfe-commits
https://github.com/zygoloid commented: Generally this looks good to me, but doesn't seem to properly handle `__attribute__((ext_vector_type(N))) bool`. https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-20 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/66894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-20 Thread Richard Smith via cfe-commits
@@ -7095,6 +7096,21 @@ class APValueToBufferConverter { return true; } + bool visitVector(const APValue &Val, QualType Ty, CharUnits Offset) { +const auto *VT = Ty->castAs(); + +CharUnits ElemWidth = Info.Ctx.getTypeSizeInChars(VT->getElementType()); +unsign

[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

2023-09-20 Thread via cfe-commits
https://github.com/DaMatrix created https://github.com/llvm/llvm-project/pull/66894 This makes __builtin_bit_cast support converting to and from vector types in a constexpr context. >From d4c7b67eff9997479712f1a25ebb162756d431c6 Mon Sep 17 00:00:00 2001 From: DaPorkchop_ Date: Sun, 13 Aug 202