[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits ma

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread LLVM Continuous Integration via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-darwin` running on `doug-worker-3` while building `clang` a

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: https://github.com/AaronBallman approved this pull request. LGTM with a bit of extra test coverage https://github.com/llvm/llvm-project/pull/112126 __

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: tbaederr wrote: Just tested this on a big-endian host again, no problems found. https://github.com/llvm/llvm-project/pul

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 3e028394eb4f3ce9796359e3122cbc86270e43f1 Mon Sep 17 00

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -0,0 +1,399 @@ +// RUN: %clang_cc1 -verify=ref,both -std=c++2a -fsyntax-only %s +// RUN: %clang_cc1 -verify=ref,both -std=c++2a -fsyntax-only -triple a

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-31 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commit

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -154,6 +154,18 @@ template class Integral final { return Compare(V, RHS.V); } + void bitcastToMemory(std::byte *Dest) const { +std::memcpy(Dest, &V, sizeof(V)); + } + + static Integra

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 3e028394eb4f3ce9796359e3122cbc86270e43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 3e028394eb4f3ce9796359e3122cbc86270e43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= D

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 3e028394eb4f3ce9796359e3122cbc86270e43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: tbaederr wrote: > such as derived classes, Got me again :disappointed: https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commit

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -0,0 +1,399 @@ +// RUN: %clang_cc1 -verify=ref,both -std=c++2a -fsyntax-only %s +// RUN: %clang_cc1 -verify=ref,both -std=c++2a -fsyntax-only -triple aarch64_be-linux-gnu %s +// RUN: %clang_cc1 -verify

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -0,0 +1,399 @@ +// RUN: %clang_cc1 -verify=ref,both -std=c++2a -fsyntax-only %s +// RUN: %clang_cc1 -verify=ref,both -std=c++2a -fsyntax-only -triple aarch64_be-linux-gnu %s +// RUN: %clang_cc1 -verify

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/AaronBallman commented: This generally LGTM, but I'd like to see some tests for slightly more complicated situations, such as derived classes, classes with reference members, bitcasting a class with a

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: AaronBallman wrote: There's a valid precommit CI failure: ``` TEST 'Clang :: AST/ByteCode/builtin-bit-cast.cpp' FAILED Exit Code: 1 Command Output (stdout): -- # RUN: at line 1 c:\ws\src\build\bin\clang.

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 3e028394eb4f3ce9796359e3122cbc86270e43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PAT

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 3e028394eb4f3ce9796359e3122cbc86270e43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-20 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 81d236ada5a300f425de447d5802714af65c98f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 1cf8a3bd76adfd5595c000e2ad86fb1db5b96a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= D

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 1cf8a3bd76adfd5595c000e2ad86fb1db5b96a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= D

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 1cf8a3bd76adfd5595c000e2ad86fb1db5b96a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= D

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 1cf8a3bd76adfd5595c000e2ad86fb1db5b96a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PAT

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
tbaederr wrote: Also, I've removed the logic for tracking uninitialized/indeterminate bits for now since it can be added later. https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
tbaederr wrote: Victory! 1) Iterate composite fields backwards for big-endian targets 2) Fix `BitcatBuffer::data()` pointing to the wrong byte if the number of bytes in the buffer is not a multiple of `sizeof(uint64_t)` (which is what `llvm::BitBuffer` uses internally) and we're on a big-end

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr ready_for_review https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-16 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 1cf8a3bd76adfd5595c000e2ad86fb1db5b96a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-15 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: tbaederr wrote: Marking this as a draft until I have fixed things on big-endian hosts. https://github.com/llvm/llvm-project/pull/112126

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-15 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr converted_to_draft https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-15 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From f245dbdc7288e6690f8d484cf984069f3970c3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= D

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Erich Keane via cfe-commits
@@ -6400,6 +6403,67 @@ bool Compiler::emitDestruction(const Descriptor *Desc, return this->emitRecordDestruction(Desc->ElemRecord, Loc); } +// This function is constexpr if and only if To, From, and the types of +// all subobjects of To and From are types T such that... +

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Erich Keane via cfe-commits
@@ -81,6 +81,14 @@ class Boolean final { Boolean truncate(unsigned TruncBits) const { return *this; } + static Boolean bitcastFromMemory(const std::byte *Buff, unsigned BitWidth) { +assert(BitWidth == 8); erichkeane wrote: Perhaps a `//FIXME: ` here.

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Erich Keane via cfe-commits
@@ -6400,6 +6403,67 @@ bool Compiler::emitDestruction(const Descriptor *Desc, return this->emitRecordDestruction(Desc->ElemRecord, Loc); } +// This function is constexpr if and only if To, From, and the types of +// all subobjects of To and From are types T such that... +

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Implementation seems reasonable to me, a couple of nits (and please make more detailed asserts for everything!), though I haven't paid attention to these reviews in long enough someone else should take a look. https://github.com/llvm/llvm-project/pull/1

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 113f583cada40dd55804a7174aaef2a239c39951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-14 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 6c461a3e463459d8b1b24351f5a74f942aac21d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-13 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 17c346706a58342097170bdfac0aabd8c095994e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-13 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 4eedfc2870d66c3581d78bc4963ec3999b4ce4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-13 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/112126 >From 6e692d50d9151c4d76518229da101834f449c93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 13 Oct 2024 08:57:48 +0200 Subject: [PATCH] [clang][bytecode] Start implementing __builtin_

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-13 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/112126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-13 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) Changes This is a subset of #68288, with hopefully narrower scope. It does not support bitcasting to non-integral types yet. The tests are from #68288 and partially from #74775. The `BitcastBuffer` struct is curren

[clang] [clang][bytecode] Start implementing __builtin_bit_cast (PR #112126)

2024-10-13 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/112126 This is a subset of #68288, with hopefully narrower scope. It does not support bitcasting to non-integral types yet. The tests are from #68288 and partially from #74775. The `BitcastBuffer` struct is currentl