@@ -26,43 +26,32 @@ static int64_t getIntValueFromConstOp(mlir::Value val) {
2626 return val.getDefiningOp <cir::ConstantOp>().getIntValue ().getSExtValue ();
2727}
2828
29- static mlir::Value emitClFlush (CIRGenFunction& cgf,
30- const CallExpr* e,
31- mlir::Value& op) {
32- mlir::Type voidTy = cir::VoidType::get (&cgf.getMLIRContext ());
33- mlir::Location location = cgf.getLoc (e->getExprLoc ());
34- return cir::LLVMIntrinsicCallOp::create (
35- cgf.getBuilder (), location,
36- cgf.getBuilder ().getStringAttr (" x86.sse2.clflush" ), voidTy, op)
29+ static mlir::Value emitClFlush (CIRGenFunction &cgf, const CallExpr *e,
30+ mlir::Value &op) {
31+ mlir::Type voidTy = cir::VoidType::get (&cgf.getMLIRContext ());
32+ mlir::Location location = cgf.getLoc (e->getExprLoc ());
33+ return cir::LLVMIntrinsicCallOp::create (
34+ cgf.getBuilder (), location,
35+ cgf.getBuilder ().getStringAttr (" x86.sse2.clflush" ), voidTy, op)
3736 .getResult ();
3837}
3938
40- static mlir::Value emitPrefetch (CIRGenFunction& cgf,
41- const CallExpr* e,
42- mlir::Value& addr,
43- int64_t hint) {
44- CIRGenBuilderTy& builder = cgf.getBuilder ();
45- mlir::Type voidTy = cir::VoidType::get (&cgf.getMLIRContext ());
46- mlir::Type sInt32Ty = cir::IntType::get (&cgf.getMLIRContext (), 32 , true );
47- mlir::Value address = builder.createPtrBitcast (addr, voidTy);
39+ static mlir::Value emitPrefetch (CIRGenFunction &cgf, const CallExpr *e,
40+ mlir::Value &addr, int64_t hint) {
41+ CIRGenBuilderTy &builder = cgf.getBuilder ();
4842 mlir::Location location = cgf.getLoc (e->getExprLoc ());
49- mlir::Value rw =
50- cir::ConstantOp::create (builder, location,
51- cir::IntAttr::get (sInt32Ty , (hint >> 2 ) & 0x1 ));
52- mlir::Value locality =
53- cir::ConstantOp::create (builder, location,
54- cir::IntAttr::get (sInt32Ty , hint & 0x3 ));
55- mlir::Value data = cir::ConstantOp::create (builder, location,
56- cir::IntAttr::get (sInt32Ty , 1 ));
43+ mlir::Type voidTy = builder.getVoidTy ();
44+ mlir::Value address = builder.createPtrBitcast (addr, voidTy);
45+ mlir::Value rw = builder.getSignedInt (location, (hint >> 2 ) & 0x1 , 32 );
46+ mlir::Value locality = builder.getSignedInt (location, hint & 0x3 , 32 );
47+ mlir::Value data = builder.getSignedInt (location, 1 , 32 );
5748
5849 return cir::LLVMIntrinsicCallOp::create (
59- builder, location,
60- builder.getStringAttr (" prefetch" ), voidTy,
50+ builder, location, builder.getStringAttr (" prefetch" ), voidTy,
6151 mlir::ValueRange{address, rw, locality, data})
6252 .getResult ();
6353}
6454
65-
6655mlir::Value CIRGenFunction::emitX86BuiltinExpr (unsigned builtinID,
6756 const CallExpr *e) {
6857 if (builtinID == Builtin::BI__builtin_cpu_is) {
@@ -90,14 +79,14 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
9079
9180 // `ICEArguments` is a bitmap indicating whether the argument at the i-th bit
9281 // is required to be a constant integer expression.
93- unsigned ICEArguments = 0 ;
82+ unsigned iceArguments = 0 ;
9483 ASTContext::GetBuiltinTypeError error;
95- getContext ().GetBuiltinType (builtinID, error, &ICEArguments );
84+ getContext ().GetBuiltinType (builtinID, error, &iceArguments );
9685 assert (error == ASTContext::GE_None && " Error while getting builtin type." );
9786
9887 const unsigned numArgs = e->getNumArgs ();
9988 for (unsigned i = 0 ; i != numArgs; i++) {
100- ops.push_back (emitScalarOrConstFoldImmArg (ICEArguments , i, e));
89+ ops.push_back (emitScalarOrConstFoldImmArg (iceArguments , i, e));
10190 }
10291
10392 switch (builtinID) {
0 commit comments