8343810: [s390x] is_uimm* methods should take unsigned arguments
Reviewed-by: lucy
This commit is contained in:
parent
f12c370d73
commit
a93bd9dfdd
@ -56,24 +56,23 @@ class Immediate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test if x is within signed immediate range for nbits.
|
// Test if x is within signed immediate range for nbits.
|
||||||
static bool is_uimm(int64_t x, unsigned int nbits) {
|
static bool is_uimm(uint64_t x, unsigned int nbits) {
|
||||||
// nbits == 0 --> false
|
// nbits == 0 --> false
|
||||||
// nbits >= 64 --> true
|
// nbits >= 64 --> true
|
||||||
assert(1 <= nbits && nbits < 64, "don't call, use statically known result");
|
assert(1 <= nbits && nbits < 64, "don't call, use statically known result");
|
||||||
const uint64_t xu = (unsigned long)x;
|
|
||||||
const uint64_t maxplus1 = 1UL << nbits;
|
const uint64_t maxplus1 = 1UL << nbits;
|
||||||
return xu < maxplus1; // Unsigned comparison. Negative inputs appear to be very large.
|
return x < maxplus1; // Unsigned comparison. Negative inputs appear to be very large.
|
||||||
}
|
}
|
||||||
static bool is_uimm32(int64_t x) {
|
static bool is_uimm32(uint64_t x) {
|
||||||
return is_uimm(x, 32);
|
return is_uimm(x, 32);
|
||||||
}
|
}
|
||||||
static bool is_uimm16(int64_t x) {
|
static bool is_uimm16(uint64_t x) {
|
||||||
return is_uimm(x, 16);
|
return is_uimm(x, 16);
|
||||||
}
|
}
|
||||||
static bool is_uimm12(int64_t x) {
|
static bool is_uimm12(uint64_t x) {
|
||||||
return is_uimm(x, 12);
|
return is_uimm(x, 12);
|
||||||
}
|
}
|
||||||
static bool is_uimm8(int64_t x) {
|
static bool is_uimm8(uint64_t x) {
|
||||||
return is_uimm(x, 8);
|
return is_uimm(x, 8);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user