summaryrefslogtreecommitdiff
path: root/js/src/jit/mips64/MacroAssembler-mips64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit/mips64/MacroAssembler-mips64.cpp')
-rw-r--r--js/src/jit/mips64/MacroAssembler-mips64.cpp55
1 files changed, 32 insertions, 23 deletions
diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp
index f58184bca1..7021d0f748 100644
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -258,36 +258,45 @@ MacroAssemblerMIPS64::ma_li(Register dest, ImmWord imm)
{
int64_t value = imm.value;
- if (value >= INT16_MIN && value <= INT16_MAX) {
+ if (-1 == (value >> 15) || 0 == (value >> 15)) {
as_addiu(dest, zero, value);
- } else if (imm.value <= UINT16_MAX) {
- as_ori(dest, zero, Imm16::Lower(Imm32(value)).encode());
- } else if (value >= INT32_MIN && value <= INT32_MAX) {
- as_lui(dest, Imm16::Upper(Imm32(value)).encode());
- if (value & 0xffff)
- as_ori(dest, dest, Imm16::Lower(Imm32(value)).encode());
- } else if (imm.value <= UINT32_MAX) {
- as_lui(dest, Imm16::Upper(Imm32(value)).encode());
- if (value & 0xffff)
- as_ori(dest, dest, Imm16::Lower(Imm32(value)).encode());
+ return;
+ }
+ if (0 == (value >> 16)) {
+ as_ori(dest, zero, value);
+ return;
+ }
+
+ if (-1 == (value >> 31) || 0 == (value >> 31)) {
+ as_lui(dest, uint16_t(value >> 16));
+ } else if (0 == (value >> 32)) {
+ as_lui(dest, uint16_t(value >> 16));
as_dinsu(dest, zero, 32, 32);
+ } else if (-1 == (value >> 47) || 0 == (value >> 47)) {
+ as_lui(dest, uint16_t(value >> 32));
+ if (uint16_t(value >> 16))
+ as_ori(dest, dest, uint16_t(value >> 16));
+ as_dsll(dest, dest, 16);
+ } else if (0 == (value >> 48)) {
+ as_lui(dest, uint16_t(value >> 32));
+ as_dinsu(dest, zero, 32, 32);
+ if (uint16_t(value >> 16))
+ as_ori(dest, dest, uint16_t(value >> 16));
+ as_dsll(dest, dest, 16);
} else {
- uint64_t high = imm.value >> 32;
-
- if (imm.value >> 48) {
- as_lui(dest, Imm16::Upper(Imm32(high)).encode());
- if (high & 0xffff)
- as_ori(dest, dest, Imm16::Lower(Imm32(high)).encode());
+ as_lui(dest, uint16_t(value >> 48));
+ if (uint16_t(value >> 32))
+ as_ori(dest, dest, uint16_t(value >> 32));
+ if (uint16_t(value >> 16)) {
+ as_dsll(dest, dest, 16);
+ as_ori(dest, dest, uint16_t(value >> 16));
as_dsll(dest, dest, 16);
} else {
- as_lui(dest, Imm16::Lower(Imm32(high)).encode());
+ as_dsll32(dest, dest, 32);
}
- if ((imm.value >> 16) & 0xffff)
- as_ori(dest, dest, Imm16::Upper(Imm32(value)).encode());
- as_dsll(dest, dest, 16);
- if (value & 0xffff)
- as_ori(dest, dest, Imm16::Lower(Imm32(value)).encode());
}
+ if (uint16_t(value))
+ as_ori(dest, dest, uint16_t(value));
}
// This method generates lui, dsll and ori instruction block that can be modified