1 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s
2 ; RUN: llc -mtriple=x86_64-freebsd -relocation-model=pic < %s | FileCheck %s
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ;; According to x86-64 psABI, xmm0-xmm7 can be used to pass function parameters.
6 ;; However regcall calling convention uses also xmm8-xmm15 to pass function
7 ;; parameters which violates x86-64 psABI.
8 ;; Detail info about it can be found at:
9 ;; https://sourceware.org/bugzilla/show_bug.cgi?id=21265
11 ;; We encounter the violation symptom when using PIC with lazy binding
13 ;; In that case the PLT mechanism as described in x86_64 psABI will
14 ;; not preserve xmm8-xmm15 registers and will lead to miscompilation.
16 ;; The agreed solution is to disable PLT for regcall calling convention for
17 ;; SystemV using ELF format.
18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 declare x86_regcallcc void @regcall_not_lazy()
24 ; CHECK: callq lazy@PLT
25 ; CHECK: callq *regcall_not_lazy@GOTPCREL(%rip)
26 define void @foo() nounwind {
28 call void @regcall_not_lazy()
32 ; CHECK-LABEL: tail_call_regcall:
33 ; CHECK: jmpq *regcall_not_lazy@GOTPCREL(%rip)
34 define void @tail_call_regcall() nounwind {
35 tail call void @regcall_not_lazy()
39 ; CHECK-LABEL: tail_call_regular:
41 define void @tail_call_regular() nounwind {
42 tail call void @lazy()