From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A50FD382EF1A; Wed, 16 Nov 2022 03:07:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A50FD382EF1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668568055; bh=vZITYJfxDiPZmO9jfnRZ/7dqnDlnJwtAs96eYtCranE=; h=From:To:Subject:Date:From; b=NxNw8AIwRPDKm7A+U2WfahavrANF46svpGIrplAZJ2YUsWdz/d+Vtx4hpt9GPn2wx 2HI9O6lPE5dHz+A2aN26TxpCLm/dqbiwctLsPZzZuNED9vsWujAWVWjNVyxNvELBuv xhwoXuDWJNQP7ej3UT8zsvxzKxF4slyJ4QG5Bt00= From: "hejinyang at loongson dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/107713] New: Wrong implementation atomic_exchange on LoongArch Date: Wed, 16 Nov 2022 03:07:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hejinyang at loongson dot cn X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107713 Bug ID: 107713 Summary: Wrong implementation atomic_exchange on LoongArch Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hejinyang at loongson dot cn Target Milestone: --- Created attachment 53905 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53905&action=3Dedit preprocessed file Target: loongarch64-unknown-linux-gnu Configured with: ../configure --prefix=3D/usr --libdir=3D/usr/lib64 --build=3Dx86_64-cross-linux-gnu --host=3Dloongarch64-unknown-linux-gnu --target=3Dloongarch64-unknown-linux-gnu --enable-__cxa_atexit --enable-threads=3Dposix --with-system-zlib --enable-libstdcxx-time --enable-checking=3Drelease --with-build-sysroot=3D/opt/mylaos/sysroot --enable-default-pie --enable-languages=3Dc,c++,fortran,objc,obj-c++,lto gcc version 13.0.0 20220801 (experimental) (GCC)=20 test_of_sync_lock_test_and_set.c: char lock; char hello() { return __sync_lock_test_and_set (&lock, 1); } Cmdline: gcc test_of_sync_lock_test_and_set.c -S --save-temps Output Fragment: 1: ll.w $r12,$r16,0 and $r19,$r12,$r14 bne $r19,$r15,2f <--- Wrong and $r19,$r12,$r17 or $r19,$r19,$r18 sc.w $r19,$r16,0 beq $zero,$r19,1b b 3f 2: dbar 0x700 3:=