Timm Baeder
d67951694b
[clang][bytecode] Support overlapping regions in __builtin_memmove ( #132523 )
...
Unfortunately, a few circumstances make the implementation here less
than ideal, but we need to handle overlapping regions anyway.
2025-03-22 07:12:27 +01:00
Sarah Spall
f9568e8d23
[HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. ( #123977 )
...
Make the memory representation of boolean vectors in HLSL, vectors of
i32.
Allow boolean swizzling for boolean vectors in HLSL.
Add tests for boolean vectors and boolean vector swizzling.
Closes #91639
2025-03-11 13:54:09 -07:00
Timm Baeder
cfe26358e3
Reapply "[clang] Avoid re-evaluating field bitwidth" ( #122289 )
2025-01-11 07:12:37 +01:00
Timm Bäder
59bdea24b0
Revert "[clang] Avoid re-evaluating field bitwidth ( #117732 )"
...
This reverts commit 81fc3add1e627c23b7270fe2739cdacc09063e54.
This breaks some LLDB tests, e.g.
SymbolFile/DWARF/x86/no_unique_address-with-bitfields.cpp:
lldb: ../llvm-project/clang/lib/AST/Decl.cpp:4604: unsigned int clang::FieldDecl::getBitWidthValue() const: Assertion `isa<ConstantExpr>(getBitWidth())' failed.
2025-01-08 15:09:52 +01:00
Timm Baeder
81fc3add1e
[clang] Avoid re-evaluating field bitwidth ( #117732 )
...
Save the bitwidth value as a `ConstantExpr` with the value set. Remove
the `ASTContext` parameter from `getBitWidthValue()`, so the latter
simply returns the value from the `ConstantExpr` instead of
constant-evaluating the bitwidth expression every time it is called.
2025-01-08 14:45:19 +01:00
Timm Baeder
d5c8af492f
[clang][bytecode] Consider start index when copying composite array ( #121461 )
...
... elements.
2025-01-02 10:31:49 +01:00
Timm Baeder
1f2d934525
[clang][bytecode] Support pointers in __builtin_mem{move,cpy} ( #120560 )
...
Unfortunately, that means we can't use the __builtin_bit_cast
implementation for this.
2024-12-19 16:38:58 +01:00
Timm Baeder
30cbd09f4b
[clang][bytecode] Fix memcmp/bcmp failures on big-endian hosts ( #119851 )
...
See the discussion in
https://github.com/llvm/llvm-project/pull/119678#issuecomment-2539680746
and
https://github.com/llvm/llvm-project/pull/119544#issuecomment-2539678561
2024-12-13 12:19:27 +01:00
Timm Baeder
8713914d76
[clang][bytecode] Handle __builtin_memcmp ( #119544 )
2024-12-12 08:59:35 +01:00
Timm Baeder
74393f3da0
[clang][bytecode][NFC] Avoid calling ASTContext::getTypeSize() ( #119392 )
...
In the case of primitive arrays, we can do this once and reuse the value
for all elements.
2024-12-11 09:45:22 +01:00
Timm Baeder
0fb06172f1
[clang][bytecode] Check vector element types for eligibility ( #119385 )
...
Like we do in ExprConstant.cpp.
2024-12-10 17:56:48 +01:00
Timm Baeder
1fbbf4c418
[clang][bytecode] Pass (float) BitWidth to DoBitCast ( #119119 )
...
In certain cases (i.e. long double on x86), the bit with we get from the
floating point semantics is different than the type size we compute for
the BitCast instruction. Pass this along to DoBitCast, so in there we
can check only the relevant bits for being initialized.
This also fixes a weirdness we still had in DoBitCast.
2024-12-08 18:54:08 +01:00
Timm Bäder
416e4cd332
[clang][bytecode][NFC] Remove leftover debug output
2024-12-07 13:56:37 +01:00
Timm Baeder
b4150ed128
[clang][bytecode] Check composite bitcasts for indeterminate bits ( #118988 )
2024-12-07 13:06:00 +01:00
Timm Baeder
2f9cd43a73
[clang][bytecode] Check primitive bit casts for indeterminate bits ( #118954 )
...
Record bits ranges of initialized bits and check them in
allInitialized().
2024-12-06 15:50:59 +01:00
Timm Baeder
b6217f67a4
[clang][bytecode] Fix bitcasting from null pointers ( #116999 )
2024-12-05 13:13:59 +01:00
Timm Baeder
abc27039be
[clang][bytecode] Pass __builtin_memcpy size along ( #118649 )
...
To DoBitCastPtr, so we know how many bytes we want to read.
2024-12-05 06:55:18 +01:00
Timm Baeder
7aec6dc477
[clang][bytecode] Initialize bases when bitcasting ( #117179 )
...
Base pointers do not get passed to the callback, so initialize them when iterating bases.
2024-12-04 16:49:03 +01:00
Timm Bäder
12ca72ba7f
Reapply "[clang][bytecode] Handle bitcasts involving bitfields ( #116843 )"
...
This reverts commit 54db16221c92eb52efbea90ad5b5d2a1d00cda3e.
Check for existence of __SIZOEF_INT128__ so we don't run those
tests on targets that don't have int128.
2024-12-04 11:53:37 +01:00
Timm Bäder
54db16221c
Revert "[clang][bytecode] Handle bitcasts involving bitfields ( #116843 )"
...
This reverts commit 4b5e7fa4de54e00df007ae5e2675393fd046aa59.
This breaks builders:
https://lab.llvm.org/buildbot/#/builders/154/builds/8464
I guess some more testing on 32 bit hosts is needed.
2024-12-04 11:43:43 +01:00
Timm Baeder
4b5e7fa4de
[clang][bytecode] Handle bitcasts involving bitfields ( #116843 )
...
Copy the data one bit at a time, leaving optimizations for future work.
Adds a BitcastBuffer that takes care of pushing the bits in the right
order.
2024-12-04 11:25:04 +01:00
Timm Baeder
476b208e01
[clang][bytecode] Fix ToType/FromType diagnostic ordering ( #116988 )
...
We need to check the ToType first, then the FromType. Additionally,
remove qualifiers from the parent type of the field we're emitting a
note for.
2024-11-21 07:54:38 +01:00
Kazu Hirata
dec6324cb0
[AST] Remove unused includes (NFC) ( #116549 )
...
Identified with misc-include-cleaner.
2024-11-17 09:36:48 -08:00
Timm Baeder
1b3da362c5
[clang][bytecode] Fix bitcasting packed bool vectors ( #114937 )
...
This is a special case we need to handle. We don't do bitcasting _into_
such vectors yet though.
2024-11-05 11:43:09 +01:00
Timm Baeder
2f13fbfcd1
[clang][bytecode] Support bitcasting into float fields ( #114825 )
2024-11-05 05:52:03 +01:00
Timm Baeder
1f55d77189
[clang][bytecode][NFC] Remove unused parameter from pushData() ( #114801 )
2024-11-04 17:14:05 +01:00
Timm Baeder
3268d51a5c
[clang][bytecode][NFC] Fix a possible build warning ( #114800 )
...
InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not
return a value in all control paths [-Wreturn-type]
95 | }
| ^
1 warning generated.
2024-11-04 16:58:44 +01:00
Timm Baeder
2588b8be56
[clang][bytecode] Implement bitcasts to composite types ( #114776 )
...
Only fixed-size, non-bitfield integral fields for now.
2024-11-04 15:10:10 +01:00
Timm Baeder
fb30208d1e
[clang][bytecode][NFC] Make Floating::bitcastToMemory const ( #114777 )
...
The other functions like this are also const.
2024-11-04 14:00:24 +01:00
Timm Baeder
5b32c5954b
[clang][bytecode] Implement bitcasts to floating-point values ( #114485 ) ( #114712 )
...
This time I tested on big-endian hosts.
2024-11-03 19:42:26 +01:00
Timm Baeder
88823d08ab
[clang][bytecode][NFC] Switch BitcastBuffer to SmallVector ( #114677 )
...
This is a little easier to work with since we are guaranteed that the
item type of the vector is byte sized and not something else.
2024-11-03 11:16:59 +01:00
Timm Baeder
ef2a104c94
[clang][bytecode] Start implementing __builtin_bit_cast ( #112126 )
...
This is a subset of #68288 , with hopefully narrower scope. It does not
support bitcasting to non-integral types yet.
Bitfields are supported, but only if they result in a full byte-sized
final buffer. It does not support casting from null-pointers yet or
casting from indeterminate bits.
The tests are from #68288 and partially from #74775 .
The `BitcastBuffer` struct is currently always working in single bits,
but I plan to (try to) optimize this for the common full-byte case.
2024-10-31 18:09:40 +01:00