Index: test/CodeGen/X86/statepoint-call-lowering.ll =================================================================== --- test/CodeGen/X86/statepoint-call-lowering.ll +++ test/CodeGen/X86/statepoint-call-lowering.ll @@ -60,7 +60,7 @@ ret float %call1 } -define i1 @test_relocate(i32* %a) { +define i1 @test_relocate_noop(i32* %a) { ; CHECK-LABEL: test_relocate ; Check that an ununsed relocate has no code-generation impact ; CHECK: pushq %rax @@ -75,6 +75,57 @@ ret i1 %call2 } +define i32 @test_relocate_integer(i32* %i) { +; CHECK-LABEL: test_relocate_integer +; Check that relocation of an integer is lowered correctly +; CHECK: pushq %rax +; CHECK: callq return_i1 +; CHECK-NEXT: .Ltmp16: +; CHECK-NEXT: movq (%rsp), %rax +; CHECK-NEXT: movl (%rax), %eax +; CHECK-NEXT: popq %rdx +; CHECK-NEXT: retq +entry: + %tok = tail call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, i32* %i) + %i-new = call i32* @llvm.experimental.gc.relocate.p0i32(i32 %tok, i32 4, i32 4) + %ret = load i32* %i-new + ret i32 %ret +} + +define [3 x i32] @test_relocate_array([3 x i32]* %v) { +; CHECK-LABEL: test_relocate_array +; Check that relocation of an array of integers is lowered correctly +; CHECK: pushq %rax +; CHECK: callq return_i1 +; CHECK-NEXT: .Ltmp19: +; CHECK-NEXT: movq (%rsp), %rcx +; CHECK-NEXT: movl (%rcx), %eax +; CHECK-NEXT: movl 4(%rcx), %edx +; CHECK-NEXT: movl 8(%rcx), %ecx +; CHECK-NEXT: popq %rsi +; CHECK-NEXT: retq + %tok = call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, [3 x i32]* %v) + %v-new = call [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(i32 %tok, i32 4, i32 4) + %ret = load [3 x i32]* %v-new + ret [3 x i32] %ret +} + +define <3 x i32> @test_relocate_vector(<3 x i32>* %v) { +; CHECK-LABEL: test_relocate_vector +; Check that relocation of a vector of integers is lowered correctly +; CHECK: pushq %rax +; CHECK: callq return_i1 +; CHECK-NEXT: .Ltmp22: +; CHECK-NEXT: movq (%rsp), %rax +; TODO: How should this be lowered? +; CHECK: popq %rax +; CHECK-NEXT: retq + %tok = call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, <3 x i32>* %v) + %v-new = call <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(i32 %tok, i32 4, i32 4) + %ret = load <3 x i32>* %v-new + ret <3 x i32> %ret +} + declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...) declare i1 @llvm.experimental.gc.result.int.i1(i32) @@ -88,3 +139,5 @@ declare float @llvm.experimental.gc.result.float.f32(i32) declare i32* @llvm.experimental.gc.relocate.p0i32(i32, i32, i32) +declare [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(i32, i32, i32) +declare <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(i32, i32, i32)