20 Commits

Author SHA1 Message Date
Timm Baeder
607f19cb94
[clang][Interp] Fix float->int casts overflowing (#72658)
If S.noteUndefinedBehavior() returns true, we will continue evaluation
and need a value on the stack.
2023-12-11 17:25:03 +01:00
Timm Bäder
4b5fe9c42d [clang][Interp] Check floating results for NaNs
Differential Revision: https://reviews.llvm.org/D156506
2023-09-11 12:21:36 +02:00
Timm Bäder
adb1fb40e8 [clang][Interp] Handle mixed floating/integral compound assign operators
Differential Revision: https://reviews.llvm.org/D157596
2023-09-05 12:10:00 +02:00
Douglas Yung
a0db738504 [clang][Interp] Add missing static_assert messages 2023-08-21 20:28:39 -07:00
Timm Bäder
cf10061da7 [clang][Interp] Fully serialize Floating values to bytes
The Floating class wraps a APFloat, which might heap allocate memory to
represent large floating values. When writing those to bytecode, we
would free() the heap allocation after writing, when destroying the
actual APFloat we wrote.

Fix this by seralizing a Floating as Semantics + APInt.

This will be neccessary in more cases later, when we support
arbitrary-precision integers or _BitInt.

Differential Revision: https://reviews.llvm.org/D155165
2023-08-17 12:41:39 +02:00
Timm Bäder
9a0164a0c6 [clang][Interp] Fix comparing nan/inf floating point values
Differential Revision: https://reviews.llvm.org/D155410
2023-07-28 11:12:25 +02:00
Timm Bäder
cf70e89a8d [clang][Interp] Provide required c++14 warnings
This doesn't show up in standards after c++14.
2023-07-20 16:39:54 +02:00
Timm Bäder
a1c0e3be6f [clang][Interp] Fix compound assign operator evaluation order
We need to evaluated the RHS before the LHS.

Differential Revision: https://reviews.llvm.org/D149550
2023-07-20 15:58:01 +02:00
Timm Bäder
af67614f79 [clang][Interp] Call dtor of Floating values
The APFloat might heap-allocate some memory, so we need to call its
destructor.

Differential Revision: https://reviews.llvm.org/D154928
2023-07-20 15:27:16 +02:00
Timm Bäder
6ccf3307f4 [clang][Interp] Add missing static_assert messages 2023-05-04 09:10:21 +02:00
Timm Bäder
338c2489f6 [clang][Interp] Implement inc/dec operators for floats
Differential Revision: https://reviews.llvm.org/D149634
2023-05-04 08:52:53 +02:00
Timm Bäder
7d9511b2e3 [clang][Interp] Add missing static_assert messages
This broke build bots, e.g:
https://lab.llvm.org/buildbot/#/builders/139/builds/38697
2023-04-06 12:03:45 +02:00
Timm Bäder
70e5a2a943 [clang][Interp] Fix zero-initializing of floating types
Differential Revision: https://reviews.llvm.org/D146788
2023-04-06 10:52:01 +02:00
Timm Bäder
814177e434 Revert "[clang][Interp][NFC] Add tests for __fp16"
This reverts commit 0691bcb18024a28e82e8dd9a08ab0820b40c9a37.

Looks like this breaks builders, e.g.
https://lab.llvm.org/buildbot#builders/231/builds/9790
2023-03-23 10:33:51 +01:00
Timm Bäder
0691bcb180 [clang][Interp][NFC] Add tests for __fp16
Differential Revision: https://reviews.llvm.org/D146436
2023-03-23 10:08:34 +01:00
Timm Bäder
af3a171dcf [clang][Interp] Compound assign operators for FP values
Differential Revision: https://reviews.llvm.org/D140377
2023-01-25 16:25:04 +01:00
Timm Bäder
611a748b22 [clang][Interp] Add empty messages to static_asserts
To satisfy builders:
https://lab.llvm.org/buildbot/#/builders/216/builds/16264
2023-01-25 15:20:46 +01:00
Timm Bäder
cb7f582211 Re-apply "[clang][Interp] Support floating-point values"
Don't move the Repr struct into Integral this time.

Differential Revision: https://reviews.llvm.org/D134859
2023-01-25 15:13:09 +01:00
Timm Bäder
b3b1d86137 Revert "[clang][Interp] Support floating-point values"
This reverts commit 62f43c3eae2460d4ca3da7897fd2d7c56920638c.

This breaks a couple of builders, e.g.

https://lab.llvm.org/buildbot/#/builders/139/builds/34925
2023-01-25 14:48:39 +01:00
Timm Bäder
62f43c3eae [clang][Interp] Support floating-point values
Add a new Floating type and a few new opcodes to support floating point
values.

Differential Revision: https://reviews.llvm.org/D134859
2023-01-25 14:41:26 +01:00