about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-20 05:46:48 -0800
committerbors <bors@rust-lang.org>2014-02-20 05:46:48 -0800
commit5f324aaf203a9611e9c3ead934d64f92f136ee00 (patch)
tree95f59b852bfe6cf805a8ed0abbd80be473d3eaed
parent882c25fa2ded21f02e26d00045ae72457b08724c (diff)
parenta40b272faef45621548e61254a6e0ddb85fc0a38 (diff)
downloadrust-5f324aaf203a9611e9c3ead934d64f92f136ee00.tar.gz
rust-5f324aaf203a9611e9c3ead934d64f92f136ee00.zip
auto merge of #12399 : michaelwoerister/rust/simd-fix, r=alexcrichton
Fixes  #12333.
I also re-enabled the *function-arg-initialization* test case, so if it passes again, fixes #12021.
-rw-r--r--src/compiletest/runtest.rs27
-rw-r--r--src/librustc/middle/trans/debuginfo.rs8
-rw-r--r--src/test/debug-info/function-arg-initialization.rs1
-rw-r--r--src/test/debug-info/issue7712.rs (renamed from src/test/run-pass/issue-7712.rs)0
-rw-r--r--src/test/debug-info/simd.rs70
5 files changed, 96 insertions, 10 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 30fb8ded871..ff978a308e6 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -258,15 +258,12 @@ actual:\n\
 }
 
 fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
-
-    // do not optimize debuginfo tests
-    let mut config = match config.target_rustcflags {
-        Some(ref flags) => config {
-            target_rustcflags: Some(flags.replace("-O", "")),
-            .. (*config).clone()
-        },
-        None => (*config).clone()
+    let mut config = config {
+        target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags),
+        host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags),
+        .. config.clone()
     };
+
     let config = &mut config;
     let check_lines = &props.check_lines;
     let mut cmds = props.debugger_cmds.connect("\n");
@@ -436,6 +433,20 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
                                   check_lines[i]), &ProcRes);
         }
     }
+
+    fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> {
+        if options.is_none() {
+            return None;
+        }
+
+        // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
+        let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
+        let new_options = split_maybe_args(options).move_iter()
+                                                   .filter(|x| !options_to_remove.contains(x))
+                                                   .to_owned_vec()
+                                                   .connect(" ");
+        Some(new_options)
+    }
 }
 
 fn check_error_patterns(props: &TestProps,
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 86f4275cf98..6a9ee514f8f 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -2111,7 +2111,13 @@ fn type_metadata(cx: &CrateContext,
             trait_metadata(cx, def_id, t, substs, trait_store, mutability, bounds)
         },
         ty::ty_struct(def_id, ref substs) => {
-            prepare_struct_metadata(cx, t, def_id, substs, usage_site_span).finalize(cx)
+            if ty::type_is_simd(cx.tcx, t) {
+                let element_type = ty::simd_type(cx.tcx, t);
+                let len = ty::simd_size(cx.tcx, t);
+                fixed_vec_metadata(cx, element_type, len, usage_site_span)
+            } else {
+                prepare_struct_metadata(cx, t, def_id, substs, usage_site_span).finalize(cx)
+            }
         },
         ty::ty_tup(ref elements) => {
             prepare_tuple_metadata(cx, t, *elements, usage_site_span).finalize(cx)
diff --git a/src/test/debug-info/function-arg-initialization.rs b/src/test/debug-info/function-arg-initialization.rs
index a96266cff9d..9ceec631c00 100644
--- a/src/test/debug-info/function-arg-initialization.rs
+++ b/src/test/debug-info/function-arg-initialization.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // ignore-android: FIXME(#10381)
-// ignore-test: FIXME(#12021)
 
 // This test case checks if function arguments already have the correct value when breaking at the
 // first line of the function, that is if the function prologue has already been executed at the
diff --git a/src/test/run-pass/issue-7712.rs b/src/test/debug-info/issue7712.rs
index f91112416e3..f91112416e3 100644
--- a/src/test/run-pass/issue-7712.rs
+++ b/src/test/debug-info/issue7712.rs
diff --git a/src/test/debug-info/simd.rs b/src/test/debug-info/simd.rs
new file mode 100644
index 00000000000..454d05ec99e
--- /dev/null
+++ b/src/test/debug-info/simd.rs
@@ -0,0 +1,70 @@
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// debugger:rbreak zzz
+// debugger:run
+
+// debugger:finish
+// debugger:print/d i8x16
+// check:$1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
+// debugger:print/d i16x8
+// check:$2 = {16, 17, 18, 19, 20, 21, 22, 23}
+// debugger:print/d i32x4
+// check:$3 = {24, 25, 26, 27}
+// debugger:print/d i64x2
+// check:$4 = {28, 29}
+
+// debugger:print/d u8x16
+// check:$5 = {30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}
+// debugger:print/d u16x8
+// check:$6 = {46, 47, 48, 49, 50, 51, 52, 53}
+// debugger:print/d u32x4
+// check:$7 = {54, 55, 56, 57}
+// debugger:print/d u64x2
+// check:$8 = {58, 59}
+
+// debugger:print f32x4
+// check:$9 = {60.5, 61.5, 62.5, 63.5}
+// debugger:print f64x2
+// check:$10 = {64.5, 65.5}
+
+// debugger:continue
+
+#[allow(experimental)];
+#[allow(unused_variable)];
+
+use std::unstable::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
+
+fn main() {
+
+    let i8x16 = i8x16(0i8, 1i8, 2i8, 3i8, 4i8, 5i8, 6i8, 7i8,
+                      8i8, 9i8, 10i8, 11i8, 12i8, 13i8, 14i8, 15i8);
+
+    let i16x8 = i16x8(16i16, 17i16, 18i16, 19i16, 20i16, 21i16, 22i16, 23i16);
+    let i32x4 = i32x4(24i32, 25i32, 26i32, 27i32);
+    let i64x2 = i64x2(28i64, 29i64);
+
+    let u8x16 = u8x16(30u8, 31u8, 32u8, 33u8, 34u8, 35u8, 36u8, 37u8,
+                      38u8, 39u8, 40u8, 41u8, 42u8, 43u8, 44u8, 45u8);
+    let u16x8 = u16x8(46u16, 47u16, 48u16, 49u16, 50u16, 51u16, 52u16, 53u16);
+    let u32x4 = u32x4(54u32, 55u32, 56u32, 57u32);
+    let u64x2 = u64x2(58u64, 59u64);
+
+    let f32x4 = f32x4(60.5f32, 61.5f32, 62.5f32, 63.5f32);
+    let f64x2 = f64x2(64.5f64, 65.5f64);
+
+    zzz();
+}
+
+#[inline(never)]
+fn zzz() { () }
\ No newline at end of file