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 8 9 ; fn_ptr.ll 10 %class.A = type { i32 (...)** } 11 12 define i32 @test1() #0 { 13 ;ATOM-LABEL: test1: 14 entry: 15 %call = tail call %class.A* @_Z3facv() 16 %0 = bitcast %class.A* %call to void (%class.A*)*** 17 %vtable = load void (%class.A*)*** %0, align 8 18 %1 = load void (%class.A*)** %vtable, align 8 19 ;ATOM32: movl (%ecx), %ecx 20 ;ATOM32: calll *%ecx 21 ;ATOM-NOT32: calll *(%ecx) 22 ;ATOM64: movq (%rcx), %rcx 23 ;ATOM64: callq *%rcx 24 ;ATOM-NOT64: callq *(%rcx) 25 ;SLM32: movl (%ecx), %ecx 26 ;SLM32: calll *%ecx 27 ;SLM64: movq (%rcx), %rcx 28 ;SLM64: callq *%rcx 29 tail call void %1(%class.A* %call) 30 ret i32 0 31 } 32 33 declare %class.A* @_Z3facv() #1 34 35 ; virt_fn.ll 36 @p = external global void (i32)** 37 38 define i32 @test2() #0 { 39 ;ATOM-LABEL: test2: 40 entry: 41 %0 = load void (i32)*** @p, align 8 42 %1 = load void (i32)** %0, align 8 43 ;ATOM32: movl (%eax), %eax 44 ;ATOM32: calll *%eax 45 ;ATOM-NOT: calll *(%eax) 46 ;ATOM64: movq (%rax), %rax 47 ;ATOM64: callq *%rax 48 ;ATOM-NOT64: callq *(%rax) 49 ;SLM32: movl (%eax), %eax 50 ;SLM32: calll *%eax 51 ;SLM64: movq (%rax), %rax 52 ;SLM64: callq *%rax 53 tail call void %1(i32 2) 54 ret i32 0 55 } 56