nvptx handles vector modes in CLZ/CTZ value checking.
nvptx backend now correctly processes vector modes for count-leading/trailing zeros value checks.
The nvptx backend for GCC now correctly handles vector modes when checking for defined values at zero in CLZ_DEFINED_VALUE_AT_ZERO and CTZ_DEFINED_VALUE_AT_ZERO macros. This ensures consistent behavior with other backends that were updated to look through vector modes for these checks.
This change improves the correctness and portability of vector operations on the NVPTX architecture by ensuring that vector data types are properly interpreted in these specific macro contexts.
In Details
The CLZ_DEFINED_VALUE_AT_ZERO and CTZ_DEFINED_VALUE_AT_ZERO macros in config/nvptx/nvptx.h are used to check if a value is zero, specifically in the context of count-leading-zeros (CLZ) and count-trailing-zeros (CTZ) operations. Recent changes in GCC's core compiler (e.g., r17-5047-gd2e1b1248a17d0) introduced the passing of vector modes to these macros. Subsequent commits (r17-5062-g6ae2ad3169a, r17-5063-g3a4df843f91) adjusted behavior for pru and vax backends to correctly handle these vector modes by looking through them. This patch applies the same logic to the nvptx backe…
- nvptx
- A GCC target backend for NVIDIA's Parallel Thread Execution (PTX) virtual instruction set architecture, used for programming NVIDIA GPUs.
- Vector modes
- Representations within GCC that describe operations or data types involving multiple elements processed in parallel, such as SIMD or vector registers.
- CLZ_DEFINED_VALUE_AT_ZERO
- A macro that checks if a value, potentially within a vector context, is equal to zero, often used in conjunction with count-leading-zeros operations.
- CTZ_DEFINED_VALUE_AT_ZERO
- A macro that checks if a value, potentially within a vector context, is equal to zero, often used in conjunction with count-trailing-zeros operations.
- Count-leading-zeros (CLZ)
- An operation that counts the number of zero bits from the most significant bit up to the first set bit in a binary number.
- Count-trailing-zeros (CTZ)
- An operation that counts the number of zero bits from the least significant bit up to the first set bit in a binary number.