Skip to content

Commit ee515c7

Browse files
authored
[CIR][CIRGen] Simplify __builtin_elementwise_abs (#1393)
If type of operand is not integer, it can be handled like what I do in `__builtin_elementwise_exp`.
1 parent cd5458b commit ee515c7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -1352,13 +1352,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
13521352
mlir::Type cirTy = convertType(E->getArg(0)->getType());
13531353
bool isIntTy = cir::isIntOrIntVectorTy(cirTy);
13541354
if (!isIntTy) {
1355-
mlir::Type eltTy = cirTy;
1356-
if (mlir::isa<cir::VectorType>(cirTy))
1357-
eltTy = mlir::cast<cir::VectorType>(cirTy).getEltType();
1358-
if (mlir::isa<cir::SingleType, cir::DoubleType>(eltTy)) {
1359-
return emitUnaryMaybeConstrainedFPBuiltin<cir::FAbsOp>(*this, *E);
1360-
}
1361-
llvm_unreachable("unsupported type for BI__builtin_elementwise_abs");
1355+
return emitUnaryFPBuiltin<cir::FAbsOp>(*this, *E);
13621356
}
13631357
mlir::Value arg = emitScalarExpr(E->getArg(0));
13641358
auto call = getBuilder().create<cir::AbsOp>(getLoc(E->getExprLoc()),

0 commit comments

Comments
 (0)