@@ -918,37 +918,36 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
918918 }
919919
920920 ( _, _) => {
921- match Intrinsic :: find ( tcx, & name) {
921+ let intr = match Intrinsic :: find ( tcx, & name) {
922+ Some ( intr) => intr,
922923 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 ! ( )
938934 }
939935 }
936+ Pointer ( _) => unimplemented ! ( ) ,
937+ Vector ( ref t, length) => Type :: vector ( & ty_to_type ( ccx, t) ,
938+ length as u64 )
939+ }
940+ }
940941
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)
952951 }
953952 }
954953 }
@@ -1330,6 +1329,15 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
13301329 call_debug_location : DebugLoc ,
13311330 call_info : NodeIdAndSpan ) -> ValueRef
13321331{
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+
13331341 let tcx = bcx. tcx ( ) ;
13341342 let arg_tys = match callee_ty. sty {
13351343 ty:: TyBareFn ( _, ref f) => {
@@ -1348,15 +1356,6 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
13481356 _ => None
13491357 } ;
13501358
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-
13601359 if let Some ( cmp_op) = comparison {
13611360 assert_eq ! ( arg_tys. len( ) , 2 ) ;
13621361 require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
0 commit comments