Skip to content

Commit

Permalink
8280476: [macOS] : hotspot arm64 bug exposed by latest clang
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, adinn
  • Loading branch information
Daniel D. Daugherty authored and benty-amzn committed Mar 24, 2022
1 parent 10cb34b commit c91b386
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/hotspot/src/cpu/aarch64/vm/immediate_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,18 @@ static inline u_int32_t uimm(u_int32_t val, int hi, int lo)

u_int64_t replicate(u_int64_t bits, int nbits, int count)
{
u_int64_t result = 0;
// nbits may be 64 in which case we want mask to be -1
u_int64_t mask = ones(nbits);
assert(count > 0, "must be");
assert(nbits > 0, "must be");
assert(count * nbits <= 64, "must be");

// Special case nbits == 64 since the shift below with that nbits value
// would result in undefined behavior.
if (nbits == 64) {
return bits;
}

uint64_t result = 0;
uint64_t mask = ones(nbits);
for (int i = 0; i < count ; i++) {
result <<= nbits;
result |= (bits & mask);
Expand Down

0 comments on commit c91b386

Please sign in to comment.