Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 16, 2022
1 parent 938abc4 commit 69f7eb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion taichi/codegen/llvm/codegen_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ void TaskCodeGenLLVM::visit(BinaryOpStmt *stmt) {
llvm_val[stmt] =
builder->CreateShl(llvm_val[stmt->lhs], llvm_val[stmt->rhs]);
} else if (op == BinaryOpType::bit_sar) {
if (is_signed(stmt->lhs->element_type()) || is_signed_tensor(stmt->lhs->ret_type)) {
if (is_signed(stmt->lhs->element_type()) ||
is_signed_tensor(stmt->lhs->ret_type)) {
llvm_val[stmt] =
builder->CreateAShr(llvm_val[stmt->lhs], llvm_val[stmt->rhs]);
} else {
Expand Down
13 changes: 7 additions & 6 deletions taichi/ir/type_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ TI_DLL_EXPORT int data_type_size(DataType t);

TI_DLL_EXPORT std::string data_type_format(DataType dt);

#define DEFINE_TENSOR_CHECK(func_name) inline bool func_name##_tensor(DataType dt) { \
if (auto tensor_type = dt->cast<TensorType>()) { \
return func_name(tensor_type->get_element_type()); \
} \
return false; \
}
#define DEFINE_TENSOR_CHECK(func_name) \
inline bool func_name##_tensor(DataType dt) { \
if (auto tensor_type = dt->cast<TensorType>()) { \
return func_name(tensor_type->get_element_type()); \
} \
return false; \
}

inline int data_type_bits(DataType t) {
return data_type_size(t) * 8;
Expand Down

0 comments on commit 69f7eb8

Please sign in to comment.