Skip to content

Commit a2227f9

Browse files
committed
librustc: don't skip ahead when computing register types of SSEFloatVectors
Also fixes an unrelated typo (found by comparing to the original code of the clay project) and some cleanup. Fixes #7415.
1 parent 7971202 commit a2227f9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/librustc/middle/trans/cabi_x86_64.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
122122
Float => 4,
123123
Double => 8,
124124
Struct => {
125+
let str_tys = ty.field_types();
125126
if ty.is_packed() {
126-
let str_tys = ty.field_types();
127127
str_tys.iter().fold(0, |s, t| s + ty_size(*t))
128128
} else {
129-
let str_tys = ty.field_types();
130129
let size = str_tys.iter().fold(0, |s, t| align(s, *t) + ty_size(*t));
131130
align(size, ty)
132131
}
@@ -236,9 +235,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
236235
let mut i = 0u;
237236
let ty_kind = ty.kind();
238237
let e = cls.len();
239-
if cls.len() > 2u &&
240-
(ty_kind == Struct ||
241-
ty_kind == Array) {
238+
if cls.len() > 2u && (ty_kind == Struct || ty_kind == Array) {
242239
if cls[i].is_sse() {
243240
i += 1u;
244241
while i < e {
@@ -265,7 +262,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
265262
return;
266263
}
267264
if cls[i] == SSEUp {
268-
cls[i] = SSEInt;
265+
cls[i] = SSEDv;
269266
} else if cls[i].is_sse() {
270267
i += 1;
271268
while i != e && cls[i] == SSEUp { i += 1u; }
@@ -283,7 +280,6 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
283280
let mut cls = vec::from_elem(words, NoClass);
284281
if words > 4 {
285282
all_mem(cls);
286-
let cls = cls;
287283
return cls;
288284
}
289285
classify(ty, cls, 0, 0);
@@ -312,8 +308,8 @@ fn llreg_ty(cls: &[RegClass]) -> Type {
312308
tys.push(Type::i64());
313309
}
314310
SSEFv => {
315-
let vec_len = llvec_len(cls.tailn(i + 1u)) * 2u;
316-
let vec_ty = Type::vector(&Type::f32(), vec_len as u64);
311+
let vec_len = llvec_len(cls.tailn(i + 1u));
312+
let vec_ty = Type::vector(&Type::f32(), (vec_len * 2u) as u64);
317313
tys.push(vec_ty);
318314
i += vec_len;
319315
loop;

0 commit comments

Comments
 (0)