Skip to content

Commit

Permalink
Merge branch 'master' into update-sha512-builtin-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
CblPOK-git committed Jul 25, 2023
2 parents 5161553 + 27b2740 commit 89138e6
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 8 deletions.
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/BuiltinsAssigner.def
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ BUILTIN(__builtin_assigner_vesta_curve_init, "e2g7g7", "n")
BUILTIN(__builtin_assigner_bls12381_curve_init, "e3g3g3", "n")
BUILTIN(__builtin_assigner_curve25519_curve_init, "e4g5g5", "n")

BUILTIN(__builtin_assigner_bit_decomposition64, "E64g1ULLi", "n")
BUILTIN(__builtin_assigner_bit_composition128, "g1E64g1E64g1", "n")

#undef BUILTIN
#undef TARGET_BUILTIN
16 changes: 16 additions & 0 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19912,6 +19912,22 @@ Value *CodeGenFunction::EmitAssignerBuiltinExpr(unsigned int BuiltinID,
OverloadTypes = {Curve, BaseField};
break;
}
case assigner::BI__builtin_assigner_bit_composition128: {
ID = Intrinsic::assigner_bit_composition128;
auto ElemTy = llvm::GaloisFieldType::get(context,
llvm::GALOIS_FIELD_PALLAS_BASE);

OverloadTypes = {ElemTy, llvm::FixedVectorType::get(ElemTy, 64)};
break;
}
case assigner::BI__builtin_assigner_bit_decomposition64: {
ID = Intrinsic::assigner_bit_decomposition64;
auto ElemTy = llvm::GaloisFieldType::get(context,
llvm::GALOIS_FIELD_PALLAS_BASE);
auto IntType = llvm::IntegerType::get(context, 64);
OverloadTypes = {llvm::FixedVectorType::get(ElemTy, 64), IntType};
break;
}
}
assert(ID != Intrinsic::not_intrinsic);

Expand Down
6 changes: 5 additions & 1 deletion clang/lib/CodeGen/CGExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,11 @@ llvm::Constant *ConstantEmitter::tryEmitPrivate(const APValue &Value,
Inits[I] = llvm::ConstantInt::get(CGM.getLLVMContext(), Elt.getInt());
else if (Elt.isFloat())
Inits[I] = llvm::ConstantFP::get(CGM.getLLVMContext(), Elt.getFloat());
else
else if (Elt.isField()) {
const llvm::FieldElem &Field = Elt.getField();
auto FieldType = llvm::GaloisFieldType::get(CGM.getLLVMContext(), Field.getKind());
Inits[I] = llvm::ConstantField::get(FieldType, Field);
} else
llvm_unreachable("unsupported vector element type");
}
return llvm::ConstantVector::get(Inits);
Expand Down
2 changes: 1 addition & 1 deletion llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ option(LLVM_TOOL_LLVM_DRIVER_BUILD "Enables building the llvm multicall tool" OF

set(PACKAGE_NAME LLVM)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/llvm/llvm-project/issues/")
set(PACKAGE_BUGREPORT "https://github.com/NilFoundation/zkllvm-circifier/issues/")

set(BUG_REPORT_URL "${PACKAGE_BUGREPORT}" CACHE STRING
"Default URL where bug reports are to be submitted.")
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/IR/IntrinsicsAssigner.td
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ def int_assigner_zkml_pooling: Intrinsic<[llvm_ptrptr_ty], [llvm_ptrptr_t
def int_assigner_zkml_ReLU: Intrinsic<[llvm_float_ty], [llvm_float_ty]>;
def int_assigner_zkml_batch_norm: Intrinsic<[llvm_ptrptr_ty], [llvm_ptrptr_ty]>;
def int_assigner_curve_init: Intrinsic<[llvm_any_ty], [llvm_any_ty, LLVMMatchType<1>]>;

def int_assigner_bit_decomposition64: Intrinsic<[llvm_anyvector_ty], [llvm_any_ty]>;
def int_assigner_bit_composition128: Intrinsic<[llvm_any_ty], [llvm_anyvector_ty, LLVMMatchType<1>]>;
2 changes: 0 additions & 2 deletions llvm/include/llvm/IR/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ class Value {
/// \note It is an error to call V->takeName(V).
void takeName(Value *V);

#ifndef NDEBUG
std::string getNameOrAsOperand() const;
#endif

/// Change all uses of this to point to a new Value.
///
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/IR/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ void Value::takeName(Value *V) {
ST->reinsertValue(this);
}

#ifndef NDEBUG
std::string Value::getNameOrAsOperand() const {
if (!getName().empty())
return std::string(getName());
Expand All @@ -449,7 +448,6 @@ std::string Value::getNameOrAsOperand() const {
printAsOperand(OS, false);
return OS.str();
}
#endif

void Value::assertModuleIsMaterializedImpl() const {
#ifndef NDEBUG
Expand Down Expand Up @@ -818,7 +816,7 @@ bool Value::canBeFreed() const {
// which is why we need the explicit opt in on a per collector basis.
if (!F->hasGC())
return true;

const auto &GCName = F->getGC();
if (GCName == "statepoint-example") {
auto *PT = cast<PointerType>(this->getType());
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ write_cmake_config("config") {
"LLVM_TARGET_TRIPLE_ENV=",
"LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO=1",
"LLVM_WINDOWS_PREFER_FORWARD_SLASH=",
"PACKAGE_BUGREPORT=https://github.com/llvm/llvm-project/issues/",
"PACKAGE_BUGREPORT=https://github.com/NilFoundation/zkllvm-circifier/issues/",
"PACKAGE_NAME=LLVM",
"PACKAGE_STRING=LLVM ${llvm_version}git",
"PACKAGE_VERSION=${llvm_version}git",
Expand Down

0 comments on commit 89138e6

Please sign in to comment.