public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: HaoChen Gui <guihaoc@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-10114] rs6000: Use bcdsub. instead of bcdadd. for bcd invalid number checking Date: Thu, 25 Apr 2024 01:57:34 +0000 (GMT) [thread overview] Message-ID: <20240425015734.B9A40384640E@sourceware.org> (raw) https://gcc.gnu.org/g:09680e3ee7d72978b493dd4127ce2e769f96a45e commit r14-10114-g09680e3ee7d72978b493dd4127ce2e769f96a45e Author: Haochen Gui <guihaoc@gcc.gnu.org> Date: Thu Apr 25 09:55:53 2024 +0800 rs6000: Use bcdsub. instead of bcdadd. for bcd invalid number checking bcdadd. might causes overflow which also set the overflow/invalid bit. bcdsub. doesn't have the issue when do subtracting on two same bcd number. gcc/ * config/rs6000/altivec.md (*bcdinvalid_<mode>): Replace bcdadd with bcdsub. (bcdinvalid_<mode>): Likewise. gcc/testsuite/ * gcc.target/powerpc/bcd-4.c: Adjust the number of bcdadd and bcdsub. Diff: --- gcc/config/rs6000/altivec.md | 6 +++--- gcc/testsuite/gcc.target/powerpc/bcd-4.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 4d4c94ff0a0..bb20441c096 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -4586,18 +4586,18 @@ [(set (reg:CCFP CR6_REGNO) (compare:CCFP (unspec:V2DF [(match_operand:VBCD 1 "register_operand" "v")] - UNSPEC_BCDADD) + UNSPEC_BCDSUB) (match_operand:V2DF 2 "zero_constant" "j"))) (clobber (match_scratch:VBCD 0 "=v"))] "TARGET_P8_VECTOR" - "bcdadd. %0,%1,%1,0" + "bcdsub. %0,%1,%1,0" [(set_attr "type" "vecsimple")]) (define_expand "bcdinvalid_<mode>" [(parallel [(set (reg:CCFP CR6_REGNO) (compare:CCFP (unspec:V2DF [(match_operand:VBCD 1 "register_operand")] - UNSPEC_BCDADD) + UNSPEC_BCDSUB) (match_dup 2))) (clobber (match_scratch:VBCD 3))]) (set (match_operand:SI 0 "register_operand") diff --git a/gcc/testsuite/gcc.target/powerpc/bcd-4.c b/gcc/testsuite/gcc.target/powerpc/bcd-4.c index 2c7041c4d32..6d2c59ef792 100644 --- a/gcc/testsuite/gcc.target/powerpc/bcd-4.c +++ b/gcc/testsuite/gcc.target/powerpc/bcd-4.c @@ -2,8 +2,8 @@ /* { dg-require-effective-target int128 } */ /* { dg-require-effective-target p9vector_hw } */ /* { dg-options "-mdejagnu-cpu=power9 -O2 -save-temps" } */ -/* { dg-final { scan-assembler-times {\mbcdadd\M} 7 } } */ -/* { dg-final { scan-assembler-times {\mbcdsub\M} 18 } } */ +/* { dg-final { scan-assembler-times {\mbcdadd\M} 5 } } */ +/* { dg-final { scan-assembler-times {\mbcdsub\M} 20 } } */ /* { dg-final { scan-assembler-times {\mbcds\M} 2 } } */ /* { dg-final { scan-assembler-times {\mdenbcdq\M} 1 } } */
reply other threads:[~2024-04-25 1:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240425015734.B9A40384640E@sourceware.org \ --to=guihaoc@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).