1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/X86/memcpy-inline.ll
Fangrui Song e24be6085b [X86] Emit @PLT for x86-64 and keep unadorned symbols for x86-32
This essentially reverts the x86-64 side effect of r327198.

For x86-32, @PLT (R_386_PLT32) is not suitable in -fno-pic mode so the
code forces MO_NO_FLAG (like a forced dso_local) (https://bugs.llvm.org//show_bug.cgi?id=36674#c6).

For x86-64, both `call/jmp foo` and `call/jmp foo@PLT` emit R_X86_64_PLT32
(https://sourceware.org/bugzilla/show_bug.cgi?id=22791) so there is no
difference using @PLT. Using @PLT is actually favorable because this drops
a difference with -fpie/-fpic code and makes it possible to avoid a canonical
PLT entry when taking the address of an undefined function symbol.
2020-12-05 13:17:47 -08:00

35 lines
1.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core2 | FileCheck %s
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
declare void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
define void @test1(i8* %a, i8* %b) nounwind {
; CHECK-LABEL: test1:
; CHECK: # %bb.0:
; CHECK-NEXT: movq (%rsi), %rax
; CHECK-NEXT: movq %rax, (%rdi)
; CHECK-NEXT: retq
tail call void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* %a, i8* %b, i64 8, i1 0 )
ret void
}
define void @regular_memcpy_calls_external_function(i8* %a, i8* %b) nounwind {
; CHECK-LABEL: regular_memcpy_calls_external_function:
; CHECK: # %bb.0:
; CHECK-NEXT: movl $128, %edx
; CHECK-NEXT: jmp memcpy@PLT # TAILCALL
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 128, i1 0 )
ret void
}
define void @inlined_copy_doesnt_call_external_function(i8* %a, i8* %b) nounwind {
; CHECK-LABEL: inlined_copy_doesnt_call_external_function:
; CHECK: # %bb.0:
; CHECK-NEXT: movl $128, %ecx
; CHECK-NEXT: rep;movsb (%rsi), %es:(%rdi)
; CHECK-NEXT: retq
tail call void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* %a, i8* %b, i64 128, i1 0 )
ret void
}