• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mcpu=atom -mtriple=i686-linux  | FileCheck -check-prefix=ATOM32 %s
2; RUN: llc < %s -mcpu=core2 -mtriple=i686-linux | FileCheck -check-prefix=ATOM-NOT32 %s
3; RUN: llc < %s -mcpu=atom -mtriple=x86_64-linux  | FileCheck -check-prefix=ATOM64 %s
4; RUN: llc < %s -mcpu=core2 -mtriple=x86_64-linux | FileCheck -check-prefix=ATOM-NOT64 %s
5; RUN: llc < %s -mcpu=slm -mtriple=i686-linux  | FileCheck -check-prefix=SLM32 %s
6; RUN: llc < %s -mcpu=slm -mtriple=x86_64-linux  | FileCheck -check-prefix=SLM64 %s
7; RUN: llc < %s -mcpu=goldmont -mtriple=i686-linux  | FileCheck -check-prefix=SLM32 %s
8; RUN: llc < %s -mcpu=goldmont -mtriple=x86_64-linux  | FileCheck -check-prefix=SLM64 %s
9
10
11; fn_ptr.ll
12%class.A = type { i32 (...)** }
13
14define i32 @test1() #0 {
15  ;ATOM-LABEL: test1:
16entry:
17  %call = tail call %class.A* @_Z3facv()
18  %0 = bitcast %class.A* %call to void (%class.A*)***
19  %vtable = load void (%class.A*)**, void (%class.A*)*** %0, align 8
20  %1 = load void (%class.A*)*, void (%class.A*)** %vtable, align 8
21  ;ATOM32: movl (%ecx), %ecx
22  ;ATOM32: calll *%ecx
23  ;ATOM-NOT32: calll *(%ecx)
24  ;ATOM64: movq (%rcx), %rcx
25  ;ATOM64: callq *%rcx
26  ;ATOM-NOT64: callq *(%rcx)
27  ;SLM32: movl (%ecx), %ecx
28  ;SLM32: calll *%ecx
29  ;SLM64: movq (%rcx), %rcx
30  ;SLM64: callq *%rcx
31  tail call void %1(%class.A* %call)
32  ret i32 0
33}
34
35declare %class.A* @_Z3facv() #1
36
37; virt_fn.ll
38@p = external global void (i32)**
39
40define i32 @test2() #0 {
41  ;ATOM-LABEL: test2:
42entry:
43  %0 = load void (i32)**, void (i32)*** @p, align 8
44  %1 = load void (i32)*, void (i32)** %0, align 8
45  ;ATOM32: movl (%eax), %eax
46  ;ATOM32: calll *%eax
47  ;ATOM-NOT: calll *(%eax)
48  ;ATOM64: movq (%rax), %rax
49  ;ATOM64: callq *%rax
50  ;ATOM-NOT64: callq *(%rax)
51  ;SLM32: movl (%eax), %eax
52  ;SLM32: calll *%eax
53  ;SLM64: movq (%rax), %rax
54  ;SLM64: callq *%rax
55  tail call void %1(i32 2)
56  ret i32 0
57}
58