public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5271] x86: Add gcc.target/i386/pr103205-2.c
@ 2021-11-15 13:42 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-11-15 13:42 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:650108971b88f8c2484e07139c294912222f9e05

commit r12-5271-g650108971b88f8c2484e07139c294912222f9e05
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Nov 15 05:17:55 2021 -0800

    x86: Add gcc.target/i386/pr103205-2.c
    
            PR target/103205
            * gcc.target/i386/pr103205-2.c: New test.

Diff:
---
 gcc/testsuite/gcc.target/i386/pr103205-2.c | 46 ++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

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" } } */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-15 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 13:42 [gcc r12-5271] x86: Add gcc.target/i386/pr103205-2.c H.J. Lu

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).