Xin Wang <[email protected]> writes:
> From: Xin Wang <[email protected]>
>
> The use of UOItype with mode(OI) for 16-byte atomic operations is
> non-standard. The OI mode is not defined in machmode.def and exists
> only as an ad-hoc construct in libgcc/sync.c.
>
> This patch replaces it with UTItype using mode(TI), which is the
> standard GCC machine mode for 16-byte integers (Tetra Integer).
> The size argument is also corrected from 8 to 16 to match the actual
> operand width.
>
> libgcc/ChangeLog:
> * sync.c: Replace UOItype with UTItype and use mode(TI) pass 16, not
> 8, to DEFINE macro.

Sorry for the slow reply.  I no longer have access to my @arm.com
account and didn't see this message till today.

I'd completely forgotten that I wrote this code.  Like you say,
the 16-byte entry is clearly wrong (in two ways).  The fact that the
byte count was wrong suggests that no-one was relying on the buggy
version.  MIPS remains the only in-tree target to define SYNC to yes.

Since the patch was posted in stage 3, I think it should go in for GCC 16.

Pushed to trunk, thanks.

Richard

>
> Signed-off-by: Xin Wang <[email protected]>
> ---
>  libgcc/sync.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/libgcc/sync.c b/libgcc/sync.c
> index f2d35ecf1e0..55ea4ba8ccc 100644
> --- a/libgcc/sync.c
> +++ b/libgcc/sync.c
> @@ -124,10 +124,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
>  If not, see
>  
>  /* Find an appropriate type TYPE for SIZE and invoke DEFINE (FN, SIZE, TYPE).
>  
> -   The types chosen here may be incorrect for some targets.
> -   For example, targets with 16-byte atomicity support might not
> -   support OImode.  We would need some kind of target-specific
> -   override if that becomes a problem.  */
> +   The types chosen here are based on standard GCC modes.
> +   If a target supports atomic operations for a given SIZE but lacks
> +   the corresponding mode, a target-specific override will be needed.  */
>  
>  #if SIZE == 1 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
>  
> @@ -151,8 +150,8 @@ DEFINE (FN, 8, UDItype)
>  
>  #elif SIZE == 16 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
>  
> -typedef unsigned int UOItype __attribute__((mode (OI)));
> -DEFINE (FN, 8, UOItype)
> +typedef unsigned int UTItype __attribute__((mode (TI)));
> +DEFINE (FN, 16, UTItype)
>  
>  #endif

Reply via email to