Skip to content

Commit 35a21ca

Browse files
committed
modified implementation
1 parent aa9d6fd commit 35a21ca

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned BuiltinID,
107107
cir::PointerType::get(cir::VoidType::get(&getMLIRContext()));
108108
auto CastToVoid = builder.create<cir::CastOp>(
109109
loc, voidPtrType, cir::CastKind::bitcast, Ops[0]);
110-
return builder.create<cir::PrefetchOp>(loc, CastToVoid, Locality, isWrite)
111-
->getResult(0);
110+
auto res =
111+
builder.create<cir::PrefetchOp>(loc, CastToVoid, Locality, isWrite);
112+
return res->getResult(0);
112113
}
113114
case X86::BI_mm_clflush: {
114115
mlir::Type voidTy = cir::VoidType::get(&getMLIRContext());

clang/test/CIR/CodeGen/X86/builtins-x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ void test_mm_prefetch(char const* p) {
1010
// CIR-LABEL: test_mm_prefetch
1111
// LLVM-LABEL: test_mm_prefetch
1212
_mm_prefetch(p, 0);
13-
// CIR: {{%.*}} =
14-
// LLVM: call void @llvm.prefetch.p0(ptr {{.*}}, i32 0, i32 0, i32 1)
13+
// CIR: {{%.*}} = cir.prefetch(%3 : !cir.ptr<!void>) locality(0) read
14+
// LLVM: call void @llvm.prefetch.p0(ptr {{%.*}}, i32 0, i32 0, i32 1)
1515
}
1616

1717
void test_mm_clflush(const void* tmp_vCp) {

0 commit comments

Comments
 (0)