TCE target nonconforming definition of long long and intmax_t

Pekka Jääskeläinen via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 7 23:20:38 PST 2021


Hi Aaron,

Indeed the 32b TCE target is not fully compliant in this aspect;
its 64b emulation support is not complete, therefore we advertise
only these 32b limits. We have an in-progress 64b target where the
limits are 64b, but it's not upstreamed yet.

Yes, TCE target is still maintained, but it's a special target since
it has target-specific backend phases off-tree for online retargeting 
and pecularities of the TTA scheduling. Thus, I'd just leave it as
is for the 32b target and we'll upstream the 64b stub as soon as
it stabilizes a bit.

BR,
Pekka

On 7.12.2021 16.59, Aaron Ballman wrote:
> Hello! I was digging around in stdint.h to do some implementation work
> on C2x and I noticed that the TCE target seems to be nonconforming.
> 
> In C17, the implementation limits for intmax_t and uintmax_t are
> specified by 7.20.2.5 as:
> 
> — minimum value of greatest-width signed integer type
> INTMAX_MIN -(2^63 - 1)
> — maximum value of greatest-width signed integer type
> INTMAX_MAX 2^63 - 1
> — maximum value of greatest-width unsigned integer type
> UINTMAX_MAX 2^64 - 1
> 
> Similarly, the implementation limits for long long and unsigned long
> long are specified by 5.2.4.2.1p1:
> 
> minimum value for an object of type long long int
> LLONG_MIN -9223372036854775807 // -(2^63 - 1)
> — maximum value for an object of type long long int
> LLONG_MAX +9223372036854775807 // 2^63 - 1
> — maximum value for an object of type unsigned long long int
> ULLONG_MAX 18446744073709551615 // 2^64 - 1
> 
> However, the TCE target appears to set these to 32-bit limits, not
> 64-bit limits:
> 
> https://github.com/llvm/llvm-project/blob/2ab513cd3e0648806db7ed1f8170ad4a3d4e7749/clang/lib/Basic/Targets/TCE.h#L61
> 
> Is this target still being maintained? If so, what should be done
> here? (I can file a bug report about this once we have a bug database
> that can accept new content so we don't lose track of this.)
> 
> Thanks!
> 
> ~Aaron
> 

-- 
Pekka


More information about the cfe-commits mailing list