xref: /llvm-project/llvm/test/CodeGen/X86/memcpy-inline.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core2 | FileCheck %s
3
4declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
5declare void @llvm.memcpy.inline.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
6
7define void @test1(ptr %a, ptr %b) nounwind {
8; CHECK-LABEL: test1:
9; CHECK:       # %bb.0:
10; CHECK-NEXT:    movq (%rsi), %rax
11; CHECK-NEXT:    movq %rax, (%rdi)
12; CHECK-NEXT:    retq
13  tail call void @llvm.memcpy.inline.p0.p0.i64(ptr %a, ptr %b, i64 8, i1 0 )
14  ret void
15}
16
17define void @regular_memcpy_calls_external_function(ptr %a, ptr %b) nounwind {
18; CHECK-LABEL: regular_memcpy_calls_external_function:
19; CHECK:       # %bb.0:
20; CHECK-NEXT:    movl $128, %edx
21; CHECK-NEXT:    jmp memcpy@PLT # TAILCALL
22  tail call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 128, i1 0 )
23  ret void
24}
25
26define void @inlined_copy_doesnt_call_external_function(ptr %a, ptr %b) nounwind {
27; CHECK-LABEL: inlined_copy_doesnt_call_external_function:
28; CHECK:       # %bb.0:
29; CHECK-NEXT:    movl $128, %ecx
30; CHECK-NEXT:    rep;movsb (%rsi), %es:(%rdi)
31; CHECK-NEXT:    retq
32  tail call void @llvm.memcpy.inline.p0.p0.i64(ptr %a, ptr %b, i64 128, i1 0 )
33  ret void
34}
35