Skip to content

Commit e2a37cd

Browse files
committed
[StatepointLowering] Precommit test for #68439
1 parent 5b39d8d commit e2a37cd

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

llvm/test/CodeGen/X86/statepoint-call-lowering.ll

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,49 @@ entry:
234234
ret void
235235
}
236236

237+
declare signext i1 @signext_return_i1()
238+
239+
; Check that the generated code takes the zeroext and signext return attributes
240+
; on the GC result into account. The attribute in the return position allows the
241+
; caller to assume that the callee did the extension already.
242+
243+
define i8 @test_signext_return(ptr) gc "statepoint-example" {
244+
; CHECK-LABEL: test_signext_return:
245+
; CHECK: # %bb.0: # %entry
246+
; CHECK-NEXT: pushq %rax
247+
; CHECK-NEXT: .cfi_def_cfa_offset 16
248+
; CHECK-NEXT: callq signext_return_i1@PLT
249+
; CHECK-NEXT: .Ltmp10:
250+
; CHECK-NEXT: andb $1, %al
251+
; CHECK-NEXT: negb %al
252+
; CHECK-NEXT: popq %rcx
253+
; CHECK-NEXT: .cfi_def_cfa_offset 8
254+
; CHECK-NEXT: retq
255+
entry:
256+
%safepoint_token = tail call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @signext_return_i1, i32 0, i32 0, i32 0, i32 0)
257+
%call1 = call signext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
258+
%ext = sext i1 %call1 to i8
259+
ret i8 %ext
260+
}
261+
262+
define i8 @test_zeroext_return() gc "statepoint-example" {
263+
; CHECK-LABEL: test_zeroext_return:
264+
; CHECK: # %bb.0: # %entry
265+
; CHECK-NEXT: pushq %rax
266+
; CHECK-NEXT: .cfi_def_cfa_offset 16
267+
; CHECK-NEXT: callq return_i1@PLT
268+
; CHECK-NEXT: .Ltmp11:
269+
; CHECK-NEXT: andb $1, %al
270+
; CHECK-NEXT: popq %rcx
271+
; CHECK-NEXT: .cfi_def_cfa_offset 8
272+
; CHECK-NEXT: retq
273+
entry:
274+
%safepoint_token = tail call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0)
275+
%call1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
276+
%ext = zext i1 %call1 to i8
277+
ret i8 %ext
278+
}
279+
237280
declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
238281
declare i1 @llvm.experimental.gc.result.i1(token)
239282

0 commit comments

Comments
 (0)