From patchwork Thu Nov 23 03:05:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guo Jie X-Patchwork-Id: 168711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp235015vqx; Wed, 22 Nov 2023 21:34:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQzjiaqyvm28O7Jmue1ewYvt6zDemJoMgcZXMViOE1pAS2Lv7dJZ4vdS2r29Yx0AF+MIvZ X-Received: by 2002:a05:6214:2341:b0:679:db60:a3a3 with SMTP id hu1-20020a056214234100b00679db60a3a3mr4823215qvb.19.1700717698555; Wed, 22 Nov 2023 21:34:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700717698; cv=pass; d=google.com; s=arc-20160816; b=NuWzE4QjMk8QYipe7htMUPzJ3L7HCk2lmaBThthO5ZrsqhK6vApOiJhO8BAGZXILIl LSyjpJw31Ifumb/CRa2n+l7r8ubDKVEF+NEC2TLXqh/PbtpUBbPrrNE7US1lYKEKQQ5+ 5hAC9y+MV25/3MbGLMAV5DAQZhW4Nig+S8I6kP2Y9HIXmfTcNGVjd4n0bnxZqyx/CASK IaUkDHw+kdcDUBpvMKwP1g5oeqJODPDkFsR1fh0WCy0SMdNOaivP6cW7E2+ezbpU61yG e4/asM7sgD7yBa7jYz90ZbRp1o3ay5AmtuhTSAe8mliKYPf/6xEZnsrIgcwTqnxPNgYX TFNg== 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:arc-filter :dmarc-filter:delivered-to; bh=7nQKnkR0vlnLUsJpbPFszQH0pjJF8alg8kQIKPbgutg=; fh=FCC/Zx3UOwReG8Kz3H/ln+uGOf+6klnWwvVPHAnfABw=; b=DrG9dQctF4g+dyfRVKqgXarrvNfSDmBCMffYS1smtRsft06W22Ay2rcB5mpmY1SknJ 6gBR9Excp047oF3g5zEPf0S9Kb2/ivikBriZe9YMpjbH1U2GwdH1fbhy0d3WfT74NKh4 5uEQSzG0KkYwTWMsveID5ZiHgHIrSMpJ7nO8iTTWL8sOdxmGGLO0CqKayYZgZ8kiM7BT 5O87KAXySF5TYal5IDfqc70qp4RiMEtvyi6wi16kFZOha/4255/ykPIGyZNwOD9Se4GE Z6T/PcUoXyTeIYI1c2OSh80Q3AYEQRqwkUsbZ+Tt1jF2fipIgd7UfjChRMGewM2rD+PO zurA== ARC-Authentication-Results: i=2; mx.google.com; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t9-20020a0cea29000000b00679ceb7c72csi494004qvp.168.2023.11.22.21.34.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 21:34:58 -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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E01D8396D4AC for ; Thu, 23 Nov 2023 03:06:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id F288B38410C7 for ; Thu, 23 Nov 2023 03:06:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F288B38410C7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F288B38410C7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700708769; cv=none; b=UtAj3fT/rvbI1O6q+E9QTKbpLAn/UNeeXwuA74/VME0aADF9PdLLamE85SWw0oNgsjZthF04K5VPrzRQTFcyjyaw9bOMV6jg4cPRrrhnlBhaozABqqzkkbMLROGMkCCCDUqnb3bPZQ4S3jaByoTb75onvxVVQPLp2ZKBibR9M0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700708769; c=relaxed/simple; bh=3nVFwGWSa7LPvbI1UxiPTD0jj0i0wH+GEfOh09BAxLY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=alkMRS7TnD7FCziDtv5WXCbeeVECG3Oap9n95gGwbpmKhx7vknFvJDlO//UMuE1hCqrExycsUx/f58Jvv4XBMbRAwENt+dLeztqnIj+gS0jgG44t+/OBx6cLXlhSprWdUjB8hVxjB/QNSBzGQSkCwiPWAOBVeic4YmqhHpoKWBo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.20.4.191]) by gateway (Coremail) with SMTP id _____8Cxc_CawV5l2Ss8AA--.53515S3; Thu, 23 Nov 2023 11:06:02 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.191]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxS9yWwV5lOkRKAA--.31938S4; Thu, 23 Nov 2023 11:06:01 +0800 (CST) From: Guo Jie To: gcc-patches@gcc.gnu.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, i@xen0n.name, xry111@xry111.site, Guo Jie Subject: [PATCH] LoongArch: Fix runtime error in a gcc build with --with-build-config=bootstrap-ubsan Date: Thu, 23 Nov 2023 11:05:56 +0800 Message-Id: <20231123030556.31356-1-guojie@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxS9yWwV5lOkRKAA--.31938S4 X-CM-SenderInfo: xjxryx3h6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj9xXoWrKr4xuryrXFW5ZFWfKw1ruFX_yoW3trX_ZF 13tF1DCr47Aay8Z3Z0qa4rtw1UXF1ktFn0vFyDAF4xCF1rXr13ArW8X3W5Zr1Yk34UW3Z8 JrW0kr9xCrW7tosvyTuYvTs0mTUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb7kYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwA2z4x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAF wI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7V AKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x 0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU7MmhUUUUU X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: 1783331761290090339 X-GMAIL-MSGID: 1783331761290090339 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_split_plus_constant): avoid left shift of negative value -0x8000. --- gcc/config/loongarch/loongarch.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 33357c670e1..81cd9fa1e7c 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -4249,7 +4249,7 @@ loongarch_split_plus_constant (rtx *op, machine_mode mode) else if (loongarch_addu16i_imm12_operand_p (v, mode)) a = (v & ~HWIT_UC_0xFFF) + ((v & 0x800) << 1); else if (mode == DImode && DUAL_ADDU16I_OPERAND (v)) - a = (v > 0 ? 0x7fff : -0x8000) << 16; + a = (v > 0 ? 0x7fff0000 : ~0x7fffffff); else gcc_unreachable ();