https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87678
Bug ID: 87678 Summary: Redundant vmovss with -fPIC Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: ubizjak at gmail dot com Target Milestone: --- Target: i386 [hjl@gnu-efi-2 broadcast-1]$ cat y.c #include <immintrin.h> float foo (__m128 x) { return ((__v4sf) x)[0] * 2.387f; } [hjl@gnu-efi-2 broadcast-1]$ gcc -O2 y.c -mfpmath=sse -fpic -m32 -S -mavx c[hjl@gnu-efi-2 broadcast-1]$ cat y.s .file "y.c" .text .p2align 4,,15 .globl foo .type foo, @function foo: .LFB5086: .cfi_startproc call __x86.get_pc_thunk.ax addl $_GLOBAL_OFFSET_TABLE_, %eax subl $28, %esp .cfi_def_cfa_offset 32 vmovss .LC0@GOTOFF(%eax), %xmm1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This isn't needed. vmulss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 12(%esp) flds 12(%esp) addl $28, %esp .cfi_def_cfa_offset 4 ret .cfi_endproc .LFE5086: .size foo, .-foo We should replace vmovss .LC0@GOTOFF(%eax), %xmm1 vmulss %xmm1, %xmm0, %xmm0 with vmulss .LC0@GOTOFF(%eax), %xmm0, %xmm0