1; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -verify-machineinstrs | FileCheck %s -check-prefix=X32-Linux 2; RUN: llc < %s -mtriple=x86_64-linux-gnu -verify-machineinstrs | FileCheck %s -check-prefix=X64-Linux 3 4; The HiPE compiler (i.e., the native code compiler of the Erlang/OTP system) 5; adds a custom assembly prologue in order to efficiently manipulate the stack 6; at runtime. 7 8; Just to prevent the alloca from being optimized away. 9declare void @dummy_use(i32*, i32) 10 11define {i32, i32} @test_basic(i32 %hp, i32 %p) { 12 ; X32-Linux-LABEL: test_basic: 13 ; X32-Linux-NOT: calll inc_stack_0 14 15 ; X64-Linux-LABEL: test_basic: 16 ; X64-Linux-NOT: callq inc_stack_0 17 18 %mem = alloca i32, i32 10 19 call void @dummy_use (i32* %mem, i32 10) 20 %1 = insertvalue {i32, i32} undef, i32 %hp, 0 21 %2 = insertvalue {i32, i32} %1, i32 %p, 1 22 ret {i32, i32} %1 23} 24 25define cc 11 {i32, i32} @test_basic_hipecc(i32 %hp, i32 %p) { 26 ; X32-Linux-LABEL: test_basic_hipecc: 27 ; X32-Linux: leal -140(%esp), %ebx 28 ; X32-Linux-NEXT: cmpl 120(%ebp), %ebx 29 ; X32-Linux-NEXT: jb .LBB1_1 30 31 ; X32-Linux: ret 32 33 ; X32-Linux: .LBB1_1: 34 ; X32-Linux-NEXT: calll inc_stack_0 35 36 ; X64-Linux-LABEL: test_basic_hipecc: 37 ; X64-Linux: leaq -184(%rsp), %r14 38 ; X64-Linux-NEXT: cmpq 120(%rbp), %r14 39 ; X64-Linux-NEXT: jb .LBB1_1 40 41 ; X64-Linux: ret 42 43 ; X64-Linux: .LBB1_1: 44 ; X64-Linux-NEXT: callq inc_stack_0 45 46 %mem = alloca i32, i32 10 47 call void @dummy_use (i32* %mem, i32 10) 48 %1 = insertvalue {i32, i32} undef, i32 %hp, 0 49 %2 = insertvalue {i32, i32} %1, i32 %p, 1 50 ret {i32, i32} %2 51} 52 53define cc 11 {i32,i32,i32} @test_nocall_hipecc(i32 %hp,i32 %p,i32 %x,i32 %y) { 54 ; X32-Linux-LABEL: test_nocall_hipecc: 55 ; X32-Linux-NOT: calll inc_stack_0 56 57 ; X64-Linux-LABEL: test_nocall_hipecc: 58 ; X64-Linux-NOT: callq inc_stack_0 59 60 %1 = add i32 %x, %y 61 %2 = mul i32 42, %1 62 %3 = sub i32 24, %2 63 %4 = insertvalue {i32, i32, i32} undef, i32 %hp, 0 64 %5 = insertvalue {i32, i32, i32} %4, i32 %p, 1 65 %6 = insertvalue {i32, i32, i32} %5, i32 %p, 2 66 ret {i32, i32, i32} %6 67} 68 69!hipe.literals = !{ !0, !1, !2 } 70!0 = !{ !"P_NSP_LIMIT", i32 120 } 71!1 = !{ !"X86_LEAF_WORDS", i32 24 } 72!2 = !{ !"AMD64_LEAF_WORDS", i32 18 } 73