[llvm] ccedf25 - [PowerPC] convert memmove to milicode call .___memmove64[PR] in 64-bit mode (#167334)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 10:30:45 PST 2025


Author: zhijian lin
Date: 2025-11-10T10:30:40-08:00
New Revision: ccedf259fc0877873cd337deb87b135dfaac753d

URL: https://github.com/llvm/llvm-project/commit/ccedf259fc0877873cd337deb87b135dfaac753d
DIFF: https://github.com/llvm/llvm-project/commit/ccedf259fc0877873cd337deb87b135dfaac753d.diff

LOG: [PowerPC] convert memmove to milicode call  .___memmove64[PR]  in 64-bit mode (#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;
  }
```

Added: 
    

Modified: 
    llvm/include/llvm/IR/RuntimeLibcalls.td
    llvm/test/CodeGen/PowerPC/milicode64.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 24c1b035d0dda..e3da058a3ce20 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -2333,7 +2333,7 @@ defset list<RuntimeLibcallImpl> PPCRuntimeLibcalls = {
 
 defset list<RuntimeLibcallImpl> PPC64AIXCallList = {
   def ___memcmp64 : RuntimeLibcallImpl<MEMCMP>;
-  def ___memmove64 : RuntimeLibcallImpl<MEMCPY>;
+  def ___memmove64 : RuntimeLibcallImpl<MEMMOVE>;
   def ___memset64 : RuntimeLibcallImpl<MEMSET>;
   def ___bzero64 : RuntimeLibcallImpl<BZERO>;
   def ___strlen64 : RuntimeLibcallImpl<STRLEN>;

diff  --git a/llvm/test/CodeGen/PowerPC/milicode64.ll b/llvm/test/CodeGen/PowerPC/milicode64.ll
index f7814a424e0b9..2dbf4140a0fa4 100644
--- a/llvm/test/CodeGen/PowerPC/milicode64.ll
+++ b/llvm/test/CodeGen/PowerPC/milicode64.ll
@@ -156,7 +156,7 @@ define ptr @test_memmove(ptr noundef %destination, ptr noundef %source, i64 noun
 ; CHECK-AIX-64-P9-NEXT:    std r3, 128(r1)
 ; CHECK-AIX-64-P9-NEXT:    std r4, 120(r1)
 ; CHECK-AIX-64-P9-NEXT:    std r5, 112(r1)
-; CHECK-AIX-64-P9-NEXT:    bl .memmove[PR]
+; CHECK-AIX-64-P9-NEXT:    bl .___memmove64[PR]
 ; CHECK-AIX-64-P9-NEXT:    nop
 ; CHECK-AIX-64-P9-NEXT:    mr r3, r31
 ; CHECK-AIX-64-P9-NEXT:    ld r31, 136(r1) # 8-byte Folded Reload


        


More information about the llvm-commits mailing list