[all-commits] [llvm/llvm-project] dcb3e8: [Hexagon] Make conversions to vector predicate typ...
Krzysztof Parzyszek via All-commits
all-commits at lists.llvm.org
Wed Dec 22 12:52:48 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dcb3e8083a3229b44e23d5d1c19453f0777f3aa2
https://github.com/llvm/llvm-project/commit/dcb3e8083a3229b44e23d5d1c19453f0777f3aa2
Author: Krzysztof Parzyszek <kparzysz at quicinc.com>
Date: 2021-12-22 (Wed, 22 Dec 2021)
Changed paths:
M clang/include/clang/Basic/BuiltinsHexagonMapCustomDep.def
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/Headers/hvx_hexagon_protos.h
M clang/test/CodeGen/builtins-hexagon-v66-128B.c
M clang/test/CodeGen/builtins-hexagon-v66.c
M clang/test/CodeGen/builtins-hvx128.c
M clang/test/CodeGen/builtins-hvx64.c
M llvm/include/llvm/IR/IntrinsicsHexagonDep.td
Log Message:
-----------
[Hexagon] Make conversions to vector predicate types explicit for builtins
HVX does not have load/store instructions for vector predicates (i.e. bool
vectors). Because of that, vector predicates need to be converted to another
type before being stored, and the most convenient representation is an HVX
vector.
As a consequence, in C/C++, source-level builtins that either take or
produce vector predicates take or return regular vectors instead. On the
other hand, the corresponding LLVM intrinsics do have boolean types that,
and so a conversion of the operand or the return value was necessary.
This conversion would happen inside clang's codegen, but was somewhat
fragile.
This patch changes the strategy: a builtin that takes a vector predicate
now really expects a vector predicate. Since such a predicate cannot be
provided via a variable, this builtin must be composed with other builtins
that either convert vector to a predicate (V6_vandvrt) or predicate to a
vector (V6_vandqrt).
For users using builtins defined in hvx_hexagon_protos.h there is no impact:
the conversions were added to that file. Other users will need to insert
- __builtin_HEXAGON_V6_vandvrt[_128B](V, -1) to convert vector V to a
vector predicate, or
- __builtin_HEXAGON_V6_vandqrt[_128B](Q, -1) to convert vector predicate Q
to a vector.
Builtins __builtin_HEXAGON_V6_vmaskedstore.* are a temporary exception to
that, but they are deprecated and should not be used anyway. In the future
they will either follow the same rule, or be removed.
More information about the All-commits
mailing list