1; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s 2; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -fast-isel | FileCheck %s 3 4; Test calling function pointer passed in struct 5 6; The fuction argument `h' in 7 8; struct foo { 9; void (*f) (void); 10; int i; 11; }; 12; void 13; bar (struct foo h) 14; { 15; h.f (); 16; } 17 18; is passed in the 64-bit %rdi register. The `f' field is in the lower 32 19; bits of %rdi register and the `i' field is in the upper 32 bits of %rdi 20; register. We need to zero-extend %edi to %rdi before branching via %rdi. 21 22define void @bar(i64 %h.coerce) nounwind { 23entry: 24 %h.sroa.0.0.extract.trunc = trunc i64 %h.coerce to i32 25 %0 = inttoptr i32 %h.sroa.0.0.extract.trunc to void ()* 26; CHECK: movl %edi, %e[[REG:.*]] 27 tail call void %0() nounwind 28; CHECK: jmpq *%r[[REG]] 29 ret void 30} 31