Skip to content

Make the xsave target feature available on x86 in rust nightly #167

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

Closed
gnzlbg opened this issue Nov 2, 2017 · 2 comments
Closed

Make the xsave target feature available on x86 in rust nightly #167

gnzlbg opened this issue Nov 2, 2017 · 2 comments

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Nov 2, 2017

This is required to use the xgetbv instruction, which is required to detect, amongst others, AVX support. I am not proposing to add this to the list of features we want to stabilize, but I think we should add this to rustc even if we only end up using it internally in stdsimd.

gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `cpuid` and `xgetby` `x86`/`x86_64` intrinsics.

The cpuid intrinsic is not available on all x86 CPUs. The
`has_cpuid() -> bool` intrinsic detect this on non `x86_64`
hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`.

The `pushfd` and `popfd` intrinsics, which read/write the
`EFLAGS` register and are required to implement `has_cpuid`,
are exposed as well. GCC exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `cpuid` and `xgetby` `x86`/`x86_64` intrinsics.

The `cpuid` intrinsic is not available on all `x86` CPUs. The
`has_cpuid() -> bool` intrinsic detect this on non `x86_64`
hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`.

The `pushfd` and `popfd` intrinsics, which read/write the
`EFLAGS` register and are required to implement `has_cpuid`,
are exposed as well. GCC exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `cpuid` and `xgetby` `x86`/`x86_64` intrinsics.

The `cpuid` intrinsic is not available on all `x86` CPUs. The
`has_cpuid() -> bool` intrinsic detect this on non `x86_64`
hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`.

The `pushfd` and `popfd` intrinsics, which read/write the
`EFLAGS` register and are required to implement `has_cpuid`,
are exposed as well. GCC exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics.

The `__cpuid` and `__cpuid_count` intrinsics are not available on all
`x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non
`x86_64` hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`. These are exposed by Clang and
GCC.

The `__readeflags` and `__writeeflags` intrinsics, which read/write
the `EFLAGS` register and are required to implement `has_cpuid`, are
exposed as well. GCC and Clang exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `_xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics.

The `__cpuid` and `__cpuid_count` intrinsics are not available on all
`x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non
`x86_64` hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`. These are exposed by Clang and
GCC.

The `__readeflags` and `__writeeflags` intrinsics, which read/write
the `EFLAGS` register and are required to implement `has_cpuid`, are
exposed as well. GCC and Clang exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `_xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics.

The `__cpuid` and `__cpuid_count` intrinsics are not available on all
`x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non
`x86_64` hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`. These are exposed by Clang and
GCC.

The `__readeflags` and `__writeeflags` intrinsics, which read/write
the `EFLAGS` register and are required to implement `has_cpuid`, are
exposed as well. GCC and Clang exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `_xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics.

The `__cpuid` and `__cpuid_count` intrinsics are not available on all
`x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non
`x86_64` hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`. These are exposed by Clang and
GCC.

The `__readeflags` and `__writeeflags` intrinsics, which read/write
the `EFLAGS` register and are required to implement `has_cpuid`, are
exposed as well. GCC and Clang exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `_xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics.

The `__cpuid` and `__cpuid_count` intrinsics are not available on all
`x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non
`x86_64` hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`. These are exposed by Clang and
GCC.

The `__readeflags` and `__writeeflags` intrinsics, which read/write
the `EFLAGS` register and are required to implement `has_cpuid`, are
exposed as well. GCC and Clang exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `_xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
gnzlbg added a commit to gnzlbg/stdsimd that referenced this issue Nov 4, 2017
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics.

The `__cpuid` and `__cpuid_count` intrinsics are not available on all
`x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non
`x86_64` hosts. For convenience, this is exposed on `x86_64` as well
but there it always returns `true`. These are exposed by Clang and
GCC.

The `__readeflags` and `__writeeflags` intrinsics, which read/write
the `EFLAGS` register and are required to implement `has_cpuid`, are
exposed as well. GCC and Clang exposes them too.

When doing run-time feature detection for `x86`/`x86_64` we
now properly check whether the `cpuid` instruction is
available before using it. If it is not available,
are features are exposes as "not available".

One TODO:

- The `_xgetbv` intrinsic requires the `xsave` target feature
but this is not currently exposed by rustc, see rust-lang#167 .
@alexcrichton
Copy link
Member

I think this was since fixed, right?

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Nov 19, 2017

Yes.

@gnzlbg gnzlbg closed this as completed Nov 19, 2017
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