[all-commits] [llvm/llvm-project] 54baca: [X86] Always use rip-relative addressing on 64-bit...

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Mar 29 10:06:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 54bacaf31127ee9d19e8df7ad7de5c94a4fc7c62
      https://github.com/llvm/llvm-project/commit/54bacaf31127ee9d19e8df7ad7de5c94a4fc7c62
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-03-29 (Mon, 29 Mar 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86InstrInfo.cpp
    M llvm/test/CodeGen/X86/avx-cmp.ll
    M llvm/test/CodeGen/X86/mmx-fold-zero.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list