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

Don't use "generic" as the target cpu #20777

Closed
dotdash opened this issue Jan 8, 2015 · 3 comments
Closed

Don't use "generic" as the target cpu #20777

dotdash opened this issue Jan 8, 2015 · 3 comments
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@dotdash
Copy link
Contributor

dotdash commented Jan 8, 2015

By default, we use the "generic" target CPU, unfortunately on x86_64, this disables various features because "generic" is more like "generic x86". This disable things like some SSE usage and multibyte nops. On x86_64 we should use x86-64 as the minimum target cpu, not sure about other archs.

To present some arbitrary numbers:

# target cpu "generic"
$ objdump -S libsyntax-4e7c5e5c.so | grep xmm -c
25148

# target cpu "x86-64"
$ objdump -S libsyntax-4e7c5e5c.so|grep xmm  -c
83740

cc @cmr

@huonw huonw added A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code. labels Jan 9, 2015
@dotdash
Copy link
Contributor Author

dotdash commented Jan 9, 2015

To add some slightly more interesting numbers, these are for rustc -Z no-trans libsyntax/lib.rs:

generic:

real    0m33.343s
user    0m33.156s
sys     0m0.228s

x86-64

real    0m31.824s
user    0m31.688s
sys     0m0.176s

dotdash added a commit to dotdash/rust that referenced this issue Jan 11, 2015
Using "generic" disables a number of features that are present on all
x86_64 cpus, the "x86-64" target cpu is the common denominator for that
arch.

Refs rust-lang#20777
bors added a commit that referenced this issue Jan 11, 2015
Using "generic" disables a number of features that are present on all
x86_64 cpus, the "x86-64" target cpu is the common denominator for that
arch.

Refs #20777
@Gankra
Copy link
Contributor

Gankra commented Jan 21, 2015

@dotdash Did your PR not resolve this?

@dotdash
Copy link
Contributor Author

dotdash commented Jan 21, 2015

It probably did for x84_64, but I'm not sure about x86 (I guess "generic"
is like i386, which seems a bit too old a target), ARM, etc.
Am 21.01.2015 23:33 schrieb "Alexis Beingessner" notifications@github.com:

@dotdash https://github.com/dotdash Did your PR not resolve this?


Reply to this email directly or view it on GitHub
#20777 (comment).

bors added a commit that referenced this issue Jan 27, 2015
Using `generic` as the target cpu limits the generated code to the bare basics for the arch, while we can probably assume that we'll actually be running on somewhat modern hardware. This updates the default target CPUs for the x86 and x86_64 archs to match clang's behaviour.

Refs #20777
@dotdash dotdash closed this as completed Feb 6, 2015
semarie added a commit to semarie/rust that referenced this issue Feb 17, 2016
The initial purpose is to workaround the LLVM bug
https://llvm.org/bugs/show_bug.cgi?id=26554 for OpenBSD.

By default, the `cpu' is defined to `generic`. But with a 64bit
processor, the optimization for `generic` will use invalid asm code as
NOP (the generated code for NOP isn't a NOP).

According to rust-lang#20777, "x86-64" is the right thing to do for x86_64
builds.

Closes: rust-lang#31363
bors added a commit that referenced this issue Feb 18, 2016
The initial purpose is to workaround the LLVM bug
https://llvm.org/bugs/show_bug.cgi?id=26554 for OpenBSD.

By default, the `cpu` is defined to `generic`. But with a 64bit
processor, the optimization for `generic` will use invalid asm code as
NOP (the generated code for NOP isn't a NOP).

According to #20777, "x86-64" is the right thing to do for x86_64
builds.

Closes: #31363

r? @alexcrichton
jakllsch added a commit to jakllsch/rust that referenced this issue Jul 25, 2016
Using "generic" disables a number of features that are present on all
x86_64 cpus, the "x86-64" target cpu is the common denominator for that
arch.

Refs rust-lang#20777
sanxiyn added a commit to sanxiyn/rust that referenced this issue Aug 1, 2016
…excrichton

Use "x86-64" as the target CPU for NetBSD and Bitrig on amd64.

Using "generic" disables a number of features that are present on all
x86_64 cpus, the "x86-64" target cpu is the common denominator for that
arch.

Refs rust-lang#20777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

3 participants