diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 6879070953..7d42c4364d 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -1644,6 +1644,19 @@ unit cgx86; href.index:=src2; list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst)); end + else if (op in [OP_SHR,OP_SHL]) and + (CPUX86_HAS_BMI2 in cpu_capabilities[current_settings.cputype]) and + (size in [OS_32,OS_S32 +{$ifdef x86_64} + ,OS_64,OS_S64 +{$endif x86_64} + ]) then + begin + if op=OP_SHL then + list.concat(taicpu.op_reg_reg_reg(A_SHLX,TCgSize2OpSize[size],src1,src2,dst)) + else + list.concat(taicpu.op_reg_reg_reg(A_SHRX,TCgSize2OpSize[size],src1,src2,dst)); + end else inherited a_op_reg_reg_reg(list,op,size,src1,src2,dst); end;