https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87507
Bug ID: 87507
Summary: IRA unnecessarily uses non-volatile registers during
register assignment
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: bergner at gcc dot gnu.org
Target Milestone: ---
Current trunk and GCC 7 (haven't tested anything else) unnecessarily use
non-volatile regs forcing unneeded save/restore code, along with unnecessary
reg moves. Using a different 128-bit type (ie, long double, etc.) for the
struct field types, I see the code I would expect to see.
I'm guessing this is a target issue (insn constraints?), so setting the
Component to that for now.
bergner@pike:~$ cat bug.c
typedef struct
{
__int128_t i0;
__int128_t i1;
} i2_t;
void
foo (long cond, i2_t *dst, __int128_t src)
{
if (cond)
{
dst->i0 = src;
dst->i1 = src;
}
}
bergner@pike:~$ .../xgcc -B... -O2 -S bug.c
bergner@pike:~$ cat bug2.s
.file "bug.c"
.abiversion 2
.section ".text"
.align 2
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
cmpdi 7,3,0
beqlr 7
std 30,-16(1)
std 31,-8(1)
.cfi_offset 30, -16
.cfi_offset 31, -8
mr 30,6
mr 31,5
addi 9,4,16
mr 10,30
mr 11,31
std 31,0(4)
std 30,8(4)
std 11,0(9)
std 10,8(9)
ld 30,-16(1)
ld 31,-8(1)
.cfi_restore 31
.cfi_restore 30
blr
.long 0
.byte 0,0,0,0,0,2,0,0
.cfi_endproc
.LFE0:
.size foo,.-foo
.ident "GCC: (GNU) 9.0.0 20181002 (experimental) [trunk revision
264800]"
.section .note.GNU-stack,"",@progbits