Drea Pinski (pinskia) <[email protected]> requested changes to the code:


> +++ gcc/rust/backend/rust-compile-intrinsic.cc
> @@ -53,2 +53,4 @@
>       {IValue::ATOMIC_LOAD_RELAXED, handlers::atomic_load (__ATOMIC_RELAXED)},
>       {IValue::ATOMIC_LOAD_UNORDERED, handlers::atomic_load 
> (__ATOMIC_RELAXED)},
> +     {IValue::ATOMIC_EXCHANGE_SEQCST,
> +      handlers::atomic_exchange (__ATOMIC_SEQ_CST)},
I know this is an existing issue but using the host constant 
__ATOMIC_SEQ_CST/__ATOMIC_RELAXED is wrong here.
memmodel.h and MEMMODEL_* enum should be used instead.

> +++ gcc/rust/backend/rust-intrinsic-handlers.cc
> @@ -749,2 +749,4 @@
>  }
>  
> +tree
> +atomic_exchange (Context *ctx, TyTy::FnType *fntype, int ordering)
ordering should really be called model. And use enum memmodel instead of int.

> +++ gcc/rust/backend/rust-intrinsic-handlers.cc
> @@ -751,0 +778,4 @@
> +  TREE_READONLY (dst) = 0;
> +
> +  auto value = Backend::var_expression (param_vars[1], UNDEF_LOCATION);
> +  auto memorder = make_unsigned_long_tree (ordering);
I thought it is an int rather than a long for the memory model.

> +++ gcc/rust/backend/rust-intrinsic-handlers.cc
> @@ -1070,2 +1135,4 @@
>  }
>  
> +HandlerBuilder
> +atomic_exchange (int ordering)
As mentioned `enum memmodel` but that is an existing issue it seems.


--
https://forge.sourceware.org/gcc/gcc-TEST/pulls/161#issuecomment-6092

Reply via email to