Skip to content

Commit

Permalink
Merge pull request #5027 from halide/srj-absd
Browse files Browse the repository at this point in the history
Fix codegen for absd() in GLSLBase
  • Loading branch information
steven-johnson authored Jun 11, 2020
2 parents 3d19643 + 4a2216d commit 8cddb2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/CodeGen_C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ class TypeInfoGatherer : public IRGraphVisitor {
for (auto &a : op->args) {
include_lerp_types(a.type());
}
} else if (op->is_intrinsic(Call::absd)) {
// absd() can synthesize a new type
include_type(op->type.with_code(op->type.is_int() ? Type::UInt : op->type.code()));
}

IRGraphVisitor::visit(op);
Expand Down Expand Up @@ -2100,8 +2097,7 @@ void CodeGen_C::visit(const Call *op) {
internal_assert(op->args.size() == 2);
Expr a = op->args[0];
Expr b = op->args[1];
Type t = op->type.with_code(op->type.is_int() ? Type::UInt : op->type.code());
Expr e = cast(t, select(a < b, b - a, a - b));
Expr e = cast(op->type, select(a < b, b - a, a - b));
rhs << print_expr(e);
} else if (op->is_intrinsic(Call::return_second)) {
internal_assert(op->args.size() == 2);
Expand Down
3 changes: 1 addition & 2 deletions src/CodeGen_OpenGL_Dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ void CodeGen_GLSLBase::visit(const Call *op) {
internal_assert(op->args.size() == 2);
Expr a = op->args[0];
Expr b = op->args[1];
Type t = Float(32);
Expr e = cast(t, select(a < b, b - a, a - b));
Expr e = cast(op->type, select(a < b, b - a, a - b));
print_expr(e);
return;
} else if (op->is_intrinsic(Call::return_second)) {
Expand Down

0 comments on commit 8cddb2e

Please sign in to comment.