From patchwork Thu Jan 25 19:57:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Pinski (QUIC)" X-Patchwork-Id: 192287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp219567dyb; Thu, 25 Jan 2024 11:58:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHimnV/cJoAnpUAWkle+oZkx/wzMbFPHyNOwWurqEliE324uGNdlB8NrVSsRnhy7kzzgqoM X-Received: by 2002:a0c:c441:0:b0:686:aa86:9530 with SMTP id t1-20020a0cc441000000b00686aa869530mr115306qvi.41.1706212698847; Thu, 25 Jan 2024 11:58:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706212698; cv=pass; d=google.com; s=arc-20160816; b=BV1cg9EeFbN6yRslTJv0Yx4a8tzNo6wp3PKYMLbp+7rT1zFLsVpfEFyzbRMYoJ6BwZ jQo+fFFRCI0RtozxW0Z9PcM12OTNO7im6zytvw/bakZMDvHBXXD3+lLFgqn5o9me5q68 rJ5lLjaVlA1LB68wi+J+zWur1n8038Nnb3kdq8vl6yQlVycvkY8GEH/X3K0X6gqS723u dIbizHoCJpLF5ICKjJR3vsXPql9vxsYD85ay6j56jWfR2jGcdUjsa9uCg/QjHrgU/BHl y5du9t2/WbvLInKN1SHytMj5X9meUCH++i7hizFBpLL5IvlD7sH5OeBGIj3/l5o+3iAP 397w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=zjhpPthbhu919UEToGC3fhpn2ZsS8IrcsTrFFQB3N/c=; fh=o3CEdS3yGN/eIa89Zn0Kf01WYLxTE9IjKuSQGVPeOHI=; b=X9JwRMeTileLp0tsP2AslX2pB76Os5rV4L152FHhdhN7eJRpwq7bltgO5Zy5clcy4J CBOPbav3Jc2KI0WY2vZxb/4CxP0dN3Dc5REj6TfinHqv9i+N3Ett5nzKIIqkLR+zDCSK 4TZGzIv9mSk1ZFowYvgxfhQH45UTavQMKDM14mFVIJEfAN6hRkpTOmZ73o8bYCGcaGGI KlLv52RjIQv3xDFzm55Ir2ZyABETXxrWpgnqVINJPzGNRS8LF8rmMqForYvFP+uv4+0a z4eSXuz1g4mXwhWs4Oe/W2t8vpl9z28ZR2IGYvUoU/YvV6A1Irsc9iVtjmYkbXBHlUHs OoVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HwfpJ14b; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c7-20020a0ca9c7000000b006869bd09c41si8258029qvb.541.2024.01.25.11.58.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 11:58:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HwfpJ14b; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 829933858C42 for ; Thu, 25 Jan 2024 19:58:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id D1C213858D38 for ; Thu, 25 Jan 2024 19:57:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1C213858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D1C213858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706212649; cv=none; b=NTq0XTno5oRB9Q8UrKSFMBGwJVeyP2ev2grr3uJXcQkAgDYvSaEVh8kzPL5Y7fgv6lkH3vsyqDOPvoRZUNnUv2EF99k1qHqSQk1PDM2Cfs3o5mMy6YEGmvuZs+ujCRGfFB3BBbKqD7p1XtqNQf8QDS5L3YWKBgw5OQ/L2Ck/SMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706212649; c=relaxed/simple; bh=XSrEYC363OBYWDWy3dvJL3v0pL+lIThW67JiUbI0wcI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ftvo3itrP66/jhQw5iun1stHzQ3P15O21v/IesO9N5XkWwUfPKpyLKsGE8nQIRbQ3ShCNeMJPsUXuCYrnNvxKI9GqS71N+Tv4jOsiuNYLB4wfFo1EPjvbPhocsFPa7xCER0NNPHfJCNJ9hXZu/JA9ezzKPQpruLVIEOZKl0cUFM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40PHgQcj007555 for ; Thu, 25 Jan 2024 19:57:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=zjhpPth bhu919UEToGC3fhpn2ZsS8IrcsTrFFQB3N/c=; b=HwfpJ14bUcIsUsaGcetEtAC foY2ApCen7G8jFs0a/AJ+xyANtZxOdwz9Bmk6kQVdewaPKVNHhlLs5fwAqwcvDa6 DqJvUtB6i8wY/sUO18gmz8APkAdObr6hyG1NMWh3SYyBmvpebpUViduF3m6xg55Y 91pB9V+c9OpIACN/hDceSFUKwaR1UMv2OuiW47TjSd/RPz+UY13f7njfz9gLlQrX L/M4SNKb7Cy2BPZMvg5C9b2Q5Jj8OCASnaAenh7GkZmL0lFLUzhnivfMGG4lqczB ipERuo4xdpqfTUWvdt0ItKzGIkd3vpv6dMdAec5shJE067dOiVTrzk5FwFUXJUQ= = Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vufk9abxa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Jan 2024 19:57:23 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40PJvN8g024877 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Jan 2024 19:57:23 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 25 Jan 2024 11:57:22 -0800 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] aarch64: Fix undefinedness while testing the J constraint [PR100204] Date: Thu, 25 Jan 2024 11:57:12 -0800 Message-ID: <20240125195712.410550-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: yT8e8jNoGQabuy5TvYoIMJ_9mQEHJXns X-Proofpoint-ORIG-GUID: yT8e8jNoGQabuy5TvYoIMJ_9mQEHJXns X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-25_12,2024-01-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401250143 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789093686895504131 X-GMAIL-MSGID: 1789093686895504131 The J constraint can invoke undefined behavior due to it taking the negative of the ival if ival was HWI_MIN. The fix is simple as casting to `unsigned HOST_WIDE_INT` before doing the negative of it. This does that. Committed as obvious after build/test for aarch64-linux-gnu. gcc/ChangeLog: PR target/100204 * config/aarch64/constraints.md (J): Cast to `unsigned HOST_WIDE_INT` before taking the negative of it. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/constraints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md index 8566befd727..a2569cea510 100644 --- a/gcc/config/aarch64/constraints.md +++ b/gcc/config/aarch64/constraints.md @@ -118,7 +118,7 @@ (define_constraint "Uat" (define_constraint "J" "A constant that can be used with a SUB operation (once negated)." (and (match_code "const_int") - (match_test "aarch64_uimm12_shift (-ival)"))) + (match_test "aarch64_uimm12_shift (- (unsigned HOST_WIDE_INT) ival)"))) ;; We can't use the mode of a CONST_INT to determine the context in ;; which it is being used, so we must have a separate constraint for