[Bug target/54589] struct offset add should be folded into address calculation
jaydeepchauhan1494 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 7 11:12:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54589
Jaydeep Chauhan <jaydeepchauhan1494 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jaydeepchauhan1494 at gmail dot co
| |m
--- Comment #10 from Jaydeep Chauhan <jaydeepchauhan1494 at gmail dot com> ---
Hi,
For the below case fix is not working.
#include <emmintrin.h>
struct param {
int a, b, c, d;
__m128i array[256];
};
struct param *p1;
void func(struct param *p, unsigned char *src, int *dst)
{
__m128i x = p1->array[*src];
*dst = _mm_cvtsi128_si32(x);
}
gcc generates for x86-64 with -O2:
func:
movzbl (%rsi), %eax
addq $1, %rax
salq $4, %rax
addq p1(%rip), %rax
movl (%rax), %eax
movl %eax, (%rdx)
ret
clang generates for x86_64 with -O2:
func:
movq p1(%rip), %rax
movzbl (%rsi), %ecx
shlq $4, %rcx
movl 16(%rax,%rcx), %eax
movl %eax, (%rdx)
retq
More information about the Gcc-bugs
mailing list