1 ; RUN: llc -verify-machineinstrs -mtriple=i686-linux < %s | FileCheck --implicit-check-not="jmp.*\*" --implicit-check-not="call.*\*" %s
3 ; Test 32-bit retpoline when -mregparm=3 is used. This case is interesting
4 ; because there are no available scratch registers. The Linux kernel builds
5 ; with -mregparm=3, so we need to support it. TCO should fail because we need
8 define void @call_edi(ptr %fp) #0 {
10 tail call void %fp(i32 inreg 0, i32 inreg 0, i32 inreg 0)
14 ; CHECK-LABEL: call_edi:
15 ; EDI is used, so it must be saved.
17 ; CHECK-DAG: xorl %eax, %eax
18 ; CHECK-DAG: xorl %edx, %edx
19 ; CHECK-DAG: xorl %ecx, %ecx
20 ; CHECK-DAG: movl {{.*}}, %edi
21 ; CHECK: calll __llvm_retpoline_edi
25 define void @edi_external(ptr %fp) #1 {
27 tail call void %fp(i32 inreg 0, i32 inreg 0, i32 inreg 0)
31 ; CHECK-LABEL: edi_external:
33 ; CHECK-DAG: xorl %eax, %eax
34 ; CHECK-DAG: xorl %edx, %edx
35 ; CHECK-DAG: xorl %ecx, %ecx
36 ; CHECK-DAG: movl {{.*}}, %edi
37 ; CHECK: calll __x86_indirect_thunk_edi
41 attributes #0 = { "target-features"="+retpoline-indirect-calls" }
42 attributes #1 = { "target-features"="+retpoline-indirect-calls,+retpoline-external-thunk" }