public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "marc.glisse at normalesup dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug other/50384] New: Copying a char array Date: Tue, 13 Sep 2011 14:50:00 -0000 [thread overview] Message-ID: <bug-50384-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50384 Bug #: 50384 Summary: Copying a char array Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned@gcc.gnu.org ReportedBy: marc.glisse@normalesup.org #include <array> typedef std::array<char,7> X; X f(X,X); X g(X a,X b){return f(a,b);} I compiled this code on x86_64 with g++ -std=c++0x -Ofast and got: _Z1gSt5arrayIcLm7EES0_: .LFB837: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 subq $48, %rsp .cfi_def_cfa_offset 64 .cfi_offset 3, -16 call _Z1fSt5arrayIcLm7EES0_ movzbl %ah, %edx movb %al, (%rsp) movb %dl, 1(%rsp) movq %rax, %rdx shrq $16, %rdx movb %dl, 2(%rsp) movq %rax, %rdx shrq $24, %rdx movb %dl, 3(%rsp) movq %rax, %rdx movl (%rsp), %ecx shrq $32, %rdx movb %dl, 4(%rsp) movq %rax, %rdx shrq $40, %rdx movl %ecx, %esi movzbl %cl, %ebx movb %dl, 5(%rsp) movl %ecx, %edx movzwl 4(%rsp), %edi shrl $16, %edx movzbl %ch, %ecx shrl $24, %esi movzbl %dl, %edx movb %cl, %bh movzbl %sil, %esi salq $16, %rdx salq $24, %rsi movabsq $-1095216660481, %rcx orq %rbx, %rdx movq %rdi, %rbx addq $48, %rsp .cfi_def_cfa_offset 16 orq %rsi, %rdx movzbl %dil, %esi salq $32, %rsi andq %rcx, %rdx movzbl %bh, %ecx orq %rsi, %rdx movabsq $-280375465082881, %rsi salq $40, %rcx andq %rsi, %rdx orq %rcx, %rdx movabsq $71776119061217280, %rcx andq %rcx, %rax movabsq $-71776119061217281, %rcx andq %rcx, %rdx orq %rax, %rdx movq %rdx, %rax popq %rbx .cfi_def_cfa_offset 8 ret .cfi_endproc Ideally I would have liked a single jmp, but in any case this seems a bit long... (the attribute((aligned)) in versions <= 4.2 did help) Is that the best that can legally be done without alignment information?
next reply other threads:[~2011-09-13 14:48 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-09-13 14:50 marc.glisse at normalesup dot org [this message] 2011-09-14 8:24 ` [Bug other/50384] " marc.glisse at normalesup dot org 2012-01-28 20:34 ` [Bug middle-end/50384] Returning std::array is not optimal pinskia at gcc dot gnu.org 2012-01-28 20:57 ` marc.glisse at normalesup dot org 2021-07-21 0:45 ` pinskia 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-50384-4@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).