Skip to content

Commit ccedf25

Browse files
authored
[PowerPC] convert memmove to milicode call .___memmove64[PR] in 64-bit mode (llvm#167334)
conversion of bl memmove call to milicode bl .___memmove64[PR] in 64--bit mode is broken , the patch fix the problem. in the llvm/include/llvm/IR/RuntimeLibcalls.td, we do not need to define the `def ___memmove64 : RuntimeLibcallImpl<MEMCPY>` in PPC64AIXCallList ` def ___memmove32 : RuntimeLibcallImpl<MEMCPY>` in PPC32AIXCallList since there is function ``` /// Return a function impl compatible with RTLIB::MEMCPY, or /// RTLIB::Unsupported if fully unsupported. RTLIB::LibcallImpl getMemcpyImpl() const { RTLIB::LibcallImpl Memcpy = getLibcallImpl(RTLIB::MEMCPY); if (Memcpy == RTLIB::Unsupported) { // Fallback to memmove if memcpy isn't available. return getLibcallImpl(RTLIB::MEMMOVE); } return Memcpy; } ```
1 parent 6d18313 commit ccedf25

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,7 @@ defset list<RuntimeLibcallImpl> PPCRuntimeLibcalls = {
23332333

23342334
defset list<RuntimeLibcallImpl> PPC64AIXCallList = {
23352335
def ___memcmp64 : RuntimeLibcallImpl<MEMCMP>;
2336-
def ___memmove64 : RuntimeLibcallImpl<MEMCPY>;
2336+
def ___memmove64 : RuntimeLibcallImpl<MEMMOVE>;
23372337
def ___memset64 : RuntimeLibcallImpl<MEMSET>;
23382338
def ___bzero64 : RuntimeLibcallImpl<BZERO>;
23392339
def ___strlen64 : RuntimeLibcallImpl<STRLEN>;

llvm/test/CodeGen/PowerPC/milicode64.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ define ptr @test_memmove(ptr noundef %destination, ptr noundef %source, i64 noun
156156
; CHECK-AIX-64-P9-NEXT: std r3, 128(r1)
157157
; CHECK-AIX-64-P9-NEXT: std r4, 120(r1)
158158
; CHECK-AIX-64-P9-NEXT: std r5, 112(r1)
159-
; CHECK-AIX-64-P9-NEXT: bl .memmove[PR]
159+
; CHECK-AIX-64-P9-NEXT: bl .___memmove64[PR]
160160
; CHECK-AIX-64-P9-NEXT: nop
161161
; CHECK-AIX-64-P9-NEXT: mr r3, r31
162162
; CHECK-AIX-64-P9-NEXT: ld r31, 136(r1) # 8-byte Folded Reload

0 commit comments

Comments
 (0)