[X86] Always use rip-relative addressing on 64-bit when rematerializing all zeros...
authorCraig Topper <craig.topper@sifive.com>
Mon, 29 Mar 2021 16:54:26 +0000 (09:54 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 29 Mar 2021 17:06:17 +0000 (10:06 -0700)
commit54bacaf31127ee9d19e8df7ad7de5c94a4fc7c62
tree1dda5b402a15e078bc60c7b6ab8001868e7d6670
parentef76a333faca3e41036f60bb598173d410aab24b
[X86] Always use rip-relative addressing on 64-bit when rematerializing all zeros/ones registers using a folded load.

Previously we only used RIP relative when PIC was enabled. But
we know we're in small/kernel code model here so we should
be able to always use RIP-relative which will give a smaller
encoding.

Here's a godbolt link that demonstrates the current codegen https://godbolt.org/z/j3158o
Note in the non-PIC version the load from .LCPI0_0 doesn't use
RIP-relative addressing, but if you change the constant in the
source from 0.0 to 1.0 it will become RIP-relative.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D97208
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/avx-cmp.ll
llvm/test/CodeGen/X86/mmx-fold-zero.ll