Skip to content

Commit

Permalink
Add comments about the differences between Clang and rustc target CPUs
Browse files Browse the repository at this point in the history
Keep track of differences between Clang and rust choices about default
CPUs for 32-bit x86 targets.
  • Loading branch information
ranma42 committed Feb 13, 2016
1 parent 5367776 commit 0062f72
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustc_back/target/i686_apple_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::apple_base::opts();

// Use yonah as default CPU to enable SSE[2] instructions.
// Clang defaults to i686 for this target, but defaulting to yonah
// is consistent with what Clang does for i386-apple-darwin.
base.cpu = "yonah".to_string();

base.pre_link_args.push("-m32".to_string());

Target {
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_back/target/i686_linux_android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::android_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang defaults to i686 and enables SSSE3 for this target, but
// defaulting to pentium4 is consistent with linux and windows
// targets.
base.cpu = "pentium4".to_string();

Target {
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_back/target/i686_pc_windows_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::windows_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang uses the same default.
base.cpu = "pentium4".to_string();

// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_back/target/i686_pc_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang uses the same default.
base.cpu = "pentium4".to_string();

// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_back/target/i686_unknown_dragonfly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::dragonfly_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang uses the same default.
base.cpu = "pentium4".to_string();

base.pre_link_args.push("-m32".to_string());

Target {
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_back/target/i686_unknown_freebsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::freebsd_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang defaults to i486 for this target, but defaulting to
// pentium4 is consistent with linux and windows targets.
base.cpu = "pentium4".to_string();

base.pre_link_args.push("-m32".to_string());

Target {
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_back/target/i686_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang uses the same default.
base.cpu = "pentium4".to_string();

base.pre_link_args.push("-m32".to_string());

Target {
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_back/target/i686_unknown_linux_musl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ use target::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();

// Use pentium4 as default CPU to enable SSE[2] instructions.
// Clang uses the same default.
base.cpu = "pentium4".to_string();

base.pre_link_args.push("-m32".to_string());
base.pre_link_args.push("-Wl,-melf_i386".to_string());

Expand Down

0 comments on commit 0062f72

Please sign in to comment.