@@ -222,7 +222,7 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
222222 _ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
223223 } ) ;
224224 }
225- "llvm.x86.avx2.pshuf.b" => {
225+ "llvm.x86.ssse3.pshuf.b.128" | "llvm.x86. avx2.pshuf.b" => {
226226 let ( a, b) = match args {
227227 [ a, b] => ( a, b) ,
228228 _ => bug ! ( "wrong number of args for intrinsic {intrinsic}" ) ,
@@ -241,15 +241,18 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
241241 let res = fx. bcx . ins ( ) . select ( is_zero, zero, a_lane) ;
242242 ret. place_lane ( fx, i) . to_ptr ( ) . store ( fx, res, MemFlags :: trusted ( ) ) ;
243243 }
244- for i in 16 ..32 {
245- let b_lane = b. value_lane ( fx, i) . load_scalar ( fx) ;
246- let is_zero = fx. bcx . ins ( ) . band_imm ( b_lane, 0x80 ) ;
247- let b_lane_masked = fx. bcx . ins ( ) . band_imm ( b_lane, 0xf ) ;
248- let a_idx = fx. bcx . ins ( ) . iadd_imm ( b_lane_masked, 16 ) ;
249- let a_idx = fx. bcx . ins ( ) . uextend ( fx. pointer_type , a_idx) ;
250- let a_lane = a. value_lane_dyn ( fx, a_idx) . load_scalar ( fx) ;
251- let res = fx. bcx . ins ( ) . select ( is_zero, zero, a_lane) ;
252- ret. place_lane ( fx, i) . to_ptr ( ) . store ( fx, res, MemFlags :: trusted ( ) ) ;
244+
245+ if intrinsic == "llvm.x86.avx2.pshuf.b" {
246+ for i in 16 ..32 {
247+ let b_lane = b. value_lane ( fx, i) . load_scalar ( fx) ;
248+ let is_zero = fx. bcx . ins ( ) . band_imm ( b_lane, 0x80 ) ;
249+ let b_lane_masked = fx. bcx . ins ( ) . band_imm ( b_lane, 0xf ) ;
250+ let a_idx = fx. bcx . ins ( ) . iadd_imm ( b_lane_masked, 16 ) ;
251+ let a_idx = fx. bcx . ins ( ) . uextend ( fx. pointer_type , a_idx) ;
252+ let a_lane = a. value_lane_dyn ( fx, a_idx) . load_scalar ( fx) ;
253+ let res = fx. bcx . ins ( ) . select ( is_zero, zero, a_lane) ;
254+ ret. place_lane ( fx, i) . to_ptr ( ) . store ( fx, res, MemFlags :: trusted ( ) ) ;
255+ }
253256 }
254257 }
255258 "llvm.x86.avx2.vperm2i128" => {
0 commit comments