Open
Description
https://godbolt.org/z/j78cddY1W
For the C code:
typedef struct {
char a;
char b;
char c;
int len;
char e;
int len2;
} __attribute__((packed)) str_t;
void foo(str_t *p __attribute__((align_value(4)))) {
p->len = 0;
p->len2 = 0;
}
The asm generated is:
foo:
sb zero, 3(a0)
sb zero, 4(a0)
sb zero, 5(a0)
sb zero, 6(a0)
sw zero, 8(a0)
ret
For 'len', the middle two 'sb' can be converted to one 'sh'.