Skip to content

Commit

Permalink
Fix sve scaling in enitIns_R_S/S_R
Browse files Browse the repository at this point in the history
  • Loading branch information
a74nh committed Mar 22, 2024
1 parent 0d437e3 commit e9fa735
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/coreclr/jit/emitarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9839,11 +9839,7 @@ void emitter::emitIns_R_S(instruction ins, emitAttr attr, regNumber reg1, int va
scale = NaturalScale_helper(EA_16BYTE);
ssize_t mask = (1 << scale) - 1; // the mask of low bits that must be zero to encode the immediate

if (((imm & mask) == 0) && (isValidSimm<9>(imm >> scale)))
{
imm >>= scale; // The immediate is scaled by the size of the ld/st
}
else
if (((imm & mask) != 0) || (!isValidSimm<9>(imm >> scale)))
{
useRegForImm = true;
regNumber rsvdReg = codeGen->rsGetRsvdReg();
Expand All @@ -9867,11 +9863,7 @@ void emitter::emitIns_R_S(instruction ins, emitAttr attr, regNumber reg1, int va
scale = NaturalScale_helper(EA_2BYTE);
ssize_t mask = (1 << scale) - 1; // the mask of low bits that must be zero to encode the immediate

if (((imm & mask) == 0) && (isValidSimm<9>(imm >> scale)))
{
imm >>= scale; // The immediate is scaled by the size of the ld/st
}
else
if (((imm & mask) != 0) || (!isValidSimm<9>(imm >> scale)))
{
useRegForImm = true;
regNumber rsvdReg = codeGen->rsGetRsvdReg();
Expand Down Expand Up @@ -10118,11 +10110,7 @@ void emitter::emitIns_S_R(instruction ins, emitAttr attr, regNumber reg1, int va
scale = NaturalScale_helper(EA_16BYTE);
ssize_t mask = (1 << scale) - 1; // the mask of low bits that must be zero to encode the immediate

if (((imm & mask) == 0) && (isValidSimm<9>(imm >> scale)))
{
imm >>= scale; // The immediate is scaled by the size of the ld/st
}
else
if (((imm & mask) != 0) || (!isValidSimm<9>(imm >> scale)))
{
useRegForImm = true;
regNumber rsvdReg = codeGen->rsGetRsvdReg();
Expand All @@ -10146,11 +10134,7 @@ void emitter::emitIns_S_R(instruction ins, emitAttr attr, regNumber reg1, int va
scale = NaturalScale_helper(EA_2BYTE);
ssize_t mask = (1 << scale) - 1; // the mask of low bits that must be zero to encode the immediate

if (((imm & mask) == 0) && (isValidSimm<9>(imm >> scale)))
{
imm >>= scale; // The immediate is scaled by the size of the ld/st
}
else
if (((imm & mask) != 0) || (!isValidSimm<9>(imm >> scale)))
{
useRegForImm = true;
regNumber rsvdReg = codeGen->rsGetRsvdReg();
Expand Down

0 comments on commit e9fa735

Please sign in to comment.