brintos

brintos / llvm-project-archived public Read only

0
0
Text · 843 B · 4e9176f Raw
31 lines · plain
1; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s2; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -fast-isel | FileCheck %s3 4; Test calling function pointer passed in struct5 6;    The function argument `h' in7 8;    struct foo {9;      void (*f) (void);10;      int i;11;    };12;    void13;    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 3219;    bits of %rdi register and the `i' field is in the upper 32 bits of %rdi20;    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 i3225  %0 = inttoptr i32 %h.sroa.0.0.extract.trunc to ptr26; CHECK: movl	%edi, %e[[REG:.*]]27  tail call void %0() nounwind28; CHECK: jmpq	*%r[[REG]]29  ret void30}31