From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1816) id 90854385700B; Thu, 8 Jun 2023 08:31:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90854385700B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686213087; bh=3OfDedgAm8EOiFb3lwcmNoCwWqYzQU96cF69dbhiLj0=; h=From:To:Subject:Date:From; b=ojM18YLB88FUE52wzK8DHVtw0y/yLc/QgtUgXotla8DcsCErtsdidx5Q3v4VVVeyV ls8uduhg57i1NJdS2bxTxjcRzNv0vSjEB2Rh2Z2s44udNVXYq/0TkJ8cxU9QOx4/SO qqh4TkTMLgNJTDcbBvUVeH6LSp6bP9clF6WnHwkc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kyrylo Tkachov To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-7428] arm: PR target/109939 Correct signedness of return type of __ssat intrinsics X-Act-Checkin: gcc X-Git-Author: Kyrylo Tkachov X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 65ed436a08f4c8d63463a1c3ba99b1a07baea73f X-Git-Newrev: 8f170995aac3fd568652eb208eca62e3937d0cf1 Message-Id: <20230608083127.90854385700B@sourceware.org> Date: Thu, 8 Jun 2023 08:31:27 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8f170995aac3fd568652eb208eca62e3937d0cf1 commit r13-7428-g8f170995aac3fd568652eb208eca62e3937d0cf1 Author: Kyrylo Tkachov Date: Wed May 24 09:33:04 2023 +0100 arm: PR target/109939 Correct signedness of return type of __ssat intrinsics 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. 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. (cherry picked from commit 95542a6ec4b350c653b793b7c36a8210b0e9a89d) Diff: --- gcc/config/arm/arm-builtins.cc | 2 +- gcc/testsuite/gcc.target/arm/pr109939.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc index 9f5c568cbc3..6bc56286c88 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 00000000000..aafda7cd3cd --- /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 + +int dbg_ssat_out; +int dbg_ssat_in; + +void test_arm_ssat(void) +{ + dbg_ssat_out = __ssat(dbg_ssat_in, 16); +}