[Bug c/62139] New: Tilera tilepro: useless stack pointer operations

jose.parera at upm dot es gcc-bugzilla@gcc.gnu.org
Thu Aug 14 16:29:00 GMT 2014


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

            Bug ID: 62139
           Summary: Tilera tilepro: useless stack pointer operations
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jose.parera at upm dot es

I made a C function to split a register into halves and return them as a
struct. The code works fine but adds a couple of useless instructions
concerning the stack that cause a performance penalty.

typedef struct {
    uint32_t y0;
    uint32_t y1;
} __tpro_split_t;

__tpro_split_t split(uint32_t a) {
    __tpro_split_t res = {
        .y0 = __insn_srai(__insn_shli(a, 16), 16),
        .y1 = __insn_srai(a, 16)
    };
    return res;
}

The assembler code is

.cfi_startproc
{
shli    r10, r0, 16
srai    r1, r0, 16
}
{
addi    sp, sp, -8            <== useless
.cfi_def_cfa_offset 8
srai    r0, r10, 16
}
{
addi    sp, sp, 8             <== useless
.cfi_def_cfa_offset 0
jrp    lr
}
.cfi_endproc

I think that this issue is quite similar to those at bug #48941 but in this
case for Tilera TilePro architecture, and probably, also TileGx.



More information about the Gcc-bugs mailing list