This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/71509] Bitfield causes load hit store with larger store than load


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

Nicholas Piggin <npiggin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |npiggin at gmail dot com

--- Comment #5 from Nicholas Piggin <npiggin at gmail dot com> ---
This test case seems like it may be related. It does the right thing and uses
all 4 byte ops when the 8 byte alignment is removed. I post it here because it
may not always be the case that smallest op is best

struct s {
        unsigned long align1;
        union {
                unsigned int blah;
                unsigned int a:1;
        };
};

void test2(struct s *s)
{
        s->blah = 100;
        if (s->a)
                asm volatile("#blah");
}

Generates (gcc 7.0.1)

test2:
        li 9,100
        stw 9,8(3)
        ld 9,8(3)
        andi. 9,9,0x1
        beqlr 0
#APP
 # 29 "a.c" 1
        #blah
 # 0 "" 2
#NO_APP
        blr

There is a more general case of mismatched load and store sizes in unions with
different size types, but in this case the sizes could be matched I think.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]