public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH][committed] arm: PR target/109939 Correct signedness of return type of __ssat intrinsics
Date: Wed, 24 May 2023 08:32:55 +0000	[thread overview]
Message-ID: <PAXPR08MB69267B920DACBDB698F8A39993419@PAXPR08MB6926.eurprd08.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hi all,

As the PR says we shouldn't be using qualifier_unsigned for the return type of the __ssat intrinsics.
UNSIGNED_SAT_BINOP_UNSIGNED_IMM_QUALIFIERS already exists for that.
This was just a thinko.
This patch fixes this and the warning with -Wconversion goes away.

Bootstrapped and tested on arm-none-linux-gnueabihf.
Pushing to trunk.
Thanks,
Kyrill

gcc/ChangeLog:

	PR target/109939
	* config/arm/arm-builtins.cc (SAT_BINOP_UNSIGNED_IMM_QUALIFIERS): Use
	qualifier_none for the return operand.

gcc/testsuite/ChangeLog:

	PR target/109939
	* gcc.target/arm/pr109939.c: New test.

[-- Attachment #2: satsign.patch --]
[-- Type: application/octet-stream, Size: 1252 bytes --]

diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
index d0c57409b4c2b4fa2810291945c80780c096bd4a..36365e40a5b863232eb824d1cdae7cbeccafbce3 100644
--- a/gcc/config/arm/arm-builtins.cc
+++ b/gcc/config/arm/arm-builtins.cc
@@ -97,7 +97,7 @@ arm_binop_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS]
 /* T (T, unsigned immediate).  */
 static enum arm_type_qualifiers
 arm_sat_binop_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS]
-  = { qualifier_unsigned, qualifier_none, qualifier_unsigned_immediate };
+  = { qualifier_none, qualifier_none, qualifier_unsigned_immediate };
 #define SAT_BINOP_UNSIGNED_IMM_QUALIFIERS \
   (arm_sat_binop_imm_qualifiers)
 
diff --git a/gcc/testsuite/gcc.target/arm/pr109939.c b/gcc/testsuite/gcc.target/arm/pr109939.c
new file mode 100644
index 0000000000000000000000000000000000000000..aafda7cd3cd33412722380d102d45c99b9c78203
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr109939.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_sat_ok } */
+/* { dg-add-options arm_sat } */
+/* { dg-additional-options "-O -Wall -Wconversion" } */
+
+#include <arm_acle.h>
+
+int dbg_ssat_out;
+int dbg_ssat_in;
+
+void test_arm_ssat(void)
+{
+    dbg_ssat_out = __ssat(dbg_ssat_in, 16);
+}

                 reply	other threads:[~2023-05-24  8:33 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=PAXPR08MB69267B920DACBDB698F8A39993419@PAXPR08MB6926.eurprd08.prod.outlook.com \
    --to=kyrylo.tkachov@arm.com \
    --cc=gcc-patches@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: link
Be 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).