xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/rip-rel-address.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -relocation-model=pic -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=PIC64
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=STATIC64
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Use %rip-relative addressing even in static mode on x86-64, because
5*9880d681SAndroid Build Coastguard Worker; it has a smaller encoding.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker@a = internal global double 3.4
8*9880d681SAndroid Build Coastguard Workerdefine double @foo() nounwind {
9*9880d681SAndroid Build Coastguard Worker  %a = load double, double* @a
10*9880d681SAndroid Build Coastguard Worker  ret double %a
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; PIC64:    movsd	_a(%rip), %xmm0
13*9880d681SAndroid Build Coastguard Worker; STATIC64: movsd	a(%rip), %xmm0
14*9880d681SAndroid Build Coastguard Worker}
15