[Codegen] Adjust saturation test. NFC.
[llvm-core.git] / test / CodeGen / X86 / regcall-no-plt.ll
blobd525448b60ca8f891f7950fa047cdd6276006910
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 
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.
16 ;; The agreed solution is to disable PLT for regcall calling convention for 
17 ;; SystemV using ELF format.
18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20 declare void @lazy()
21 declare x86_regcallcc void @regcall_not_lazy()
23 ; CHECK-LABEL: foo:
24 ; CHECK:  callq lazy@PLT
25 ; CHECK:  callq *regcall_not_lazy@GOTPCREL(%rip)
26 define void @foo() nounwind {
27   call void @lazy()
28   call void @regcall_not_lazy()
29   ret void
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()
36   ret void
39 ; CHECK-LABEL: tail_call_regular:
40 ; CHECK:   jmp lazy
41 define void @tail_call_regular() nounwind {
42   tail call void @lazy()
43   ret void