@@ -180,6 +180,23 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
180
180
_ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
181
181
} ) ;
182
182
}
183
+ "llvm.x86.sse2.psrai.d" => {
184
+ let ( a, imm8) = match args {
185
+ [ a, imm8] => ( a, imm8) ,
186
+ _ => bug ! ( "wrong number of args for intrinsic {intrinsic}" ) ,
187
+ } ;
188
+ let a = codegen_operand ( fx, a) ;
189
+ let imm8 = crate :: constant:: mir_operand_get_const_val ( fx, imm8)
190
+ . expect ( "llvm.x86.sse2.psrai.d imm8 not const" ) ;
191
+
192
+ simd_for_each_lane ( fx, a, ret, & |fx, _lane_ty, _res_lane_ty, lane| match imm8
193
+ . try_to_bits ( Size :: from_bytes ( 4 ) )
194
+ . unwrap_or_else ( || panic ! ( "imm8 not scalar: {:?}" , imm8) )
195
+ {
196
+ imm8 if imm8 < 32 => fx. bcx . ins ( ) . sshr_imm ( lane, i64:: from ( imm8 as u8 ) ) ,
197
+ _ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
198
+ } ) ;
199
+ }
183
200
"llvm.x86.sse2.pslli.d" => {
184
201
let ( a, imm8) = match args {
185
202
[ a, imm8] => ( a, imm8) ,
@@ -214,6 +231,23 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
214
231
_ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
215
232
} ) ;
216
233
}
234
+ "llvm.x86.sse2.psrai.w" => {
235
+ let ( a, imm8) = match args {
236
+ [ a, imm8] => ( a, imm8) ,
237
+ _ => bug ! ( "wrong number of args for intrinsic {intrinsic}" ) ,
238
+ } ;
239
+ let a = codegen_operand ( fx, a) ;
240
+ let imm8 = crate :: constant:: mir_operand_get_const_val ( fx, imm8)
241
+ . expect ( "llvm.x86.sse2.psrai.d imm8 not const" ) ;
242
+
243
+ simd_for_each_lane ( fx, a, ret, & |fx, _lane_ty, _res_lane_ty, lane| match imm8
244
+ . try_to_bits ( Size :: from_bytes ( 4 ) )
245
+ . unwrap_or_else ( || panic ! ( "imm8 not scalar: {:?}" , imm8) )
246
+ {
247
+ imm8 if imm8 < 16 => fx. bcx . ins ( ) . sshr_imm ( lane, i64:: from ( imm8 as u8 ) ) ,
248
+ _ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
249
+ } ) ;
250
+ }
217
251
"llvm.x86.sse2.pslli.w" => {
218
252
let ( a, imm8) = match args {
219
253
[ a, imm8] => ( a, imm8) ,
@@ -248,6 +282,23 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
248
282
_ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
249
283
} ) ;
250
284
}
285
+ "llvm.x86.avx.psrai.d" => {
286
+ let ( a, imm8) = match args {
287
+ [ a, imm8] => ( a, imm8) ,
288
+ _ => bug ! ( "wrong number of args for intrinsic {intrinsic}" ) ,
289
+ } ;
290
+ let a = codegen_operand ( fx, a) ;
291
+ let imm8 = crate :: constant:: mir_operand_get_const_val ( fx, imm8)
292
+ . expect ( "llvm.x86.avx.psrai.d imm8 not const" ) ;
293
+
294
+ simd_for_each_lane ( fx, a, ret, & |fx, _lane_ty, _res_lane_ty, lane| match imm8
295
+ . try_to_bits ( Size :: from_bytes ( 4 ) )
296
+ . unwrap_or_else ( || panic ! ( "imm8 not scalar: {:?}" , imm8) )
297
+ {
298
+ imm8 if imm8 < 32 => fx. bcx . ins ( ) . sshr_imm ( lane, i64:: from ( imm8 as u8 ) ) ,
299
+ _ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
300
+ } ) ;
301
+ }
251
302
"llvm.x86.avx.pslli.d" => {
252
303
let ( a, imm8) = match args {
253
304
[ a, imm8] => ( a, imm8) ,
@@ -282,6 +333,23 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
282
333
_ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
283
334
} ) ;
284
335
}
336
+ "llvm.x86.avx2.psrai.w" => {
337
+ let ( a, imm8) = match args {
338
+ [ a, imm8] => ( a, imm8) ,
339
+ _ => bug ! ( "wrong number of args for intrinsic {intrinsic}" ) ,
340
+ } ;
341
+ let a = codegen_operand ( fx, a) ;
342
+ let imm8 = crate :: constant:: mir_operand_get_const_val ( fx, imm8)
343
+ . expect ( "llvm.x86.avx.psrai.w imm8 not const" ) ;
344
+
345
+ simd_for_each_lane ( fx, a, ret, & |fx, _lane_ty, _res_lane_ty, lane| match imm8
346
+ . try_to_bits ( Size :: from_bytes ( 4 ) )
347
+ . unwrap_or_else ( || panic ! ( "imm8 not scalar: {:?}" , imm8) )
348
+ {
349
+ imm8 if imm8 < 16 => fx. bcx . ins ( ) . sshr_imm ( lane, i64:: from ( imm8 as u8 ) ) ,
350
+ _ => fx. bcx . ins ( ) . iconst ( types:: I32 , 0 ) ,
351
+ } ) ;
352
+ }
285
353
"llvm.x86.avx2.pslli.w" => {
286
354
let ( a, imm8) = match args {
287
355
[ a, imm8] => ( a, imm8) ,
0 commit comments