[PATCH] D83361: [LLVM] Add libatomic load/store functions to TargetLibraryInfo

Gui Andrade via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 20:25:13 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc42509413f69: [LLVM] Add libatomic load/store functions to TargetLibraryInfo (authored by guiand).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83361/new/

https://reviews.llvm.org/D83361

Files:
  llvm/include/llvm/Analysis/TargetLibraryInfo.def
  llvm/lib/Analysis/TargetLibraryInfo.cpp
  llvm/unittests/Analysis/TargetLibraryInfoTest.cpp


Index: llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
===================================================================
--- llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -495,6 +495,9 @@
       "declare i8* @mempcpy(i8*, i8*, i64)\n"
       "declare i8* @memrchr(i8*, i32, i64)\n"
 
+      "declare void @__atomic_load(i64, i8*, i8*, i32)\n"
+      "declare void @__atomic_store(i64, i8*, i8*, i32)\n"
+
       // These are similar to the FILE* fgetc/fputc.
       "declare i32 @_IO_getc(%struct*)\n"
       "declare i32 @_IO_putc(i32, %struct*)\n"
Index: llvm/lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -1228,6 +1228,15 @@
   case LibFunc_ZdaPvmSt11align_val_t:
     return (NumParams == 3 && FTy.getParamType(0)->isPointerTy());
 
+  // void __atomic_load(size_t, void *, void *, int)
+  case LibFunc_atomic_load:
+  // void __atomic_store(size_t, void *, void *, int)
+  case LibFunc_atomic_store:
+    return (NumParams == 4 && FTy.getParamType(0)->isIntegerTy() &&
+            FTy.getParamType(1)->isPointerTy() &&
+            FTy.getParamType(2)->isPointerTy() &&
+            FTy.getParamType(3)->isIntegerTy());
+
   case LibFunc_memset_pattern16:
     return (!FTy.isVarArg() && NumParams == 3 &&
             FTy.getParamType(0)->isPointerTy() &&
Index: llvm/include/llvm/Analysis/TargetLibraryInfo.def
===================================================================
--- llvm/include/llvm/Analysis/TargetLibraryInfo.def
+++ llvm/include/llvm/Analysis/TargetLibraryInfo.def
@@ -262,6 +262,12 @@
 /// long double __atanhl_finite(long double x);
 TLI_DEFINE_ENUM_INTERNAL(atanhl_finite)
 TLI_DEFINE_STRING_INTERNAL("__atanhl_finite")
+/// void __atomic_load(size_t size, void *mptr, void *vptr, int smodel);
+TLI_DEFINE_ENUM_INTERNAL(atomic_load)
+TLI_DEFINE_STRING_INTERNAL("__atomic_load")
+/// void __atomic_store(size_t size, void *mptr, void *vptr, int smodel);
+TLI_DEFINE_ENUM_INTERNAL(atomic_store)
+TLI_DEFINE_STRING_INTERNAL("__atomic_store")
 /// double __cosh_finite(double x);
 TLI_DEFINE_ENUM_INTERNAL(cosh_finite)
 TLI_DEFINE_STRING_INTERNAL("__cosh_finite")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83361.278965.patch
Type: text/x-patch
Size: 2304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200718/31a74cf3/attachment.bin>


More information about the llvm-commits mailing list