@@ -918,37 +918,36 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
918
918
}
919
919
920
920
( _, _) => {
921
- match Intrinsic :: find ( tcx, & name) {
921
+ let intr = match Intrinsic :: find ( tcx, & name) {
922
+ Some ( intr) => intr,
922
923
None => ccx. sess ( ) . span_bug ( foreign_item. span , "unknown intrinsic" ) ,
923
- Some ( intr) => {
924
- fn ty_to_type ( ccx : & CrateContext , t : & intrinsics:: Type ) -> Type {
925
- use intrinsics:: Type :: * ;
926
- match * t {
927
- Integer ( x) => Type :: ix ( ccx, x as u64 ) ,
928
- Float ( x) => {
929
- match x {
930
- 32 => Type :: f32 ( ccx) ,
931
- 64 => Type :: f64 ( ccx) ,
932
- _ => unreachable ! ( )
933
- }
934
- }
935
- Pointer ( _) => unimplemented ! ( ) ,
936
- Vector ( ref t, length) => Type :: vector ( & ty_to_type ( ccx, t) ,
937
- length as u64 )
924
+ } ;
925
+ fn ty_to_type ( ccx : & CrateContext , t : & intrinsics:: Type ) -> Type {
926
+ use intrinsics:: Type :: * ;
927
+ match * t {
928
+ Integer ( x) => Type :: ix ( ccx, x as u64 ) ,
929
+ Float ( x) => {
930
+ match x {
931
+ 32 => Type :: f32 ( ccx) ,
932
+ 64 => Type :: f64 ( ccx) ,
933
+ _ => unreachable ! ( )
938
934
}
939
935
}
936
+ Pointer ( _) => unimplemented ! ( ) ,
937
+ Vector ( ref t, length) => Type :: vector ( & ty_to_type ( ccx, t) ,
938
+ length as u64 )
939
+ }
940
+ }
940
941
941
- let inputs = intr. inputs . iter ( ) . map ( |t| ty_to_type ( ccx, t) ) . collect :: < Vec < _ > > ( ) ;
942
- let outputs = ty_to_type ( ccx, & intr. output ) ;
943
- match intr. definition {
944
- intrinsics:: IntrinsicDef :: Named ( name) => {
945
- let f = declare:: declare_cfn ( ccx,
946
- name,
947
- Type :: func ( & inputs, & outputs) ,
948
- tcx. mk_nil ( ) ) ;
949
- Call ( bcx, f, & llargs, None , call_debug_location)
950
- }
951
- }
942
+ let inputs = intr. inputs . iter ( ) . map ( |t| ty_to_type ( ccx, t) ) . collect :: < Vec < _ > > ( ) ;
943
+ let outputs = ty_to_type ( ccx, & intr. output ) ;
944
+ match intr. definition {
945
+ intrinsics:: IntrinsicDef :: Named ( name) => {
946
+ let f = declare:: declare_cfn ( ccx,
947
+ name,
948
+ Type :: func ( & inputs, & outputs) ,
949
+ tcx. mk_nil ( ) ) ;
950
+ Call ( bcx, f, & llargs, None , call_debug_location)
952
951
}
953
952
}
954
953
}
@@ -1330,6 +1329,15 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1330
1329
call_debug_location : DebugLoc ,
1331
1330
call_info : NodeIdAndSpan ) -> ValueRef
1332
1331
{
1332
+ macro_rules! require {
1333
+ ( $cond: expr, $( $fmt: tt) * ) => {
1334
+ if !$cond {
1335
+ bcx. sess( ) . span_err( call_info. span, & format!( $( $fmt) * ) ) ;
1336
+ return C_null ( llret_ty)
1337
+ }
1338
+ }
1339
+ }
1340
+
1333
1341
let tcx = bcx. tcx ( ) ;
1334
1342
let arg_tys = match callee_ty. sty {
1335
1343
ty:: TyBareFn ( _, ref f) => {
@@ -1348,15 +1356,6 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1348
1356
_ => None
1349
1357
} ;
1350
1358
1351
- macro_rules! require {
1352
- ( $cond: expr, $( $fmt: tt) * ) => {
1353
- if !$cond {
1354
- bcx. sess( ) . span_err( call_info. span, & format!( $( $fmt) * ) ) ;
1355
- return C_null ( llret_ty)
1356
- }
1357
- }
1358
- }
1359
-
1360
1359
if let Some ( cmp_op) = comparison {
1361
1360
assert_eq ! ( arg_tys. len( ) , 2 ) ;
1362
1361
require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
0 commit comments