On Wed, May 29, 2019 at 03:48:29PM +0100, Srinath Parvathaneni wrote: > Hi All, > > This patch implements the __yield(), __wfe(), __wfi(), __sev() and > __sevl() ACLE (hint) intrinsics for AArch64 as yield, wfe, wfi, sev and > sevl (hint) instructions respectively. > > The instructions are documented in the ArmARM[1] and the intrinsics > specification are published on the Arm website [2]. > > [1] > https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile > [2] > https://developer.arm.com/docs/ihi0053/latest/arm-c-language-extensions-21-architecture-specification > > Bootstrapped on aarch64-none-linux-gnu and regression tested on > aarch64-none-elf with no regressions. > > Ok for trunk? If ok, could someone please commit the patch on my behalf, > I don't have commit rights.
I can't tell from the documentation, is this the expected behaviour? $ cat yield.c #include "arm_acle.h" int foo (int* counter) { *counter = 5; __yield(); *counter = 5; __yield(); *counter = 5; __yield(); *counter = 5; __yield(); } $ gcc -O2 yield.c foo: mov w1, 5 str w1, [x0] yield yield yield yield ret i.e. should we expect the memory writes to be considered dead and eliminated, or should they live over the __yield. I have similar questions as to whether GCC's unspec_volatile actually implements the required semantics from the ACLE. Thanks, James > > Thanks, > Srinath > > gcc/ChangeLog: > > 2019-05-29 Srinath Parvathaneni <srinath.parvathan...@arm.com> > > * config/aarch64/aarch64.md (UNSPECV_YIELD): New volatile unspec. > (UNSPECV_WFE): Likewise. > (UNSPECV_WFI): Likewise. > (UNSPECV_SEV): Likewise. > (UNSPECV_SEVL): Likewise. > (yield): New pattern name. > (wfe): Likewise. > (wfi): Likewise. > (sev): Likewise. > (sevl): Likewise. > * config/aarch64/aarch64-builtins.c (aarch64_builtins): > AARCH64_BUILTIN_YIELD: New builtin. > AARCH64_BUILTIN_WFE: Likewise. > AARCH64_BUILTIN_WFI: Likewise. > AARCH64_BUILTIN_SEV: Likewise. > AARCH64_BUILTIN_SEVL: Likewise. > (aarch64_init_syshintop_builtins): New function. > (aarch64_init_builtins): New call statement. > (aarch64_expand_builtin): New case. > * config/aarch64/arm_acle.h (__yield): New inline function. > (__sev): Likewise. > (__sevl): Likewise. > (__wfi): Likewise. > (__wfe): Likewise. > > gcc/testsuite/ChangeLog: > > 2019-05-29 Srinath Parvathaneni <srinath.parvathan...@arm.com> > > * gcc.target/aarch64/acle/hint-1.c: New test. >