This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/71509] Bitfield causes load hit store with larger store than load
- From: "npiggin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 11 May 2017 06:46:56 +0000
- Subject: [Bug middle-end/71509] Bitfield causes load hit store with larger store than load
- Auto-submitted: auto-generated
- References: <bug-71509-4@http.gcc.gnu.org/bugzilla/>
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.