public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] x86: Add gcc.target/i386/pr103205-2.c
@ 2021-11-15 13:40 H.J. Lu
  2021-11-15 13:52 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2021-11-15 13:40 UTC (permalink / raw)
  To: gcc-patches

	PR target/103205
	* gcc.target/i386/pr103205-2.c: New test.
---
 gcc/testsuite/gcc.target/i386/pr103205-2.c | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr103205-2.c

diff --git a/gcc/testsuite/gcc.target/i386/pr103205-2.c b/gcc/testsuite/gcc.target/i386/pr103205-2.c
new file mode 100644
index 00000000000..705081e51d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103205-2.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune-ctrl=^himode_math" } */
+
+extern short foo;
+extern unsigned short bar;
+
+int
+foo1 (void)
+{
+  return __sync_fetch_and_and (&foo, ~1) & 1;
+}
+
+int
+foo2 (void)
+{
+  return __sync_fetch_and_or (&foo, 1) & 1;
+}
+
+int
+foo3 (void)
+{
+  return __sync_fetch_and_xor (&foo, 1) & 1;
+}
+
+unsigned short
+bar1 (void)
+{
+  return __sync_fetch_and_and (&bar, ~1) & 1;
+}
+
+unsigned short
+bar2 (void)
+{
+  return __sync_fetch_and_or (&bar, 1) & 1;
+}
+
+unsigned short
+bar3 (void)
+{
+  return __sync_fetch_and_xor (&bar, 1) & 1;
+}
+
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrw" 2 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsw" 2 } } */
+/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btcw" 2 } } */
+/* { dg-final { scan-assembler-not "cmpxchgw" } } */
-- 
2.33.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: Add gcc.target/i386/pr103205-2.c
  2021-11-15 13:40 [PATCH] x86: Add gcc.target/i386/pr103205-2.c H.J. Lu
@ 2021-11-15 13:52 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2021-11-15 13:52 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches

On Mon, Nov 15, 2021 at 05:40:01AM -0800, H.J. Lu via Gcc-patches wrote:
> 	PR target/103205
> 	* gcc.target/i386/pr103205-2.c: New test.

Ok, thanks.

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-15 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 13:40 [PATCH] x86: Add gcc.target/i386/pr103205-2.c H.J. Lu
2021-11-15 13:52 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).