public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vda.linux at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/100320] [8/9/10/11/12 Regression] 32-bit x86 memcpy is suboptimal Date: Wed, 28 Apr 2021 15:43:17 +0000 [thread overview] Message-ID: <bug-100320-4-ZAJxPvwJzY@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100320-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100320 --- Comment #2 from Denis Vlasenko <vda.linux at googlemail dot com> --- The relevant code in current git seems to be: static void expand_set_or_cpymem_via_rep (rtx destmem, rtx srcmem, rtx destptr, rtx srcptr, rtx value, rtx orig_value, rtx count, machine_mode mode, bool issetmem) { rtx destexp; rtx srcexp; rtx countreg; HOST_WIDE_INT rounded_count; /* If possible, it is shorter to use rep movs. TODO: Maybe it is better to move this logic to decide_alg. */ if (mode == QImode && CONST_INT_P (count) && !(INTVAL (count) & 3) && !TARGET_PREFER_KNOWN_REP_MOVSB_STOSB && (!issetmem || orig_value == const0_rtx)) mode = SImode; if (destptr != XEXP (destmem, 0) || GET_MODE (destmem) != BLKmode) destmem = adjust_automodify_address_nv (destmem, BLKmode, destptr, 0); countreg = ix86_zero_extend_to_Pmode (scale_counter (count, GET_MODE_SIZE (mode))); if (mode != QImode) { destexp = gen_rtx_ASHIFT (Pmode, countreg, GEN_INT (exact_log2 (GET_MODE_SIZE (mode)))); destexp = gen_rtx_PLUS (Pmode, destexp, destptr); } else destexp = gen_rtx_PLUS (Pmode, destptr, countreg); if ((!issetmem || orig_value == const0_rtx) && CONST_INT_P (count)) { rounded_count = ROUND_DOWN (INTVAL (count), (HOST_WIDE_INT) GET_MODE_SIZE (mode)); destmem = shallow_copy_rtx (destmem); set_mem_size (destmem, rounded_count); } else if (MEM_SIZE_KNOWN_P (destmem)) clear_mem_size (destmem); if (issetmem) { value = force_reg (mode, gen_lowpart (mode, value)); emit_insn (gen_rep_stos (destptr, countreg, destmem, value, destexp)); } else { if (srcptr != XEXP (srcmem, 0) || GET_MODE (srcmem) != BLKmode) srcmem = adjust_automodify_address_nv (srcmem, BLKmode, srcptr, 0); if (mode != QImode) { srcexp = gen_rtx_ASHIFT (Pmode, countreg, GEN_INT (exact_log2 (GET_MODE_SIZE (mode)))); srcexp = gen_rtx_PLUS (Pmode, srcexp, srcptr); } else srcexp = gen_rtx_PLUS (Pmode, srcptr, countreg); if (CONST_INT_P (count)) { rounded_count = ROUND_DOWN (INTVAL (count), (HOST_WIDE_INT) GET_MODE_SIZE (mode)); srcmem = shallow_copy_rtx (srcmem); set_mem_size (srcmem, rounded_count); } else { if (MEM_SIZE_KNOWN_P (srcmem)) clear_mem_size (srcmem); } emit_insn (gen_rep_mov (destptr, destmem, srcptr, srcmem, countreg, destexp, srcexp)); } }
next prev parent reply other threads:[~2021-04-28 15:43 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-28 15:09 [Bug c/100320] New: regression: " vda.linux at googlemail dot com 2021-04-28 15:39 ` [Bug target/100320] [8/9/10/11/12 Regression] " jakub at gcc dot gnu.org 2021-04-28 15:43 ` vda.linux at googlemail dot com [this message] 2021-04-29 7:10 ` rguenth at gcc dot gnu.org 2021-05-14 9:54 ` [Bug target/100320] [9/10/11/12 " jakub at gcc dot gnu.org 2021-06-01 8:20 ` rguenth at gcc dot gnu.org 2022-05-27 9:45 ` [Bug target/100320] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:44 ` jakub at gcc dot gnu.org 2023-07-07 10:39 ` [Bug target/100320] [11/12/13/14 " rguenth at gcc dot gnu.org
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=bug-100320-4-ZAJxPvwJzY@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).