xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/rip-rel-lea.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=PIC64
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-pc-linux-gnux32 -relocation-model=pic | FileCheck %s -check-prefix=PICX32
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=PIC32
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; Use %rip-relative addressing even in static mode on x86-64, because
6*9880d681SAndroid Build Coastguard Worker; it has a smaller encoding.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@a = internal global double 3.4
9*9880d681SAndroid Build Coastguard Workerdefine double* @foo() nounwind {
10*9880d681SAndroid Build Coastguard Worker  %a = getelementptr double, double* @a, i64 0
11*9880d681SAndroid Build Coastguard Worker  ret double* %a
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; PIC64:    leaq	a(%rip)
14*9880d681SAndroid Build Coastguard Worker; PICX32:   leal	a(%rip)
15*9880d681SAndroid Build Coastguard Worker; PIC32:    leal	a@GOTOFF(%eax)
16*9880d681SAndroid Build Coastguard Worker}
17