[PATCH] D143287: [Clang][X86] Change X86 cast intrinsics to use __builtin_nondeterministic_value
Nuno Lopes via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 18 02:58:56 PDT 2023
nlopes added a comment.
In D143287#4202174 <https://reviews.llvm.org/D143287#4202174>, @ManuelJBrito wrote:
> Implementing the 128 to 512 casts by filling the rest of the vector with the same definition of a nondeterministic_value is not correct because :
>
> a = freeze poison
> v = <a, a>
>
> is not the same as
>
> v = freeze poison
>
> The only solution I'm seeing ,using the shufflevector, is doing the conversion in two steps:
>
> - build a 256 vector with the upper half being undefined( freeze poison)
> - build a 512 vector where the lower half is the previous 256 vector and the upper half being undefined
>
> I think this would require two shuffles which is unfortunate.
>
> This would ensure no miscompilations due to multiple uses of the same freeze undef/poison but would probably require some backend work to ensure the pattern is recognized to emit efficient assembly.
Semantically that is correct.
But the backend may require some tweaks to recognize this pattern.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143287/new/
https://reviews.llvm.org/D143287
More information about the cfe-commits
mailing list