[PATCH] D12313: Introduce __builtin_nontemporal_store and __builtin_nontemporal_load.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 8 13:03:52 PDT 2015
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.
Looks fine to me.
================
Comment at: lib/CodeGen/CGBuiltin.cpp:114-128
@@ -113,1 +113,17 @@
+static Value *MakeNontemporalStore(CodeGenFunction &CGF, const CallExpr *E) {
+ Value *Val = CGF.EmitScalarExpr(E->getArg(0));
+ Value *Address = CGF.EmitScalarExpr(E->getArg(1));
+
+ // Convert the type of the pointer to a pointer to the stored type.
+ Val = CGF.EmitToMemory(Val, E->getArg(0)->getType());
+ Value *BC = CGF.Builder.CreateBitCast(
+ Address, llvm::PointerType::getUnqual(Val->getType()), "cast");
+ LValue LV = CGF.MakeNaturalAlignAddrLValue(BC, E->getArg(0)->getType());
+ LV.setNontemporal(true);
+ CGF.EmitStoreOfScalar(Val, LV, false);
+ return nullptr;
+}
+
+static Value *MakeNontemporalLoad(CodeGenFunction &CGF, const CallExpr *E) {
+ Value *Address = CGF.EmitScalarExpr(E->getArg(0));
----------------
Replace `Make` with `Emit` in both of these.
================
Comment at: lib/Sema/SemaChecking.cpp:2245-2246
@@ +2244,4 @@
+ Expr *PointerArg = TheCall->getArg(numArgs - 1);
+ ExprResult PointerArgResult =
+ DefaultFunctionArrayLvalueConversion(PointerArg);
+
----------------
In the comment on line 2219, you say this has already been done. Please either remove this or fix the comment.
http://reviews.llvm.org/D12313
More information about the cfe-commits
mailing list