Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On 12/02/15 18:38, Mike Stump wrote: On Feb 11, 2015, at 12:16 PM, Torvald Riegel wrote: On Mon, 2015-02-09 at 09:10 -0800, Mike Stump wrote: On Feb 9, 2015, at 7:11 AM, Alex Velenko wrote: The following patch makes atomic-op-consume.c XFAIL Is this patch ok? Ok. I’d shorten the comment above the xfail to be exceedingly short: /* PR59448 consume not implemented yet */ The reason is the brain can process this about 8x faster. Also, one can cut and paste the PR part into a web browser directly, or, if you have an electric bugzilla mode for emacs, it will pop right up. */ Given the discussions we had in ISO C++ SG1, it seems the only way to fix memory_order_consume is to deprecate it (or let it rot forever), and add something else to the standard. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4321.pdf Nice paper, thanks. IOW, I believe the promotion is here to stay. I'm not aware of any other implementation doing something else. Thus, XFAIL doesn't seem right to me. Since Jakub in PR64930 updated to the now expected output instead of xfail, and given the paper above, easy to agree with this. The changes to remove the xfail and expect the now expected codegen are pre-approved. Hi Mike, As pre-approved trivial change, on Monday I commited the following patch: gcc/testsuite/ 2015-02-16 Alex Velenko * gcc.target/aarch64/atomic-op-consume.c (scan-assember-times): Directive adjusted to scan for ldaxr. * gcc.target/arm/atomic-op-consume.c (scan-assember-times): Directive adjusted to scan for ldaex. diff --git a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c index 0e6dbbe..26ebbdf 100644 --- a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c +++ b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c @@ -3,6 +3,6 @@ #include "atomic-op-consume.x" -/* PR59448 consume not implemented yet. */ -/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 { xfail *-*-* } } } */ +/* Scan for ldaxr is a PR59448 consume workaround. */ +/* { dg-final { scan-assembler-times "ldaxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ /* { dg-final { scan-assembler-times "stxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-consume.c b/gcc/testsuite/gcc.target/arm/atomic-op-consume.c index fafe4d6..6c5f989 100644 --- a/gcc/testsuite/gcc.target/arm/atomic-op-consume.c +++ b/gcc/testsuite/gcc.target/arm/atomic-op-consume.c @@ -5,7 +5,7 @@ #include "../aarch64/atomic-op-consume.x" -/* PR59448 consume not implemented yet. */ -/* { dg-final { scan-assembler-times "ldrex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 { xfail *-*-* } } } */ +/* Scan for ldaex is a PR59448 consume workaround. */ +/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */ /* { dg-final { scan-assembler-times "strex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */ /* { dg-final { scan-assembler-not "dmb" } } */
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Feb 11, 2015, at 12:16 PM, Torvald Riegel wrote: > On Mon, 2015-02-09 at 09:10 -0800, Mike Stump wrote: >> On Feb 9, 2015, at 7:11 AM, Alex Velenko wrote: >>> The following patch makes atomic-op-consume.c XFAIL >>> >>> Is this patch ok? >> >> Ok. >> >> I’d shorten the comment above the xfail to be exceedingly short: >> >> /* PR59448 consume not implemented yet */ >> >> The reason is the brain can process this about 8x faster. Also, one can cut >> and paste the PR part into a web browser directly, or, if you have an >> electric bugzilla mode for emacs, it will pop right up. */ > > Given the discussions we had in ISO C++ SG1, it seems the only way to > fix memory_order_consume is to deprecate it (or let it rot forever), and > add something else to the standard. See > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4321.pdf Nice paper, thanks. > IOW, I believe the promotion is here to stay. I'm not aware of any > other implementation doing something else. > > Thus, XFAIL doesn't seem right to me. Since Jakub in PR64930 updated to the now expected output instead of xfail, and given the paper above, easy to agree with this. The changes to remove the xfail and expect the now expected codegen are pre-approved.
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Mon, 2015-02-09 at 09:10 -0800, Mike Stump wrote: > On Feb 9, 2015, at 7:11 AM, Alex Velenko wrote: > > The following patch makes atomic-op-consume.c XFAIL > > > > Is this patch ok? > > Ok. > > I’d shorten the comment above the xfail to be exceedingly short: > > /* PR59448 consume not implemented yet */ > > The reason is the brain can process this about 8x faster. Also, one can cut > and paste the PR part into a web browser directly, or, if you have an > electric bugzilla mode for emacs, it will pop right up. */ Given the discussions we had in ISO C++ SG1, it seems the only way to fix memory_order_consume is to deprecate it (or let it rot forever), and add something else to the standard. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4321.pdf IOW, I believe the promotion is here to stay. I'm not aware of any other implementation doing something else. Thus, XFAIL doesn't seem right to me.
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Feb 9, 2015, at 7:11 AM, Alex Velenko wrote: > The following patch makes atomic-op-consume.c XFAIL > > Is this patch ok? Ok. I’d shorten the comment above the xfail to be exceedingly short: /* PR59448 consume not implemented yet */ The reason is the brain can process this about 8x faster. Also, one can cut and paste the PR part into a web browser directly, or, if you have an electric bugzilla mode for emacs, it will pop right up. */
Re: Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On 28/01/15 18:50, Mike Stump wrote: On Jan 28, 2015, at 9:51 AM, Marcus Shawcroft wrote: Going forward we can [ … ] xfail the test case pending a proper solution to 59448 ? Mike do you prefer one of the other two approaches ? I’d xfail the test case and mark with the fix consume PR. If we don’t have an unambiguous, fix consume PR, I’d file that. It should be listed as failing on aarch, and the fix for that PR should then make the aarch test case pass. This way no one can run off with the PR and do anything else with it. Hi, Mike! Sorry for the delay. The following patch makes atomic-op-consume.c XFAIL for both gcc.target/arm and gcc.target/aarch64 tests. XFAIL was chosen as prefered approach for handling __ATOMIC_CONSUME to __ATOMIC_ACQUIRE promotion workaround. This patch was tested by running the modified tests on aarch64-none-elf and arm-none-eabi compilers. Is this patch ok? Alex 2015-02-09 Alex Velenko gcc/testsuite/ * gcc.target/aarch64/atomic-op-consume.c (scan-assember-times): Directive adjusted to XFAIL. * gcc.target/arm/atomic-op-consume.c (scan-assember-times): Directive adjusted to XFAIL. diff --git a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c index 38d6c2c..8150af6 100644 --- a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c +++ b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c @@ -3,5 +3,9 @@ #include "atomic-op-consume.x" -/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ +/* To workaround Bugzilla 59448 issue, a request for __ATOMIC_CONSUME is always + promoted to __ATOMIC_ACQUIRE, implemented as MEMMODEL_ACQUIRE. This causes + "LDAXR" to be generated instead of "LDXR". Therefore, "LDXR" test is + expected to fail. */ +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 { xfail *-*-* } } } */ /* { dg-final { scan-assembler-times "stxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ diff --git a/gcc/testsuite/gcc.target/arm/atomic-op-consume.c b/gcc/testsuite/gcc.target/arm/atomic-op-consume.c index cc6c028..060655c 100644 --- a/gcc/testsuite/gcc.target/arm/atomic-op-consume.c +++ b/gcc/testsuite/gcc.target/arm/atomic-op-consume.c @@ -7,7 +7,8 @@ /* To workaround Bugzilla 59448 issue, a request for __ATOMIC_CONSUME is always promoted to __ATOMIC_ACQUIRE, implemented as MEMMODEL_ACQUIRE. This causes - "LDAEX" to be generated instead of "LDREX". */ -/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */ + "LDAEX" to be generated instead of "LDREX". Therefore, "LDREX" test is + expected to fail. */ +/* { dg-final { scan-assembler-times "ldrex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 { xfail *-*-* } } } */ /* { dg-final { scan-assembler-times "strex\t...?, r\[0-9\]+, \\\[r\[0-9\]+\\\]" 6 } } */ /* { dg-final { scan-assembler-not "dmb" } } */ --1.8.1.2--
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Jan 28, 2015, at 9:51 AM, Marcus Shawcroft wrote: > Going forward we can [ … ] xfail the test case pending a proper solution to > 59448 ? > Mike do you prefer one of the other two approaches ? I’d xfail the test case and mark with the fix consume PR. If we don’t have an unambiguous, fix consume PR, I’d file that. It should be listed as failing on aarch, and the fix for that PR should then make the aarch test case pass. This way no one can run off with the PR and do anything else with it.
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Wed, Jan 28, 2015 at 05:51:27PM +, Marcus Shawcroft wrote: > On 28 January 2015 at 17:41, Mike Stump wrote: > > On Jan 27, 2015, at 8:24 AM, Alex Velenko wrote: > >> This patch fixes aarch64/atomic-op-consume.c test to expect safe "LDAXR" > >> instruction to be generated when __ATOMIC_CONSUME semantics is requested. > > > > Did you see: > > > > /* Workaround for Bugzilla 59448. GCC doesn't track consume properly, so > > be conservative and promote consume to acquire. */ > > if (val == MEMMODEL_CONSUME) > > val = MEMMODEL_ACQUIRE; > > > > in builtins.c? Feels like if gcc isn’t going to support it for you, then > > testing for it would be, hard? > > The original test was written pre 59448 and expects GCC to implement > consume behaviour. The workaround for 59448 changes GCC behaviour but > did not update this test case. Going forward we can either remove the > test case completely, xfail the test case pending a proper solution to > 59448 ? or change the test case to expect the current intended > behaviour of gcc. This patch implements that latter, which seems > reasonable to me. Mike do you prefer one of the other two approaches ? I'll vote for keeping the test case, please. It still fulfills a useful purpose. GCC must now promote __ATOMIC_CONSUME to __ATOMIC_ACQUIRE, and the test case now reflects that - expecting the LDAXR instruction (load acquire exclusive) over the more relaxed LDXR (load exclusive) that we emitted prior to PR59448. If we lose that promotion, or if we start emitting different instructions for __ATOMIC_ACQUIRE, we have a regression, and this test should spot that. I also wouldn't want to see the test XFAIL; we know what the correct expected behaviour is and should update the test to reflect that - as in Alex' patch. Thanks, James
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On 28 January 2015 at 17:41, Mike Stump wrote: > On Jan 27, 2015, at 8:24 AM, Alex Velenko wrote: >> This patch fixes aarch64/atomic-op-consume.c test to expect safe "LDAXR" >> instruction to be generated when __ATOMIC_CONSUME semantics is requested. > > Did you see: > > /* Workaround for Bugzilla 59448. GCC doesn't track consume properly, so > be conservative and promote consume to acquire. */ > if (val == MEMMODEL_CONSUME) > val = MEMMODEL_ACQUIRE; > > in builtins.c? Feels like if gcc isn’t going to support it for you, then > testing for it would be, hard? The original test was written pre 59448 and expects GCC to implement consume behaviour. The workaround for 59448 changes GCC behaviour but did not update this test case. Going forward we can either remove the test case completely, xfail the test case pending a proper solution to 59448 ? or change the test case to expect the current intended behaviour of gcc. This patch implements that latter, which seems reasonable to me. Mike do you prefer one of the other two approaches ? Cheers /Marcus
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Jan 27, 2015, at 8:24 AM, Alex Velenko wrote: > This patch fixes aarch64/atomic-op-consume.c test to expect safe "LDAXR" > instruction to be generated when __ATOMIC_CONSUME semantics is requested. Did you see: /* Workaround for Bugzilla 59448. GCC doesn't track consume properly, so be conservative and promote consume to acquire. */ if (val == MEMMODEL_CONSUME) val = MEMMODEL_ACQUIRE; in builtins.c? Feels like if gcc isn’t going to support it for you, then testing for it would be, hard?
[PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
Hi, This patch fixes aarch64/atomic-op-consume.c test to expect safe "LDAXR" instruction to be generated when __ATOMIC_CONSUME semantics is requested. This patch was tested by running the modified test on aarch64-none-elf compiler. Is this patch ok? Alex 2015-01-27 Alex Velenko gcc/testsuite/ * gcc.target/aarch64/atomic-op-consume.c (scan-assember-times): Adjust scan-assembler-times pattern. diff --git a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c index 38d6c2c..7ece5b1 100644 --- a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c +++ b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c @@ -3,5 +3,8 @@ #include "atomic-op-consume.x" -/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ +/* To workaround Bugzilla 59448 issue, a request for __ATOMIC_CONSUME is always + promoted to __ATOMIC_ACQUIRE, implemented as MEMMODEL_ACQUIRE. This causes + "LDAXR" to be generated instead of "LDXR". */ +/* { dg-final { scan-assembler-times "ldaxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ /* { dg-final { scan-assembler-times "stxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */
Re: [PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
On Wed, Jan 21, 2015 at 05:39:12PM +, Alex Velenko wrote: > Hi, > Is the following patch ok? > regards, > Alex Hi Alex, Some comments on your submission inline below. > This patch fixes aarch64/atomic-op-consume.c test to expect safe assembly to > be > generated when __ATOMIC_CONSUME semantics is requested. This text should provide the context for the fix. In particular, it should explain what is meant by "safe" assembly. In this case, the reason for your fix is included in the patch as a comment, but you need to give enough information up top so that we can understand what your patch is about and why it is correct. > 2015-01-21 Alex Velenko alex.vele...@arm.com > > gcc/testsuite/ > > gcc.target/aarch64/atomic-op-consume.c(scan-assember-times): Modified. This ChangeLog entry is not of the correct format, I would have expected something like: 2015-01-21 Alex Velenko * gcc.target/aarch64/atomic-op-consume.c (scan-assembler-times): Adjust scan-assembler-times pattern. Note: Two spaces between the date and your name, two spaces between your name and your email address, "< >" around your email address, * before the filepath. > > diff --git a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c > b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c > index 38d6c2c..cf33be2 100644 > --- a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c > +++ b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c > @@ -3,5 +3,9 @@ > > #include "atomic-op-consume.x" > > -/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 > } } */ > +/* To workaround Bugzilla 59448 issue, a request for memory behaviour > + __ATOMIC_CONSUME is promoted to MEMMODEL_ACQUIRE behaviour, not > + MEMMODEL_CONSUME behaviour. This causes "ldaxr" to be generated > + instead of "ldxr". */ This text confuses some terminology and mixes internal implementation details and external predefine names. In the interests of being accurate (we might forget the context of this fix in future), I would suggest the following: To workaround Bugzilla 59448, a request for __ATOMIC_CONSUME is always promoted to __ATOMIC_ACQUIRE. This causes "LDAXR" to be generated instead of "LDXR". Here, we drop the internal implementation details of the compiler (which may change and end up out of sync with this testcase) and concentrate only on the user visible behaviours. Thanks, James
[PATCH][AArch64] Testcase fix for __ATOMIC_CONSUME
Hi, Is the following patch ok? regards, Alex This patch fixes aarch64/atomic-op-consume.c test to expect safe assembly to be generated when __ATOMIC_CONSUME semantics is requested. 2015-01-21 Alex Velenko alex.vele...@arm.com gcc/testsuite/ gcc.target/aarch64/atomic-op-consume.c(scan-assember-times): Modified. diff --git a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c index 38d6c2c..cf33be2 100644 --- a/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c +++ b/gcc/testsuite/gcc.target/aarch64/atomic-op-consume.c @@ -3,5 +3,9 @@ #include "atomic-op-consume.x" -/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ +/* To workaround Bugzilla 59448 issue, a request for memory behaviour + __ATOMIC_CONSUME is promoted to MEMMODEL_ACQUIRE behaviour, not + MEMMODEL_CONSUME behaviour. This causes "ldaxr" to be generated + instead of "ldxr". */ +/* { dg-final { scan-assembler-times "ldaxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */ /* { dg-final { scan-assembler-times "stxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 6 } } */