1313
1414#include " CIRGenFunction.h"
1515#include " CIRGenModule.h"
16+ #include " mlir/IR/ValueRange.h"
1617#include " clang/Basic/Builtins.h"
1718#include " clang/Basic/TargetBuiltins.h"
1819#include " clang/CIR/MissingFeatures.h"
@@ -21,12 +22,12 @@ using namespace clang;
2122using namespace clang ::CIRGen;
2223
2324template <typename ... Operands>
24- static mlir::Value emitIntrinsicCallOp (CIRGenFunction &cgf, const CallExpr *e,
25- const std::string &str ,
26- const mlir::Type &resTy,
27- Operands &&...op) {
25+ static mlir::Value
26+ emitIntrinsicCallOp (CIRGenFunction &cgf, const CallExpr *expr ,
27+ const std::string &str, const mlir::Type &resTy,
28+ Operands &&...op) {
2829 CIRGenBuilderTy &builder = cgf.getBuilder ();
29- mlir::Location location = cgf.getLoc (e ->getExprLoc ());
30+ mlir::Location location = cgf.getLoc (expr ->getExprLoc ());
3031 return cir::LLVMIntrinsicCallOp::create (builder, location,
3132 builder.getStringAttr (str), resTy,
3233 std::forward<Operands>(op)...)
@@ -106,7 +107,8 @@ static mlir::Value emitX86FunnelShift(CIRGenFunction &cgf, const CallExpr *e,
106107 }
107108
108109 const std::string intrinsicName = isRight ? " fshr" : " fshl" ;
109- return emitIntrinsicCallOp (cgf, e, intrinsicName, ty, op0, op1, amt);
110+ return emitIntrinsicCallOp (cgf, e, intrinsicName, ty,
111+ mlir::ValueRange{op0, op1, amt});
110112}
111113
112114mlir::Value CIRGenFunction::emitX86BuiltinExpr (unsigned builtinID,
@@ -671,6 +673,11 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
671673 builder.createVecShuffle (getLoc (expr->getExprLoc ()), in, zero, indices);
672674 return builder.createBitcast (sv, ops[0 ].getType ());
673675 }
676+ case X86::BI__builtin_ia32_kshiftridi:
677+ cgm.errorNYI (expr->getSourceRange (),
678+ std::string (" unimplemented X86 builtin call: " ) +
679+ getContext ().BuiltinInfo .getName (builtinID));
680+ return {};
674681 case X86::BI__builtin_ia32_vprotbi:
675682 case X86::BI__builtin_ia32_vprotwi:
676683 case X86::BI__builtin_ia32_vprotdi:
@@ -681,14 +688,14 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
681688 case X86::BI__builtin_ia32_prolq128:
682689 case X86::BI__builtin_ia32_prolq256:
683690 case X86::BI__builtin_ia32_prolq512:
684- return emitX86FunnelShift (*this , e , ops[0 ], ops[1 ], ops[1 ], false );
691+ return emitX86FunnelShift (*this , expr , ops[0 ], ops[1 ], ops[1 ], false );
685692 case X86::BI__builtin_ia32_prord128:
686693 case X86::BI__builtin_ia32_prord256:
687694 case X86::BI__builtin_ia32_prord512:
688695 case X86::BI__builtin_ia32_prorq128:
689696 case X86::BI__builtin_ia32_prorq256:
690697 case X86::BI__builtin_ia32_prorq512:
691- return emitX86FunnelShift (*this , e , ops[0 ], ops[1 ], ops[1 ], true );
698+ return emitX86FunnelShift (*this , expr , ops[0 ], ops[1 ], ops[1 ], true );
692699 case X86::BI__builtin_ia32_selectb_128:
693700 case X86::BI__builtin_ia32_selectb_256:
694701 case X86::BI__builtin_ia32_selectb_512:
0 commit comments