-
Notifications
You must be signed in to change notification settings - Fork 161
[CIR][CIRGen][Builtin][X86] Lower mm_prefetch #1675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Okay, been experimenting with the tests for a while. in the test when including:
Causes the intrinsic call operation:
To transform in a proper prefetch operation:
I assume we prefer the latter. Is that right? |
cc. @bcardosolopes |
@RiverDave sorry, somehow I missed this.
|
d250cc8
to
0347332
Compare
Two things:
raw intrinsic call: cir.func dso_local @test_mm_prefetch(%arg0: !cir.ptr<!s8i> loc(fused[#loc3, #loc4])) extra(#fn_attr) {
%0 = cir.alloca !cir.ptr<!s8i>, !cir.ptr<!cir.ptr<!s8i>>, ["p", init] {alignment = 8 : i64} loc(#loc10)
cir.store %arg0, %0 : !cir.ptr<!s8i>, !cir.ptr<!cir.ptr<!s8i>> loc(#loc5)
%1 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!s8i>>, !cir.ptr<!s8i> loc(#loc6)
%2 = cir.const #cir.int<0> : !s32i loc(#loc7)
%3 = cir.cast(bitcast, %1 : !cir.ptr<!s8i>), !cir.ptr<!void> loc(#loc6)
%4 = cir.const #cir.int<0> : !s32i loc(#loc8)
%5 = cir.const #cir.int<0> : !s32i loc(#loc8)
%6 = cir.const #cir.int<1> : !s32i loc(#loc8)
%7 = cir.llvm.intrinsic "prefetch" %3, %4, %5, %6 : (!cir.ptr<!void>, !s32i, !s32i, !s32i) -> !void loc(#loc8)
cir.return loc(#loc2)
} loc(#loc9) PrefetchOp: cir.func dso_local @_Z16test_mm_prefetchPKc(%arg0: !cir.ptr<!u8i> loc(fused[#loc3, #loc4])) extra(#fn_attr) {
%0 = cir.alloca !cir.ptr<!u8i>, !cir.ptr<!cir.ptr<!u8i>>, ["p", init] {alignment = 8 : i64} loc(#loc8)
cir.store %arg0, %0 : !cir.ptr<!u8i>, !cir.ptr<!cir.ptr<!u8i>> loc(#loc5)
%1 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!u8i>>, !cir.ptr<!u8i> loc(#loc6)
%2 = cir.cast(bitcast, %1 : !cir.ptr<!u8i>), !cir.ptr<!void> loc(#loc6)
cir.prefetch(%2 : !cir.ptr<!void>) locality(0) read loc(#loc6)
cir.return loc(#loc2)
} loc(#loc7) I have one question though, Not just in this, but in other PR's, I've noted functions that have some trailing/leading characters as shown: |
0347332
to
f12216e
Compare
f12216e
to
0be9b4f
Compare
It only happens in C++ - due to C++ mangling. If you cat the file to |
Couple of things I have questions about:
I duplicated function
getIntValueFromConstOp
fromCIRGenBuiltinAArch64.cpp
. I was wondering if that's correct or if there's a place where we can avoid that duplication.For the tests related to
mm_prefetch
im not sure if it'd be correct to define them in a file eg:sse-builtins.c
like it's currently done in the codegen lib.I'm also aware we can emit a call for a
PreFetchOp
would that be required in this case?related: #1414, #1404 (A PR was previously opened but It was not resolved)