@@ -32,7 +32,7 @@ enum RegClass {
32
32
SSEFv ,
33
33
SSEDs ,
34
34
SSEDv ,
35
- SSEInt ,
35
+ SSEInt ( /* bitwidth */ u64 ) ,
36
36
/// Data that can appear in the upper half of an SSE register.
37
37
SSEUp ,
38
38
X87 ,
@@ -57,7 +57,7 @@ impl TypeMethods for Type {
57
57
impl RegClass {
58
58
fn is_sse ( & self ) -> bool {
59
59
match * self {
60
- SSEFs | SSEFv | SSEDs | SSEDv => true ,
60
+ SSEFs | SSEFv | SSEDs | SSEDv | SSEInt ( _ ) => true ,
61
61
_ => false
62
62
}
63
63
}
@@ -254,7 +254,7 @@ fn classify_ty(ty: Type) -> Vec<RegClass> {
254
254
let elt = ty. element_type ( ) ;
255
255
let eltsz = ty_size ( elt) ;
256
256
let mut reg = match elt. kind ( ) {
257
- Integer => SSEInt ,
257
+ Integer => SSEInt ( elt . int_width ( ) ) ,
258
258
Float => SSEFv ,
259
259
Double => SSEDv ,
260
260
_ => panic ! ( "classify: unhandled vector element type" )
@@ -350,19 +350,19 @@ fn llreg_ty(ccx: &CrateContext, cls: &[RegClass]) -> Type {
350
350
Int => {
351
351
tys. push ( Type :: i64 ( ccx) ) ;
352
352
}
353
- SSEFv | SSEDv | SSEInt => {
353
+ SSEFv | SSEDv | SSEInt ( _ ) => {
354
354
let ( elts_per_word, elt_ty) = match cls[ i] {
355
355
SSEFv => ( 2 , Type :: f32 ( ccx) ) ,
356
356
SSEDv => ( 1 , Type :: f64 ( ccx) ) ,
357
- // FIXME: need to handle the element types, since
358
- // C doesn't distinguish between the contained
359
- // types of the vector at all; normalise to u8,
360
- // maybe?
361
- SSEInt => panic ! ( "llregtype: SSEInt not yet supported" ) ,
357
+ SSEInt ( bits ) => {
358
+ assert ! ( bits == 8 || bits == 16 || bits == 32 || bits == 64 ,
359
+ "llreg_ty: unsupported SSEInt width {}" , bits ) ;
360
+ ( 64 / bits , Type :: ix ( ccx , bits ) )
361
+ }
362
362
_ => unreachable ! ( ) ,
363
363
} ;
364
364
let vec_len = llvec_len ( & cls[ ( i + 1 u) ..] ) ;
365
- let vec_ty = Type :: vector ( & elt_ty, ( vec_len * elts_per_word ) as u64 ) ;
365
+ let vec_ty = Type :: vector ( & elt_ty, vec_len as u64 * elts_per_word ) ;
366
366
tys. push ( vec_ty) ;
367
367
i += vec_len;
368
368
continue ;
0 commit comments