Skip to content

Commit 0dcc653

Browse files
authored
[X86] Add combine tests for pointers of mixed sizes (NFC) (#68219)
Precommit for #67168 to solve #66873
1 parent 5d83756 commit 0dcc653

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

llvm/test/CodeGen/X86/mixed-ptr-sizes-i686.ll

+36
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,39 @@ entry:
341341
store i32 %i, ptr addrspace(272) %s, align 8
342342
ret void
343343
}
344+
345+
define i64 @test_load_sptr32_zext_i64(ptr addrspace(270) %i) {
346+
; ALL-LABEL: test_load_sptr32_zext_i64:
347+
; ALL: # %bb.0: # %entry
348+
; ALL-NEXT: movl {{[0-9]+}}(%esp), %eax
349+
; ALL-NEXT: movl (%eax), %eax
350+
; ALL-NEXT: xorl %edx, %edx
351+
; ALL-NEXT: retl
352+
entry:
353+
%0 = load i32, ptr addrspace(270) %i, align 4
354+
%1 = zext i32 %0 to i64
355+
ret i64 %1
356+
}
357+
358+
define void @test_store_sptr32_trunc_i1(ptr addrspace(270) %s, i32 %i) {
359+
; CHECK-LABEL: test_store_sptr32_trunc_i1:
360+
; CHECK: # %bb.0: # %entry
361+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
362+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
363+
; CHECK-NEXT: andl $1, %ecx
364+
; CHECK-NEXT: movb %cl, (%eax)
365+
; CHECK-NEXT: retl
366+
;
367+
; CHECK-O0-LABEL: test_store_sptr32_trunc_i1:
368+
; CHECK-O0: # %bb.0: # %entry
369+
; CHECK-O0-NEXT: movl {{[0-9]+}}(%esp), %ecx
370+
; CHECK-O0-NEXT: movl {{[0-9]+}}(%esp), %eax
371+
; CHECK-O0-NEXT: andl $1, %ecx
372+
; CHECK-O0-NEXT: # kill: def $cl killed $cl killed $ecx
373+
; CHECK-O0-NEXT: movb %cl, (%eax)
374+
; CHECK-O0-NEXT: retl
375+
entry:
376+
%0 = trunc i32 %i to i1
377+
store i1 %0, ptr addrspace(270) %s
378+
ret void
379+
}

llvm/test/CodeGen/X86/mixed-ptr-sizes.ll

+32
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,35 @@ entry:
256256
store i32 %i, ptr addrspace(272) %s, align 8
257257
ret void
258258
}
259+
260+
define i64 @test_load_sptr32_zext_i64(ptr addrspace(270) %i) {
261+
; CHECK-LABEL: test_load_sptr32_zext_i64:
262+
; CHECK: # %bb.0: # %entry
263+
; CHECK-NEXT: movslq %ecx, %rax
264+
; CHECK-NEXT: movq (%rax), %rax
265+
; CHECK-NEXT: retq
266+
;
267+
; CHECK-O0-LABEL: test_load_sptr32_zext_i64:
268+
; CHECK-O0: # %bb.0: # %entry
269+
; CHECK-O0-NEXT: movslq %ecx, %rax
270+
; CHECK-O0-NEXT: movl (%rax), %eax
271+
; CHECK-O0-NEXT: movl %eax, %eax
272+
; CHECK-O0-NEXT: # kill: def $rax killed $eax
273+
; CHECK-O0-NEXT: retq
274+
entry:
275+
%0 = load i32, ptr addrspace(270) %i, align 4
276+
%1 = zext i32 %0 to i64
277+
ret i64 %1
278+
}
279+
280+
define void @test_store_sptr32_trunc_i1(ptr addrspace(270) %s, i32 %i) {
281+
; ALL-LABEL: test_store_sptr32_trunc_i1:
282+
; ALL: # %bb.0: # %entry
283+
; ALL-NEXT: movslq %ecx, %rax
284+
; ALL-NEXT: movl %edx, (%rax)
285+
; ALL-NEXT: retq
286+
entry:
287+
%0 = trunc i32 %i to i1
288+
store i1 %0, ptr addrspace(270) %s
289+
ret void
290+
}

0 commit comments

Comments
 (0)