From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 40B8038654B0 for ; Tue, 25 Jun 2024 21:15:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40B8038654B0 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 40B8038654B0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719350121; cv=none; b=M985I2vFtrc7+JetIf/5pOJ4xAfHioHGQxQ7rmFGlD2y1EzbI0/7GV6GKWjdFT0QE937SXIT6zuf0mILdwSHsLcmJjQ0cTF7VCeuFA9+m4QlIkRhdRyGQ8eygyQ2AeXPgM+CfWNrtdLGxQdGd0rYF3PLg3r4N4Mc3qntf/YiM/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719350121; c=relaxed/simple; bh=wTG1GzUZIndlSSz9RiVA97TtjT8CqwYjeyDuarCrsv8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ocEr/kO+ZpJFQe7jWPMVwZluk8KMwJwW3cGGOAEWyLmQpczxo4KrpR52QtS5ivihrEeqh1uJvh9slZ6ciENl9glHECCLWVa2NCzSOtUBVAYFl0JWW/f2ntFcvcyUt46+PET6iZz/C2qFSmsBQsl+QOpIx9JYNmN7KcGYnBREQrY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6f9fbec4fd9so3208573a34.2 for ; Tue, 25 Jun 2024 14:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1719350114; x=1719954914; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n8ag8C1WnL1srMW8hX9fuOckrEZWtMlk7gFWIleepAA=; b=gChCuAZpapsDnsuEsbyYmLeF8yPAINxFjUfY045KuOmtSUtvb1atr5Dcg4dRVInRgT M2PopVjKjtV4MAacpNdZUVAIrd3hpoWGgMh5TAW4euwF+7a6mRhWqQok8fqWiKgORxJE gUr0aaMuL3Vqo/PFxAacDs6xITmjdMnvrSTvJQpOx/zfyxQuugvC9irxd5Md/vfcNDhB 9f3uVJfQVSCtfjXAdQ2dxBe5PsSJ/7phrnlzhCwDq6KUReWiI/0cijPuMMf3T6XAJBaG IJU41YS44OJ9ePK5N7SUJPL1EfY1ZdTGIpS+GFGxq4cRxEEAE/K1CpaC2WB2vG8uFXf+ XPjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719350114; x=1719954914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n8ag8C1WnL1srMW8hX9fuOckrEZWtMlk7gFWIleepAA=; b=Z8cYQpdALTwbv9PGCu6JF2lY8qMWdo3pU5kezHmrIEUKnv81CH2NBHbD2xFFHGjKCB 5E3eKpo0Fu1kIWn/hz4kW3KPa5+FgI0/gxuOmBBij3BLGG4CIlygNUr1JyeZteA2DhDg 1vWF/CURyBwvayA2qTo0+ueEz0D1pWG64qiz2Ud1qayrfzz0AnIQnDd4bMsa3hzaOrkE WghCuHmRadVtXaBYLtZzg1bLkCdrJe2BFfVMj1Uw3aSHVFwpt9zepRWHnHadX6VQdi/+ S5biI/xwlRg/NBws0rq2W9wwZNoANRE9/HOm1L5QZqCVA6Bioj7/7+9qTzjJ2aS8pl/6 linw== X-Gm-Message-State: AOJu0Yw0sP2xFpO2WuIIwqxEGpgCnllzbVI9jfICc+XeFcAzEUFNEogv gXkrjm2JpdEmIr+N6dFkNuSN/tayBE1e+EVcA+2M4FrnAwJU10cDuu6jtRnFZ++dZWr2JwoEFqR R X-Google-Smtp-Source: AGHT+IEyLmGv6jlBM9wsSnXDmURov7izqWKYbOop+U2X0bRoYS9RP9QBHhHrW7HKk/eJbeYcZY56Bg== X-Received: by 2002:a05:6830:1d64:b0:700:ce71:3d51 with SMTP id 46e09a7af769-700ce713e4bmr923988a34.20.1719350113614; Tue, 25 Jun 2024 14:15:13 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-700cfcf3d7esm46556a34.27.2024.06.25.14.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 14:15:12 -0700 (PDT) From: Patrick O'Neill To: gcc-patches@gcc.gnu.org Cc: jeffreyalaw@gmail.com, kito.cheng@gmail.com, palmer@dabbelt.com, gnu-toolchain@rivosinc.com, Patrick O'Neill Subject: [PATCH 2/3] RISC-V: Consolidate amo testcase variants Date: Tue, 25 Jun 2024 14:14:17 -0700 Message-ID: <20240625211418.2322391-3-patrick@rivosinc.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240625211418.2322391-1-patrick@rivosinc.com> References: <20240625211418.2322391-1-patrick@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Many riscv/amo/ testcases use check-function-bodies. These testcases can be consolidated with related testcases (memory ordering variants) without affecting the assertions. Give functions descriptive names so testsuite failures are obvious from the 'FAIL:' line. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-fence-1.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-fence-2.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-fence-3.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-fence-4.c: Removed. * gcc.target/riscv/amo/amo-table-a-6-fence-5.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-fence-1.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-fence-2.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-fence-3.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-fence-4.c: Removed. * gcc.target/riscv/amo/amo-table-ztso-fence-5.c: Removed. * gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c: Removed. * gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c: Removed. * gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c: Removed. * gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c: Removed. * gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c: Removed. * gcc.target/riscv/amo/a-rvwmo-fence.c: New test. * gcc.target/riscv/amo/a-ztso-fence.c: New test. * gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c: New test. * gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c: New test. * gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c: New test. * gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c: New test. Signed-off-by: Patrick O'Neill --- .../gcc.target/riscv/amo/a-rvwmo-fence.c | 56 +++++++++++++ .../gcc.target/riscv/amo/a-ztso-fence.c | 52 +++++++++++++ .../riscv/amo/amo-table-a-6-amo-add-1.c | 17 ---- .../riscv/amo/amo-table-a-6-amo-add-2.c | 17 ---- .../riscv/amo/amo-table-a-6-amo-add-3.c | 17 ---- .../riscv/amo/amo-table-a-6-amo-add-4.c | 17 ---- .../riscv/amo/amo-table-a-6-amo-add-5.c | 17 ---- .../riscv/amo/amo-table-a-6-fence-1.c | 15 ---- .../riscv/amo/amo-table-a-6-fence-2.c | 16 ---- .../riscv/amo/amo-table-a-6-fence-3.c | 16 ---- .../riscv/amo/amo-table-a-6-fence-4.c | 16 ---- .../riscv/amo/amo-table-a-6-fence-5.c | 16 ---- .../riscv/amo/amo-table-ztso-amo-add-1.c | 17 ---- .../riscv/amo/amo-table-ztso-amo-add-2.c | 17 ---- .../riscv/amo/amo-table-ztso-amo-add-3.c | 17 ---- .../riscv/amo/amo-table-ztso-amo-add-4.c | 17 ---- .../riscv/amo/amo-table-ztso-amo-add-5.c | 17 ---- .../riscv/amo/amo-table-ztso-fence-1.c | 15 ---- .../riscv/amo/amo-table-ztso-fence-2.c | 15 ---- .../riscv/amo/amo-table-ztso-fence-3.c | 15 ---- .../riscv/amo/amo-table-ztso-fence-4.c | 15 ---- .../riscv/amo/amo-table-ztso-fence-5.c | 16 ---- .../riscv/amo/amo-zalrsc-amo-add-1.c | 22 ------ .../riscv/amo/amo-zalrsc-amo-add-2.c | 22 ------ .../riscv/amo/amo-zalrsc-amo-add-3.c | 22 ------ .../riscv/amo/amo-zalrsc-amo-add-4.c | 22 ------ .../riscv/amo/amo-zalrsc-amo-add-5.c | 22 ------ .../riscv/amo/zaamo-rvwmo-amo-add-int.c | 57 ++++++++++++++ .../riscv/amo/zaamo-ztso-amo-add-int.c | 57 ++++++++++++++ .../riscv/amo/zalrsc-rvwmo-amo-add-int.c | 78 +++++++++++++++++++ .../riscv/amo/zalrsc-ztso-amo-add-int.c | 78 +++++++++++++++++++ 31 files changed, 378 insertions(+), 435 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c create mode 100644 gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c delete mode 100644 gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c create mode 100644 gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c create mode 100644 gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c create mode 100644 gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c diff --git a/gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c b/gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c new file mode 100644 index 00000000000..5b9400f7da8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/amo/a-rvwmo-fence.c @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* Verify that fence mappings match Table A.6's recommended mapping. */ +/* { dg-options "-O3" } */ +/* { dg-remove-options riscv_ztso } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** fence_relaxed: +** ret +*/ +void fence_relaxed() +{ + __atomic_thread_fence(__ATOMIC_RELAXED); +} + +/* +** fence_acquire: +** fence\tr,rw +** ret +*/ +void fence_acquire() +{ + __atomic_thread_fence(__ATOMIC_ACQUIRE); +} + +/* +** fence_release: +** fence\trw,w +** ret +*/ +void fence_release() +{ + __atomic_thread_fence(__ATOMIC_RELEASE); +} + +/* +** fence_acq_rel: +** fence\.tso +** ret +*/ +void fence_acq_rel() +{ + __atomic_thread_fence(__ATOMIC_ACQ_REL); +} + +/* +** fence_seq_cst: +** fence\trw,rw +** ret +*/ +void fence_seq_cst() +{ + __atomic_thread_fence(__ATOMIC_SEQ_CST); +} + diff --git a/gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c b/gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c new file mode 100644 index 00000000000..37daeda8354 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/amo/a-ztso-fence.c @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* Verify that fence mappings match the Ztso suggested mapping. */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** fence_relaxed: +** ret +*/ +void fence_relaxed() +{ + __atomic_thread_fence(__ATOMIC_RELAXED); +} + +/* +** fence_acquire: +** ret +*/ +void fence_acquire() +{ + __atomic_thread_fence(__ATOMIC_ACQUIRE); +} + +/* +** fence_release: +** ret +*/ +void fence_release() +{ + __atomic_thread_fence(__ATOMIC_RELEASE); +} + +/* +** fence_acq_rel: +** ret +*/ +void fence_acq_rel() +{ + __atomic_thread_fence(__ATOMIC_ACQ_REL); +} + +/* +** fence_seq_cst: +** fence\trw,rw +** ret +*/ +void fence_seq_cst() +{ + __atomic_thread_fence(__ATOMIC_SEQ_CST); +} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c deleted file mode 100644 index 2acad7d44bf..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c deleted file mode 100644 index ab21f079eaa..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\.aq\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c deleted file mode 100644 index 919ff37d096..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\.rl\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c deleted file mode 100644 index 1531d3763b7..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\.aqrl\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c deleted file mode 100644 index 03b70111a74..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\.aqrl\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c deleted file mode 100644 index 202479a005e..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_RELAXED); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c deleted file mode 100644 index 7d6c73a6b50..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-2.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** fence\tr,rw -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_ACQUIRE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c deleted file mode 100644 index a53889a4fa1..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-3.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** fence\trw,w -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_RELEASE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c deleted file mode 100644 index 63a3a234d43..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-4.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** fence\.tso -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_ACQ_REL); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c deleted file mode 100644 index 78040bd11e9..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-a-6-fence-5.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** fence\trw,rw -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_SEQ_CST); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c deleted file mode 100644 index 000407a2583..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c deleted file mode 100644 index 3e441cadbf3..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c deleted file mode 100644 index 8af1a2f79a4..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c deleted file mode 100644 index 0b3a7e59689..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c deleted file mode 100644 index f189827d6cf..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zaamo } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** amoadd\.w\tzero,a1,0\(a0\) -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c deleted file mode 100644 index ec008d25794..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_RELAXED); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c deleted file mode 100644 index acef911573f..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-2.c +++ /dev/null @@ -1,15 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_ACQUIRE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c deleted file mode 100644 index 6931ba0a799..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-3.c +++ /dev/null @@ -1,15 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_RELEASE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c deleted file mode 100644 index b5a04294ad0..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-4.c +++ /dev/null @@ -1,15 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_ACQ_REL); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c deleted file mode 100644 index 860fb978cbc..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-table-ztso-fence-5.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** fence\trw,rw -** ret -*/ -void foo() -{ - __atomic_thread_fence(__ATOMIC_SEQ_CST); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c deleted file mode 100644 index 582e96534de..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* { dg-do compile } */ -/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zalrsc } */ -/* { dg-remove-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** 1: -** lr.w\t[atx][0-9]+, 0\(a0\) -** add\t[atx][0-9]+, [atx][0-9]+, a1 -** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) -** bnez\t[atx][0-9]+, 1b -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c deleted file mode 100644 index 987429640de..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c +++ /dev/null @@ -1,22 +0,0 @@ -/* { dg-do compile } */ -/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zalrsc } */ -/* { dg-remove-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** 1: -** lr.w.aq\t[atx][0-9]+, 0\(a0\) -** add\t[atx][0-9]+, [atx][0-9]+, a1 -** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) -** bnez\t[atx][0-9]+, 1b -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c deleted file mode 100644 index b29966ce7d7..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c +++ /dev/null @@ -1,22 +0,0 @@ -/* { dg-do compile } */ -/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zalrsc } */ -/* { dg-remove-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** 1: -** lr.w\t[atx][0-9]+, 0\(a0\) -** add\t[atx][0-9]+, [atx][0-9]+, a1 -** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) -** bnez\t[atx][0-9]+, 1b -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c deleted file mode 100644 index 5dfb7ac2bac..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c +++ /dev/null @@ -1,22 +0,0 @@ -/* { dg-do compile } */ -/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zalrsc } */ -/* { dg-remove-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** 1: -** lr.w.aq\t[atx][0-9]+, 0\(a0\) -** add\t[atx][0-9]+, [atx][0-9]+, a1 -** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) -** bnez\t[atx][0-9]+, 1b -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c deleted file mode 100644 index fcc64131fec..00000000000 --- a/gcc/testsuite/gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c +++ /dev/null @@ -1,22 +0,0 @@ -/* { dg-do compile } */ -/* Verify that lrsc atomic op mappings match Table A.6's recommended mapping. */ -/* { dg-options "-O3" } */ -/* { dg-add-options riscv_zalrsc } */ -/* { dg-remove-options riscv_zaamo } */ -/* { dg-remove-options riscv_ztso } */ -/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ -/* { dg-final { check-function-bodies "**" "" } } */ - -/* -** foo: -** 1: -** lr.w.aqrl\t[atx][0-9]+, 0\(a0\) -** add\t[atx][0-9]+, [atx][0-9]+, a1 -** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) -** bnez\t[atx][0-9]+, 1b -** ret -*/ -void foo (int* bar, int baz) -{ - __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); -} diff --git a/gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c new file mode 100644 index 00000000000..22187243314 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/amo/zaamo-rvwmo-amo-add-int.c @@ -0,0 +1,57 @@ +/* { dg-do compile } */ +/* Verify that atomic op mappings match Table A.6's recommended mapping. */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_zaamo } */ +/* { dg-remove-options riscv_ztso } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** atomic_add_fetch_int_relaxed: +** amoadd\.w\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_relaxed (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); +} + +/* +** atomic_add_fetch_int_acquire: +** amoadd\.w\.aq\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_acquire (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); +} + +/* +** atomic_add_fetch_int_release: +** amoadd\.w\.rl\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_release (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); +} + +/* +** atomic_add_fetch_int_acq_rel: +** amoadd\.w\.aqrl\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_acq_rel (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); +} + +/* +** atomic_add_fetch_int_seq_cst: +** amoadd\.w\.aqrl\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_seq_cst (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); +} diff --git a/gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c new file mode 100644 index 00000000000..8cfd601f12a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/amo/zaamo-ztso-amo-add-int.c @@ -0,0 +1,57 @@ +/* { dg-do compile } */ +/* Verify that atomic op mappings match Table A.6's recommended mapping. */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_zaamo } */ +/* { dg-add-options riscv_ztso } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** atomic_add_fetch_int_relaxed: +** amoadd\.w\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_relaxed (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); +} + +/* +** atomic_add_fetch_int_acquire: +** amoadd\.w\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_acquire (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); +} + +/* +** atomic_add_fetch_int_release: +** amoadd\.w\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_release (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); +} + +/* +** atomic_add_fetch_int_acq_rel: +** amoadd\.w\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_acq_rel (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); +} + +/* +** atomic_add_fetch_int_seq_cst: +** amoadd\.w\tzero,a1,0\(a0\) +** ret +*/ +void atomic_add_fetch_int_seq_cst (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); +} diff --git a/gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c new file mode 100644 index 00000000000..4cf617d6035 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-amo-add-int.c @@ -0,0 +1,78 @@ +/* { dg-do compile } */ +/* Verify that lrsc atomic op mappings match the PSABI doc's recommended mapping. */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_zalrsc } */ +/* { dg-remove-options riscv_zaamo } */ +/* { dg-remove-options riscv_ztso } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** atomic_add_fetch_int_relaxed: +** 1: +** lr.w\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_relaxed (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); +} + +/* +** atomic_add_fetch_int_acquire: +** 1: +** lr.w.aq\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_acquire (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); +} + +/* +** atomic_add_fetch_int_release: +** 1: +** lr.w\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_release (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); +} + +/* +** atomic_add_fetch_int_acq_rel: +** 1: +** lr.w.aq\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_acq_rel (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); +} + +/* +** atomic_add_fetch_int_seq_cst: +** 1: +** lr.w.aqrl\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_seq_cst (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); +} diff --git a/gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c new file mode 100644 index 00000000000..3fb16c01191 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/amo/zalrsc-ztso-amo-add-int.c @@ -0,0 +1,78 @@ +/* { dg-do compile } */ +/* Verify that lrsc atomic op mappings match the PSABI doc's recommended mapping. */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_zalrsc } */ +/* { dg-add-options riscv_ztso } */ +/* { dg-remove-options riscv_zaamo } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** atomic_add_fetch_int_relaxed: +** 1: +** lr.w\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_relaxed (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); +} + +/* +** atomic_add_fetch_int_acquire: +** 1: +** lr.w\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_acquire (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQUIRE); +} + +/* +** atomic_add_fetch_int_release: +** 1: +** lr.w\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_release (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_RELEASE); +} + +/* +** atomic_add_fetch_int_acq_rel: +** 1: +** lr.w\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_acq_rel (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_ACQ_REL); +} + +/* +** atomic_add_fetch_int_seq_cst: +** 1: +** lr.w.aqrl\t[atx][0-9]+, 0\(a0\) +** add\t[atx][0-9]+, [atx][0-9]+, a1 +** sc.w.rl\t[atx][0-9]+, [atx][0-9]+, 0\(a0\) +** bnez\t[atx][0-9]+, 1b +** ret +*/ +void atomic_add_fetch_int_seq_cst (int* bar, int baz) +{ + __atomic_add_fetch(bar, baz, __ATOMIC_SEQ_CST); +} -- 2.34.1