https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121062

            Bug ID: 121062
           Summary: integer registers of vector constant load shouldn't go
                    through memory
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com
  Target Milestone: ---
            Target: x86-64

[hjl@gnu-zen4-1 pr121015]$ cat x.c
typedef int __attribute__((__vector_size__ (4))) S;
extern int bar (S);

int
foo ()
{
  return bar ((S){-1});
}
[hjl@gnu-zen4-1 pr121015]$ gcc -Og -fno-dce -mtune=generic -S x.c
[hjl@gnu-zen4-1 pr121015]$ cat x.s
        .file   "x.c"
        .text
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        movl    .LC0(%rip), %edi

We should generate "movl $-1, %edi" here.

        call    bar
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .section        .rodata.cst4,"aM",@progbits,4
        .align 4
.LC0:
        .long   -1
        .ident  "GCC: (GNU) 15.1.1 20250521 (Red Hat 15.1.1-2)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-zen4-1 pr121015]$

Reply via email to