about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-09-09 22:02:19 +0530
committerGitHub <noreply@github.com>2022-09-09 22:02:19 +0530
commit07a9c10fe6d67cbd3d33a17002e9b41310e6c3a0 (patch)
treeba410d3e40134b96bf3083f0d5ad02656baff2cc /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentae4973281bee496f107ed9db5c3ff1487981af4e (diff)
parente4d3abfe7720c05f0f2e752d3054236341cd5e9e (diff)
downloadrust-07a9c10fe6d67cbd3d33a17002e9b41310e6c3a0.tar.gz
rust-07a9c10fe6d67cbd3d33a17002e9b41310e6c3a0.zip
Rollup merge of #101612 - tmiasko:repeat128, r=lcnr
Fix code generation of `Rvalue::Repeat` with 128 bit values

Closes #101585.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 931ce78721c..6ee3c7d6821 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1618,6 +1618,14 @@ extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty,
   return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
 }
 
+extern "C" bool LLVMRustConstIntGetZExtValue(LLVMValueRef CV, uint64_t *value) {
+    auto C = unwrap<llvm::ConstantInt>(CV);
+    if (C->getBitWidth() > 64)
+      return false;
+    *value = C->getZExtValue();
+    return true;
+}
+
 // Returns true if both high and low were successfully set. Fails in case constant wasn’t any of
 // the common sizes (1, 8, 16, 32, 64, 128 bits)
 extern "C" bool LLVMRustConstInt128Get(LLVMValueRef CV, bool sext, uint64_t *high, uint64_t *low)