rs6000: Use bcdsub. instead of bcdadd. for bcd invalid number checking
commit09680e3ee7d72978b493dd4127ce2e769f96a45e
authorHaochen Gui <guihaoc@gcc.gnu.org>
Thu, 25 Apr 2024 01:55:53 +0000 (25 09:55 +0800)
committerHaochen Gui <guihaoc@gcc.gnu.org>
Thu, 25 Apr 2024 01:55:53 +0000 (25 09:55 +0800)
tree1bae44e8ec8379df7fff3d7bee90dbd5b20dc743
parentd44c2052c59545731edcf7f99a32bcef3b0415b6
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.
gcc/config/rs6000/altivec.md
gcc/testsuite/gcc.target/powerpc/bcd-4.c