Skip to content

Commit 5f324aa

Browse files
committed
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.
2 parents 882c25f + a40b272 commit 5f324aa

File tree

5 files changed

+96
-10
lines changed

5 files changed

+96
-10
lines changed

src/compiletest/runtest.rs

+19-8
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,12 @@ actual:\n\
258258
}
259259

260260
fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
261-
262-
// do not optimize debuginfo tests
263-
let mut config = match config.target_rustcflags {
264-
Some(ref flags) => config {
265-
target_rustcflags: Some(flags.replace("-O", "")),
266-
.. (*config).clone()
267-
},
268-
None => (*config).clone()
261+
let mut config = config {
262+
target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags),
263+
host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags),
264+
.. config.clone()
269265
};
266+
270267
let config = &mut config;
271268
let check_lines = &props.check_lines;
272269
let mut cmds = props.debugger_cmds.connect("\n");
@@ -436,6 +433,20 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
436433
check_lines[i]), &ProcRes);
437434
}
438435
}
436+
437+
fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> {
438+
if options.is_none() {
439+
return None;
440+
}
441+
442+
// Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
443+
let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
444+
let new_options = split_maybe_args(options).move_iter()
445+
.filter(|x| !options_to_remove.contains(x))
446+
.to_owned_vec()
447+
.connect(" ");
448+
Some(new_options)
449+
}
439450
}
440451

441452
fn check_error_patterns(props: &TestProps,

src/librustc/middle/trans/debuginfo.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,13 @@ fn type_metadata(cx: &CrateContext,
21112111
trait_metadata(cx, def_id, t, substs, trait_store, mutability, bounds)
21122112
},
21132113
ty::ty_struct(def_id, ref substs) => {
2114-
prepare_struct_metadata(cx, t, def_id, substs, usage_site_span).finalize(cx)
2114+
if ty::type_is_simd(cx.tcx, t) {
2115+
let element_type = ty::simd_type(cx.tcx, t);
2116+
let len = ty::simd_size(cx.tcx, t);
2117+
fixed_vec_metadata(cx, element_type, len, usage_site_span)
2118+
} else {
2119+
prepare_struct_metadata(cx, t, def_id, substs, usage_site_span).finalize(cx)
2120+
}
21152121
},
21162122
ty::ty_tup(ref elements) => {
21172123
prepare_tuple_metadata(cx, t, *elements, usage_site_span).finalize(cx)

src/test/debug-info/function-arg-initialization.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12-
// ignore-test: FIXME(#12021)
1312

1413
// This test case checks if function arguments already have the correct value when breaking at the
1514
// first line of the function, that is if the function prologue has already been executed at the
File renamed without changes.

src/test/debug-info/simd.rs

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-android: FIXME(#10381)
12+
13+
// compile-flags:-g
14+
// debugger:rbreak zzz
15+
// debugger:run
16+
17+
// debugger:finish
18+
// debugger:print/d i8x16
19+
// check:$1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
20+
// debugger:print/d i16x8
21+
// check:$2 = {16, 17, 18, 19, 20, 21, 22, 23}
22+
// debugger:print/d i32x4
23+
// check:$3 = {24, 25, 26, 27}
24+
// debugger:print/d i64x2
25+
// check:$4 = {28, 29}
26+
27+
// debugger:print/d u8x16
28+
// check:$5 = {30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}
29+
// debugger:print/d u16x8
30+
// check:$6 = {46, 47, 48, 49, 50, 51, 52, 53}
31+
// debugger:print/d u32x4
32+
// check:$7 = {54, 55, 56, 57}
33+
// debugger:print/d u64x2
34+
// check:$8 = {58, 59}
35+
36+
// debugger:print f32x4
37+
// check:$9 = {60.5, 61.5, 62.5, 63.5}
38+
// debugger:print f64x2
39+
// check:$10 = {64.5, 65.5}
40+
41+
// debugger:continue
42+
43+
#[allow(experimental)];
44+
#[allow(unused_variable)];
45+
46+
use std::unstable::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
47+
48+
fn main() {
49+
50+
let i8x16 = i8x16(0i8, 1i8, 2i8, 3i8, 4i8, 5i8, 6i8, 7i8,
51+
8i8, 9i8, 10i8, 11i8, 12i8, 13i8, 14i8, 15i8);
52+
53+
let i16x8 = i16x8(16i16, 17i16, 18i16, 19i16, 20i16, 21i16, 22i16, 23i16);
54+
let i32x4 = i32x4(24i32, 25i32, 26i32, 27i32);
55+
let i64x2 = i64x2(28i64, 29i64);
56+
57+
let u8x16 = u8x16(30u8, 31u8, 32u8, 33u8, 34u8, 35u8, 36u8, 37u8,
58+
38u8, 39u8, 40u8, 41u8, 42u8, 43u8, 44u8, 45u8);
59+
let u16x8 = u16x8(46u16, 47u16, 48u16, 49u16, 50u16, 51u16, 52u16, 53u16);
60+
let u32x4 = u32x4(54u32, 55u32, 56u32, 57u32);
61+
let u64x2 = u64x2(58u64, 59u64);
62+
63+
let f32x4 = f32x4(60.5f32, 61.5f32, 62.5f32, 63.5f32);
64+
let f64x2 = f64x2(64.5f64, 65.5f64);
65+
66+
zzz();
67+
}
68+
69+
#[inline(never)]
70+
fn zzz() { () }

0 commit comments

Comments
 (0)