[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    [RISC-V] built-in atomic function implementation involving RISC-V memory model
From:       Xuezheng Xu via Gcc <gcc () gcc ! gnu ! org>
Date:       2023-02-22 2:22:59
Message-ID: 6820af44.21f8.18676ee61b5.Coremail.xuezhengxu () 126 ! com
[Download RAW message or body]

Hi,

As stated in the comments of riscv_print_operand (the latest version of \
gcc/config/riscv/riscv.cc), the RISCV-specific operand code 'A', which is used in the \
implementation of 'atomic_cas_value_strong' in sync.md, is the atomic operation \
suffix for memory model OP.  However, only '.aq' is considered in the current \
implementation:




case 'A':

      if (riscv_memmodel_needs_amo_acquire ((enum memmodel) INTVAL (op)))

fputs (".aq", file);

      break;




Currently, we cannot add '.rl' to the function like \
atomic_compare_exchange_weak_release in glibc. 

I think we should also take '.rl' & '.aqrl' into consideration. The correct \
implementation in my understanding should be:




case 'A':

    if (riscv_memmodel_needs_amo_acquire_release ((enum memmodel) INTVAL (op)))

fputs (".aqrl", file);

    else if (riscv_memmodel_needs_amo_acquire ((enum memmodel) INTVAL (op)))

fputs (".aq", file);

    else if (riscv_memmodel_needs_amo_release ((enum memmodel) INTVAL (op)))

fputs (".rl", file);

    break;




Did I get it wrong? I'd appreciate it if you could explain it for me.




Thanks

Xuezheng


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic