Skip to content
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

Should _mm_clflush be under the SSE2 target feature? #1455

Open
thomcc opened this issue Aug 9, 2023 · 1 comment
Open

Should _mm_clflush be under the SSE2 target feature? #1455

thomcc opened this issue Aug 9, 2023 · 1 comment

Comments

@thomcc
Copy link
Member

thomcc commented Aug 9, 2023

_mm_clflush is provided by the sse2 feature, even though CLFLUSH has a distinct separate CPUID feature bit, independent of SSE2. Additionally, according to https://www.felixcloutier.com/x86/clflush, it is legal for a chip to implement SSE2 but not CLFLUSH (and vice versa):

Also, detecting the presence of the SSE2 extensions with the CPUID instruction does not guarantee that the CLFLUSH instruction is implemented in the processor.

That said, https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=clflush&ig_expand=769,768 does list it as provided by SSE2, but I don't know how normative this is.

We have a few options here

  1. Do nothing, i.e. treat the information on the intel intrinsic guide website as correct.
  2. Add a clflush target feature to x86 and x86_64.
  3. Decide that clflush must be present for us to claim that SSE2 is enabled.

My preference is 1 if we can confirm that SSE2 guarantees presence of clflush. Otherwise, my preference is 2.

I think 3 would be bad, since whether or not SSE2 is supported is important for a lot of things. (If it were some other less critical target feature I might feel differently here)

@Amanieu
Copy link
Member

Amanieu commented Aug 11, 2023

On all current and future CPUs, CLFLUSH is going to be tied to SSE2, so it doesn't make sense to use a separate target feature. I would just go with option 1.

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

No branches or pull requests

2 participants