Skip to content

Commit 7707044

Browse files
committed
further refactoring of codegen
1 parent 8920e76 commit 7707044

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/coreclr/jit/hwintrinsiccodegenarm64.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,6 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
26672667
const unsigned numRotBits = genCountBits(rotMask);
26682668
const unsigned indexMask = (baseType == TYP_SHORT || baseType == TYP_USHORT) ? 0b11 : 0b1;
26692669
const unsigned numIndexBits = genCountBits(indexMask);
2670-
const unsigned immShift = (baseType == TYP_SHORT || baseType == TYP_USHORT) ? 3 : 1;
26712670

26722671
GetEmitter()->emitIns_R_R_I(INS_lsl, scalarSize, op5Reg, op5Reg, numIndexBits);
26732672
GetEmitter()->emitIns_R_R_R(INS_orr, scalarSize, op4Reg, op4Reg, op5Reg);
@@ -2685,13 +2684,13 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
26852684
}
26862685

26872686
const int value = helper.ImmValue();
2688-
const ssize_t index = (baseType == TYP_SHORT || baseType == TYP_USHORT) ? value & 3 : value & 1;
2689-
const ssize_t rotation = (baseType == TYP_SHORT || baseType == TYP_USHORT) ? (value >> 2) & 3 : value >> 1;
2687+
const ssize_t index = value & indexMask;
2688+
const ssize_t rotation = value >> numIndexBits;
26902689
GetEmitter()->emitInsSve_R_R_R_I_I(ins, emitSize, targetReg, op2Reg, op3Reg, index,
26912690
rotation, opt);
26922691
}
26932692

2694-
GetEmitter()->emitIns_R_R_I(INS_and, scalarSize, op4Reg, op4Reg, immShift);
2693+
GetEmitter()->emitIns_R_R_I(INS_and, scalarSize, op4Reg, op4Reg, indexMask);
26952694
GetEmitter()->emitIns_R_R_I(INS_lsr, scalarSize, op5Reg, op5Reg, numIndexBits);
26962695

26972696
}
@@ -2814,7 +2813,6 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
28142813
const unsigned numRotBits = genCountBits(rotMask);
28152814
const unsigned indexMask = (baseType == TYP_BYTE) ? 0b11 : 0b1;
28162815
const unsigned numIndexBits = genCountBits(indexMask);
2817-
const unsigned immShift = (baseType == TYP_BYTE) ? 3 : 1;
28182816

28192817
GetEmitter()->emitIns_R_R_I(INS_lsl, scalarSize, op5Reg, op5Reg, numIndexBits);
28202818
GetEmitter()->emitIns_R_R_R(INS_orr, scalarSize, op4Reg, op4Reg, op5Reg);
@@ -2832,13 +2830,13 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
28322830
}
28332831

28342832
const int value = helper.ImmValue();
2835-
const ssize_t index = (baseType == TYP_BYTE) ? value & 3 : value & 1;
2836-
const ssize_t rotation = (baseType == TYP_BYTE) ? (value >> 2) & 3 : value >> 1;
2833+
const ssize_t index = value & indexMask;
2834+
const ssize_t rotation = value >> numIndexBits;
28372835
GetEmitter()->emitInsSve_R_R_R_I_I(ins, emitSize, targetReg, op2Reg, op3Reg, index,
28382836
rotation, opt);
28392837
}
28402838

2841-
GetEmitter()->emitIns_R_R_I(INS_and, scalarSize, op4Reg, op4Reg, immShift);
2839+
GetEmitter()->emitIns_R_R_I(INS_and, scalarSize, op4Reg, op4Reg, indexMask);
28422840
GetEmitter()->emitIns_R_R_I(INS_lsr, scalarSize, op5Reg, op5Reg, numIndexBits);
28432841
}
28442842

0 commit comments

Comments
 (0)