From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 708A53858D20 for ; Sat, 2 Sep 2023 07:03:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 708A53858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcKfP-0002CL-EP for gcc-patches@gcc.gnu.org; Sat, 02 Sep 2023 03:03:39 -0400 Received: from loongson.cn (unknown [10.20.4.191]) by gateway (Coremail) with SMTP id _____8DxRvE+3vJkxvkdAA--.61265S3; Sat, 02 Sep 2023 15:03:27 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.191]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxWM0j3vJk14JpAA--.60387S4; Sat, 02 Sep 2023 15:03:25 +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 v2] LoongArch: Support storing floating-point zero into MEM[base + index]. Date: Sat, 2 Sep 2023 15:02:07 +0800 Message-Id: <20230902070207.31651-1-guojie@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8CxWM0j3vJk14JpAA--.60387S4 X-CM-SenderInfo: xjxryx3h6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoWxAw1kJrWUKr4UZFW3tF15Jrc_yoW5Zw45p3 95Aw1Fgw48Grnakw15Aay7Jws8CF1IkF4a9FWaqr9Ikayagr18ZF4rA3sIvFy5Ww1FqryF vr4Sgw45Zr4rKwbCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07URa0PUUUUU= Received-SPF: pass client-ip=114.242.206.163; envelope-from=guojie@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_SHORT,SPF_FAIL,SPF_HELO_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: v2: Modify commit message. gcc/ChangeLog: * config/loongarch/loongarch.md: Support 'G' -> 'k' in movsf_hardfloat and movdf_hardfloat. gcc/testsuite/ChangeLog: * gcc.target/loongarch/const-double-zero-stx.c: New test. --- gcc/config/loongarch/loongarch.md | 12 ++++++------ .../loongarch/const-double-zero-stx.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/const-double-zero-stx.c diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index b37e070660f..6f47c23a79c 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -1915,13 +1915,13 @@ (define_expand "movsf" }) (define_insn "*movsf_hardfloat" - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,m,f,k,m,*f,*r,*r,*r,*m") - (match_operand:SF 1 "move_operand" "f,G,m,f,k,f,G,*r,*f,*G*r,*m,*r"))] + [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,m,f,k,m,k,*f,*r,*r,*r,*m") + (match_operand:SF 1 "move_operand" "f,G,m,f,k,f,G,G,*r,*f,*G*r,*m,*r"))] "TARGET_HARD_FLOAT && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))" { return loongarch_output_move (operands[0], operands[1]); } - [(set_attr "move_type" "fmove,mgtf,fpload,fpstore,fpload,fpstore,store,mgtf,mftg,move,load,store") + [(set_attr "move_type" "fmove,mgtf,fpload,fpstore,fpload,fpstore,store,store,mgtf,mftg,move,load,store") (set_attr "mode" "SF")]) (define_insn "*movsf_softfloat" @@ -1946,13 +1946,13 @@ (define_expand "movdf" }) (define_insn "*movdf_hardfloat" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,m,f,k,m,*f,*r,*r,*r,*m") - (match_operand:DF 1 "move_operand" "f,G,m,f,k,f,G,*r,*f,*r*G,*m,*r"))] + [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,m,f,k,m,k,*f,*r,*r,*r,*m") + (match_operand:DF 1 "move_operand" "f,G,m,f,k,f,G,G,*r,*f,*r*G,*m,*r"))] "TARGET_DOUBLE_FLOAT && (register_operand (operands[0], DFmode) || reg_or_0_operand (operands[1], DFmode))" { return loongarch_output_move (operands[0], operands[1]); } - [(set_attr "move_type" "fmove,mgtf,fpload,fpstore,fpload,fpstore,store,mgtf,mftg,move,load,store") + [(set_attr "move_type" "fmove,mgtf,fpload,fpstore,fpload,fpstore,store,store,mgtf,mftg,move,load,store") (set_attr "mode" "DF")]) (define_insn "*movdf_softfloat" diff --git a/gcc/testsuite/gcc.target/loongarch/const-double-zero-stx.c b/gcc/testsuite/gcc.target/loongarch/const-double-zero-stx.c new file mode 100644 index 00000000000..8fb04be8ff5 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/const-double-zero-stx.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times {stx\..\t\$r0} 2 } } */ + +extern float arr_f[]; +extern double arr_d[]; + +void +test_f (int base, int index) +{ + arr_f[base + index] = 0.0; +} + +void +test_d (int base, int index) +{ + arr_d[base + index] = 0.0; +} -- 2.20.1