File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ use driver::session;
30
30
use driver:: session:: Session ;
31
31
use driver:: driver:: { CrateAnalysis , CrateTranslation } ;
32
32
use lib:: llvm:: { ModuleRef , ValueRef , BasicBlockRef } ;
33
- use lib:: llvm:: { llvm, True } ;
33
+ use lib:: llvm:: { llvm, True , Vector } ;
34
34
use lib;
35
35
use metadata:: common:: LinkMeta ;
36
36
use metadata:: { csearch, encoder} ;
@@ -827,8 +827,10 @@ pub fn cast_shift_rhs(op: ast::BinOp,
827
827
// Shifts may have any size int on the rhs
828
828
unsafe {
829
829
if ast_util:: is_shift_binop ( op) {
830
- let rhs_llty = val_ty ( rhs) ;
831
- let lhs_llty = val_ty ( lhs) ;
830
+ let mut rhs_llty = val_ty ( rhs) ;
831
+ let mut lhs_llty = val_ty ( lhs) ;
832
+ if rhs_llty. kind ( ) == Vector { rhs_llty = rhs_llty. element_type ( ) }
833
+ if lhs_llty. kind ( ) == Vector { lhs_llty = lhs_llty. element_type ( ) }
832
834
let rhs_sz = llvm:: LLVMGetIntTypeWidth ( rhs_llty. to_ref ( ) ) ;
833
835
let lhs_sz = llvm:: LLVMGetIntTypeWidth ( lhs_llty. to_ref ( ) ) ;
834
836
if lhs_sz < rhs_sz {
Original file line number Diff line number Diff line change 10
10
11
11
#[ allow( experimental) ] ;
12
12
13
- use std:: unstable:: simd:: { i32x4, f32x4} ;
13
+ use std:: unstable:: simd:: { i32x4, f32x4, u32x4 } ;
14
14
15
15
fn test_int ( e : i32 ) -> i32 {
16
16
let v = i32x4 ( e, 0i32 , 0i32 , 0i32 ) ;
@@ -24,7 +24,15 @@ fn test_float(e: f32) -> f32 {
24
24
e2
25
25
}
26
26
27
+ pub fn test_shift ( e : u32 ) -> u32 {
28
+ let v = u32x4 ( e, 0u32 , 0u32 , 0u32 ) ;
29
+ let one = u32x4 ( 1u32 , 0u32 , 0u32 , 0u32 ) ;
30
+ let u32x4( e2, _, _, _) = v << one >> one;
31
+ e2
32
+ }
33
+
27
34
pub fn main ( ) {
28
35
assert_eq ! ( test_int( 3i32 ) , 9i32 ) ;
29
36
assert_eq ! ( test_float( 3f32 ) , 9f32 ) ;
37
+ assert_eq ! ( test_shift( 3u32 ) , 3u32 ) ;
30
38
}
You can’t perform that action at this time.
0 commit comments