public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: LuluCheng <chenglulu@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-3643] LoongArch: Support storing floating-point zero into MEM[base + index]. Date: Mon, 4 Sep 2023 01:48:43 +0000 (GMT) [thread overview] Message-ID: <20230904014843.26C843858296@sourceware.org> (raw) https://gcc.gnu.org/g:828130772c67c94dce0757d70b4e96fb7c14ea6e commit r14-3643-g828130772c67c94dce0757d70b4e96fb7c14ea6e Author: Guo Jie <guojie@loongson.cn> Date: Fri Sep 1 16:35:05 2023 +0800 LoongArch: Support storing floating-point zero into MEM[base + index]. 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. Diff: --- gcc/config/loongarch/loongarch.md | 12 ++++++------ .../gcc.target/loongarch/const-double-zero-stx.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index 0d15302f0452..25e2e1e05970 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -1915,13 +1915,13 @@ }) (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_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 000000000000..8fb04be8ff5d --- /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; +}
reply other threads:[~2023-09-04 1:48 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=20230904014843.26C843858296@sourceware.org \ --to=chenglulu@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).