[rust-dev] hashmap benchmark

Stefan Plantikow stefan.plantikow at googlemail.com
Mon Apr 9 06:12:36 PDT 2012


Hi,

> > #[abi = "rust-intrinsic"]
> > native mod intrinsics {
> > fn bswap_i16(i: i16) -> i16;
> > }
> > 
> > The rust intrinsics would all just be hardcoded into the compiler to 
> > translate to the appropriate llvm intrinsics.
> > 
> > As an llvm intrinsic:
> > 
> > #[abi = "llvm-intrinsic"]
> > native mod intrinsics {
> > #[link_name = "bswap.i16"]
> > fn bswap_i16(i16: i16) -> i16;
> > }
> > 
> > In this case rustc probably doesn't need to know anything specific about 
> > the intrinsic - we just generate an intrinsic instruction with the given 
> > name and types.
> 
> 
> 
> 
> is there any advantage from choosing one form over the other (maybe in terms of optimizability) beyond what already was mentioned?
> 


turns out, ctlz and cttz need an i1 as a second argument, so I guess this means there is the need to implement this via rust-intrinsic.


Stefan.


More information about the Rust-dev mailing list