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 3 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 10;; 11;; We encounter the violation symptom when using PIC with lazy binding 12;; optimization. 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. 15;; 16;; The agreed solution is to disable PLT for regcall calling convention for 17;; SystemV using ELF format. 18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 19 20declare void @lazy() 21declare x86_regcallcc void @regcall_not_lazy() 22 23; CHECK-LABEL: foo: 24; CHECK: callq lazy@PLT 25; CHECK: callq *regcall_not_lazy@GOTPCREL(%rip) 26define void @foo() nounwind { 27 call void @lazy() 28 call void @regcall_not_lazy() 29 ret void 30} 31 32; CHECK-LABEL: tail_call_regcall: 33; CHECK: jmpq *regcall_not_lazy@GOTPCREL(%rip) 34define void @tail_call_regcall() nounwind { 35 tail call void @regcall_not_lazy() 36 ret void 37} 38 39; CHECK-LABEL: tail_call_regular: 40; CHECK: jmp lazy 41define void @tail_call_regular() nounwind { 42 tail call void @lazy() 43 ret void 44} 45