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.
This commit is contained in:
parent
7971202a4e
commit
a2227f9e0c
@ -122,11 +122,10 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
|
||||
Float => 4,
|
||||
Double => 8,
|
||||
Struct => {
|
||||
let str_tys = ty.field_types();
|
||||
if ty.is_packed() {
|
||||
let str_tys = ty.field_types();
|
||||
str_tys.iter().fold(0, |s, t| s + ty_size(*t))
|
||||
} else {
|
||||
let str_tys = ty.field_types();
|
||||
let size = str_tys.iter().fold(0, |s, t| align(s, *t) + ty_size(*t));
|
||||
align(size, ty)
|
||||
}
|
||||
@ -236,9 +235,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
|
||||
let mut i = 0u;
|
||||
let ty_kind = ty.kind();
|
||||
let e = cls.len();
|
||||
if cls.len() > 2u &&
|
||||
(ty_kind == Struct ||
|
||||
ty_kind == Array) {
|
||||
if cls.len() > 2u && (ty_kind == Struct || ty_kind == Array) {
|
||||
if cls[i].is_sse() {
|
||||
i += 1u;
|
||||
while i < e {
|
||||
@ -265,7 +262,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
|
||||
return;
|
||||
}
|
||||
if cls[i] == SSEUp {
|
||||
cls[i] = SSEInt;
|
||||
cls[i] = SSEDv;
|
||||
} else if cls[i].is_sse() {
|
||||
i += 1;
|
||||
while i != e && cls[i] == SSEUp { i += 1u; }
|
||||
@ -283,7 +280,6 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
|
||||
let mut cls = vec::from_elem(words, NoClass);
|
||||
if words > 4 {
|
||||
all_mem(cls);
|
||||
let cls = cls;
|
||||
return cls;
|
||||
}
|
||||
classify(ty, cls, 0, 0);
|
||||
@ -312,8 +308,8 @@ fn llreg_ty(cls: &[RegClass]) -> Type {
|
||||
tys.push(Type::i64());
|
||||
}
|
||||
SSEFv => {
|
||||
let vec_len = llvec_len(cls.tailn(i + 1u)) * 2u;
|
||||
let vec_ty = Type::vector(&Type::f32(), vec_len as u64);
|
||||
let vec_len = llvec_len(cls.tailn(i + 1u));
|
||||
let vec_ty = Type::vector(&Type::f32(), (vec_len * 2u) as u64);
|
||||
tys.push(vec_ty);
|
||||
i += vec_len;
|
||||
loop;
|
||||
|
Loading…
x
Reference in New Issue
Block a user