diff options
-rw-r--r-- | llvm/test/CodeGen/X86/statepoint-vector.ll | 97 |
1 files changed, 59 insertions, 38 deletions
diff --git a/llvm/test/CodeGen/X86/statepoint-vector.ll b/llvm/test/CodeGen/X86/statepoint-vector.ll index 538d1756495..fe67b571304 100644 --- a/llvm/test/CodeGen/X86/statepoint-vector.ll +++ b/llvm/test/CodeGen/X86/statepoint-vector.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -verify-machineinstrs -stack-symbol-ordering=0 -mcpu=nehalem -debug-only=stackmaps < %s | FileCheck %s ; REQUIRES: asserts @@ -5,13 +6,17 @@ target triple = "x86_64-pc-linux-gnu" ; Can we lower a single vector? define <2 x i8 addrspace(1)*> @test(<2 x i8 addrspace(1)*> %obj) gc "statepoint-example" { +; CHECK-LABEL: test: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: subq $24, %rsp +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: movaps %xmm0, (%rsp) +; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: .Ltmp0: +; CHECK-NEXT: movaps (%rsp), %xmm0 +; CHECK-NEXT: addq $24, %rsp +; CHECK-NEXT: retq entry: -; CHECK-LABEL: @test -; CHECK: subq $24, %rsp -; CHECK: movaps %xmm0, (%rsp) -; CHECK: callq do_safepoint -; CHECK: movaps (%rsp), %xmm0 -; CHECK: addq $24, %rsp %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0, <2 x i8 addrspace(1)*> %obj) %obj.relocated = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token %safepoint_token, i32 7, i32 7) ; (%obj, %obj) ret <2 x i8 addrspace(1)*> %obj.relocated @@ -19,24 +24,28 @@ entry: ; Can we lower the base, derived pairs if both are vectors? define <2 x i8 addrspace(1)*> @test2(<2 x i8 addrspace(1)*> %obj, i64 %offset) gc "statepoint-example" { +; CHECK-LABEL: test2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: subq $40, %rsp +; CHECK-NEXT: .cfi_def_cfa_offset 48 +; CHECK-NEXT: movq %rdi, %xmm1 +; CHECK-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1] +; CHECK-NEXT: paddq %xmm0, %xmm1 +; CHECK-NEXT: movdqa %xmm0, {{[0-9]+}}(%rsp) +; CHECK-NEXT: movdqa %xmm1, (%rsp) +; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: .Ltmp1: +; CHECK-NEXT: movaps (%rsp), %xmm0 +; CHECK-NEXT: addq $40, %rsp +; CHECK-NEXT: retq entry: -; CHECK-LABEL: @test2 -; CHECK: subq $40, %rsp -; CHECK: movq %rdi, %xmm1 -; CHECK: pshufd $68, %xmm1, %xmm1 # xmm1 = xmm1[0,1,0,1] -; CHECK: paddq %xmm0, %xmm1 -; CHECK: movdqa %xmm0, 16(%rsp) -; CHECK: movdqa %xmm1, (%rsp) -; CHECK: callq do_safepoint -; CHECK: movaps (%rsp), %xmm0 -; CHECK: addq $40, %rsp %derived = getelementptr i8, <2 x i8 addrspace(1)*> %obj, i64 %offset %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0, <2 x i8 addrspace(1)*> %obj, <2 x i8 addrspace(1)*> %derived) %derived.relocated = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token %safepoint_token, i32 7, i32 8) ; (%obj, %derived) ret <2 x i8 addrspace(1)*> %derived.relocated } -; Originally, this was just a variant of @test2 above, but it ends up +; Originally, this was just a variant of @test2 above, but it ends up ; covering a bunch of interesting missed optimizations. Specifically: ; - We waste a stack slot for a value that a backend transform pass ; CSEd to another spilled one. @@ -44,16 +53,20 @@ entry: ; - We could in principal reuse the argument memory (%rsi) and do away ; with stack slots entirely. define <2 x i64 addrspace(1)*> @test3(i1 %cnd, <2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" { +; CHECK-LABEL: test3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: subq $40, %rsp +; CHECK-NEXT: .cfi_def_cfa_offset 48 +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: movaps (%rsi), %xmm0 +; CHECK-NEXT: movaps %xmm0, (%rsp) +; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp) +; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: .Ltmp2: +; CHECK-NEXT: movaps (%rsp), %xmm0 +; CHECK-NEXT: addq $40, %rsp +; CHECK-NEXT: retq entry: -; CHECK-LABEL: @test3 -; CHECK: subq $40, %rsp -; CHECK: testb $1, %dil -; CHECK: movaps (%rsi), %xmm0 -; CHECK-DAG: movaps %xmm0, (%rsp) -; CHECK-DAG: movaps %xmm0, 16(%rsp) -; CHECK: callq do_safepoint -; CHECK: movaps (%rsp), %xmm0 -; CHECK: addq $40, %rsp br i1 %cnd, label %taken, label %untaken taken: ; preds = %entry @@ -78,28 +91,36 @@ merge: ; preds = %untaken, %taken ; Can we handle vector constants? At the moment, we don't appear to actually ; get selection dag nodes for these. define <2 x i8 addrspace(1)*> @test4() gc "statepoint-example" { +; CHECK-LABEL: test4: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: subq $24, %rsp +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: xorps %xmm0, %xmm0 +; CHECK-NEXT: movaps %xmm0, (%rsp) +; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: .Ltmp3: +; CHECK-NEXT: movaps (%rsp), %xmm0 +; CHECK-NEXT: addq $24, %rsp +; CHECK-NEXT: retq entry: -; CHECK-LABEL: @test4 -; CHECK: subq $24, %rsp -; CHECK: xorps %xmm0, %xmm0 -; CHECK: movaps %xmm0, (%rsp) -; CHECK: callq do_safepoint -; CHECK: movaps (%rsp), %xmm0 -; CHECK: addq $24, %rsp %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0, <2 x i8 addrspace(1)*> zeroinitializer) %obj.relocated = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token %safepoint_token, i32 7, i32 7) ; (%obj, %obj) ret <2 x i8 addrspace(1)*> %obj.relocated } ; Check that we can lower a constant typed as i128 correctly. Note that the -; actual value is representable in 64 bits. We don't have a representation +; actual value is representable in 64 bits. We don't have a representation ; of larger than 64 bit constant in the StackMap format. define void @test5() gc "statepoint-example" { +; CHECK-LABEL: test5: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: callq do_safepoint +; CHECK-NEXT: .Ltmp4: +; CHECK-NEXT: popq %rax +; CHECK-NEXT: retq entry: -; CHECK-LABEL: @test5 -; CHECK: push -; CHECK: callq do_safepoint -; CHECK: pop %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 1, i128 0) ret void } |