Skip to content

[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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RiverDave
Copy link

@RiverDave RiverDave commented Jun 10, 2025

Couple of things I have questions about:

  1. I duplicated function getIntValueFromConstOp from CIRGenBuiltinAArch64.cpp. I was wondering if that's correct or if there's a place where we can avoid that duplication.

  2. 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.

  3. I'm also aware we can emit a call for a PreFetchOp would that be required in this case?

related: #1414 (A PR was also opened but It was not resolved)

@RiverDave RiverDave changed the title [CIR][CIRGen][Builtin][X86] Lower m_prefetch [CIR][CIRGen][Builtin][X86] Lower mm_prefetch Jun 10, 2025
@RiverDave
Copy link
Author

RiverDave commented Jun 13, 2025

Okay, been experimenting with the tests for a while. in the test when including:

  • flag: -ffreestanding
  • header: x86intrin.h

Causes the intrinsic call operation:

cir.llvm.intrinsic "prefetch" {{%.*}} : (!cir.ptr<!void>, !s32i, !s32i, !s32i) -> !void

To transform in a proper prefetch operation:

    cir.prefetch(%2 : !cir.ptr<!void>) locality(0) read loc(#loc6)

I assume we prefer the 2nd. Is that right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant