public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/100951] New: vec_duplicate<mode> leads to worse code Date: Mon, 07 Jun 2021 20:08:24 +0000 [thread overview] Message-ID: <bug-100951-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100951 Bug ID: 100951 Summary: vec_duplicate<mode> leads to worse code Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: rguenther at suse dot de Target Milestone: --- After I added ;; Modes handled by broadcast patterns. (define_mode_iterator INT_BROADCAST_MODE [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI (V8DI "TARGET_AVX512F") (V4DI "TARGET_64BIT") V2DI]) ;; Broadcast from an integer. NB: Enable broadcast only if we can move ;; from GPR to SSE register directly. */ (define_expand "vec_duplicate<mode>" [(set (match_operand:INT_BROADCAST_MODE 0 "register_operand") (vec_duplicate:INT_BROADCAST_MODE (match_operand:<ssescalarmode> 1 "nonimmediate_operand")))] "TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC" { ix86_expand_integer_vec_duplicate (operands); DONE; }) to x86 backend, I got [hjl@gnu-cfl-2 gcc]$ cat /tmp/x.c typedef short __attribute__((__vector_size__ (8 * sizeof (short)))) V; V v, w; void foo (void) { w = __builtin_shuffle (v != v, 0 < (V) {}, (V) {192} >> 5); } [hjl@gnu-cfl-2 gcc]$ ./xgcc -B./ -S /tmp/x.c [hjl@gnu-cfl-2 gcc]$ cat x.s .file "x.c" .text .globl v .bss .align 16 .type v, @object .size v, 16 v: .zero 16 .globl w .align 16 .type w, @object .size w, 16 w: .zero 16 .text .globl foo .type foo, @function foo: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $0, %eax movd %eax, %xmm0 punpcklwd %xmm0, %xmm0 pshufd $0, %xmm0, %xmm0 movaps %xmm0, w(%rip) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 12.0.0 20210607 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 gcc]$ since middld-end leaves us with an unfolded constant CTOR.
next reply other threads:[~2021-06-07 20:08 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-07 20:08 hjl.tools at gmail dot com [this message] 2021-06-08 7:52 ` [Bug middle-end/100951] " rguenth at gcc dot gnu.org 2021-06-08 8:48 ` cvs-commit at gcc dot gnu.org 2021-06-08 8:48 ` rguenth at gcc dot gnu.org 2021-09-17 6:48 ` 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-100951-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).