@@ -96,7 +96,6 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
96
96
let arg_tys = sig. inputs ( ) ;
97
97
let ret_ty = sig. output ( ) ;
98
98
let name = tcx. item_name ( def_id) ;
99
- let name_str = & * name. as_str ( ) ;
100
99
101
100
let llret_ty = self . layout_of ( ret_ty) . llvm_type ( self ) ;
102
101
let result = PlaceRef :: new_sized ( llresult, fn_abi. ret . layout ) ;
@@ -230,9 +229,14 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
230
229
& [ args[ 0 ] . immediate ( ) , y] ,
231
230
)
232
231
}
233
- sym:: ctlz_nonzero | sym :: cttz_nonzero => {
232
+ sym:: ctlz_nonzero => {
234
233
let y = self . const_bool ( true ) ;
235
- let llvm_name = & format ! ( "llvm.{}.i{}" , & name_str[ ..4 ] , width) ;
234
+ let llvm_name = & format ! ( "llvm.ctlz.i{}" , width) ;
235
+ self . call_intrinsic ( llvm_name, & [ args[ 0 ] . immediate ( ) , y] )
236
+ }
237
+ sym:: cttz_nonzero => {
238
+ let y = self . const_bool ( true ) ;
239
+ let llvm_name = & format ! ( "llvm.cttz.i{}" , width) ;
236
240
self . call_intrinsic ( llvm_name, & [ args[ 0 ] . immediate ( ) , y] )
237
241
}
238
242
sym:: ctpop => self . call_intrinsic (
@@ -353,7 +357,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
353
357
return ;
354
358
}
355
359
356
- _ if name_str . starts_with ( "simd_" ) => {
360
+ _ if name . as_str ( ) . starts_with ( "simd_" ) => {
357
361
match generic_simd_intrinsic ( self , name, callee_ty, args, ret_ty, llret_ty, span) {
358
362
Ok ( llval) => llval,
359
363
Err ( ( ) ) => return ,
@@ -843,7 +847,6 @@ fn generic_simd_intrinsic(
843
847
let sig =
844
848
tcx. normalize_erasing_late_bound_regions ( ty:: ParamEnv :: reveal_all ( ) , callee_ty. fn_sig ( tcx) ) ;
845
849
let arg_tys = sig. inputs ( ) ;
846
- let name_str = & * name. as_str ( ) ;
847
850
848
851
if name == sym:: simd_select_bitmask {
849
852
let in_ty = arg_tys[ 0 ] ;
@@ -917,7 +920,7 @@ fn generic_simd_intrinsic(
917
920
) ) ;
918
921
}
919
922
920
- if let Some ( stripped) = name_str . strip_prefix ( "simd_shuffle" ) {
923
+ if let Some ( stripped) = name . as_str ( ) . strip_prefix ( "simd_shuffle" ) {
921
924
// If this intrinsic is the older "simd_shuffleN" form, simply parse the integer.
922
925
// If there is no suffix, use the index array length.
923
926
let n: u64 = if stripped. is_empty ( ) {
0 commit comments