summaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-10-08 13:33:18 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-10-08 13:33:18 +0000
commit4a50440db946c7b5d6ba770589a4999857aeb617 (patch)
treea5e1d249ff97696a4969e9d458be21becdc1ffd9 /src/runtime
parent7261134ad8a2af8a1caa1fc4f303e63a5658aa23 (diff)
bugfix in GNU lightning for ARM
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/c/pgf/lightning/arm/funcs.h238
1 files changed, 119 insertions, 119 deletions
diff --git a/src/runtime/c/pgf/lightning/arm/funcs.h b/src/runtime/c/pgf/lightning/arm/funcs.h
index 79d63df40..a2559d1bb 100644
--- a/src/runtime/c/pgf/lightning/arm/funcs.h
+++ b/src/runtime/c/pgf/lightning/arm/funcs.h
@@ -107,7 +107,7 @@ jit_get_cpu(void)
static void
arm_patch_arguments(struct jit_local_state* jitl)
-{
+{
int reg;
int ioff;
int foff;
@@ -122,183 +122,183 @@ arm_patch_arguments(struct jit_local_state* jitl)
ioff = foff = 0;
for (index = jitl->nextarg_put - 1, offset = 0; index >= 0; index--) {
- if (jitl->types[index >> 5] & (1 << (index & 31)))
- size = sizeof(double);
- else
- size = sizeof(int);
- u.i = jitl->arguments[index];
- if (jit_thumb_p()) {
- code2thumb(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- switch (thumb.i & 0xfff00f00) {
+ if (jitl->types[index >> 5] & (1 << (index & 31)))
+ size = sizeof(double);
+ else
+ size = sizeof(int);
+ u.i = jitl->arguments[index];
+#ifdef USE_THUMB_CODE
+ code2thumb(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ switch (thumb.i & 0xfff00f00) {
case ARM_CC_AL|ARM_VSTR|ARM_P:
- if (jit_hardfp_p()) {
+ if (jit_hardfp_p()) {
if (foff < 16) {
- reg = (thumb.i >> 12) & 0xf;
- thumb.i = (ARM_CC_AL|ARM_VMOV_F |
- ((foff >> 1) << 12) | reg);
- if (foff & 1)
+ reg = (thumb.i >> 12) & 0xf;
+ thumb.i = (ARM_CC_AL|ARM_VMOV_F |
+ ((foff >> 1) << 12) | reg);
+ if (foff & 1)
thumb.i |= ARM_V_D;
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- ++foff;
- continue;
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ ++foff;
+ continue;
+ }
}
- }
- else {
+ else {
if (ioff < 4) {
- thumb.i = ((thumb.i & 0xfff0ff00) |
- (JIT_FP << 16) | ioff);
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- ++ioff;
- continue;
+ thumb.i = ((thumb.i & 0xfff0ff00) |
+ (JIT_FP << 16) | ioff);
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ ++ioff;
+ continue;
}
- }
- thumb.i = (thumb.i & 0xffffff00) | (offset >> 2);
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- break;
+ }
+ thumb.i = (thumb.i & 0xffffff00) | (offset >> 2);
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ break;
case ARM_CC_AL|ARM_VSTR|ARM_V_F64|ARM_P:
- if (jit_hardfp_p()) {
+ if (jit_hardfp_p()) {
if (foff & 1)
- ++foff;
+ ++foff;
if (foff < 16) {
- reg = (thumb.i >> 12) & 0xf;
- thumb.i = (ARM_CC_AL|ARM_VMOV_F|ARM_V_F64 |
- ((foff >> 1) << 12) | reg);
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- foff += 2;
- continue;
+ reg = (thumb.i >> 12) & 0xf;
+ thumb.i = (ARM_CC_AL|ARM_VMOV_F|ARM_V_F64 |
+ ((foff >> 1) << 12) | reg);
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ foff += 2;
+ continue;
}
- }
- else {
+ }
+ else {
if (ioff & 1)
- ++ioff;
+ ++ioff;
if (ioff < 4) {
- thumb.i = ((thumb.i & 0xfff0ff00) |
- (JIT_FP << 16) | ioff);
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- ioff += 2;
- continue;
+ thumb.i = ((thumb.i & 0xfff0ff00) |
+ (JIT_FP << 16) | ioff);
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ ioff += 2;
+ continue;
+ }
}
- }
- if (offset & 7)
+ if (offset & 7)
offset += sizeof(int);
- thumb.i = (thumb.i & 0xffffff00) | (offset >> 2);
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- break;
+ thumb.i = (thumb.i & 0xffffff00) | (offset >> 2);
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ break;
case THUMB2_STRWI:
thumb_stri:
- if (size == 8 && (ioff & 1))
+ if (size == 8 && (ioff & 1))
++ioff;
- if (ioff < 4) {
+ if (ioff < 4) {
thumb.i = ((thumb.i & 0xfff0f000) |
(JIT_FP << 16) | (ioff << 2));
thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
++ioff;
if (size == 8) {
- code2thumb(thumb.s[0], thumb.s[1], u.s[2], u.s[3]);
- thumb.i = ((thumb.i & 0xfff0f000) |
- (JIT_FP << 16) | (ioff << 2));
- thumb2code(thumb.s[0], thumb.s[1], u.s[2], u.s[3]);
- ++ioff;
+ code2thumb(thumb.s[0], thumb.s[1], u.s[2], u.s[3]);
+ thumb.i = ((thumb.i & 0xfff0f000) |
+ (JIT_FP << 16) | (ioff << 2));
+ thumb2code(thumb.s[0], thumb.s[1], u.s[2], u.s[3]);
+ ++ioff;
}
continue;
- }
- if (size == 8 && (offset & 7))
+ }
+ if (size == 8 && (offset & 7))
offset += sizeof(int);
- thumb.i = (thumb.i & 0xfffff000) | offset;
- thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
- if (size == 8) {
+ thumb.i = (thumb.i & 0xfffff000) | offset;
+ thumb2code(thumb.s[0], thumb.s[1], u.s[0], u.s[1]);
+ if (size == 8) {
code2thumb(thumb.s[0], thumb.s[1], u.s[2], u.s[3]);
thumb.i = (thumb.i & 0xfffff000) | (offset + 4);
thumb2code(thumb.s[0], thumb.s[1], u.s[2], u.s[3]);
- }
- break;
+ }
+ break;
default:
- /* offset too large */
- if ((thumb.i & 0xfff00000) == THUMB2_STRWI)
+ /* offset too large */
+ if ((thumb.i & 0xfff00000) == THUMB2_STRWI)
goto thumb_stri;
- abort();
- }
- }
- else {
- switch (u.i[0] & 0xfff00f00) {
+ abort();
+ }
+#else
+ switch (u.i[0] & 0xfff00f00) {
case ARM_CC_AL|ARM_VSTR|ARM_P:
- if (jit_hardfp_p()) {
+ if (jit_hardfp_p()) {
if (foff < 16) {
- reg = (u.i[0] >> 12) & 0xf;
- u.i[0] = (ARM_CC_AL|ARM_VMOV_F |
- ((foff >> 1) << 12) | reg);
- if (foff & 1)
+ reg = (u.i[0] >> 12) & 0xf;
+ u.i[0] = (ARM_CC_AL|ARM_VMOV_F |
+ ((foff >> 1) << 12) | reg);
+ if (foff & 1)
u.i[0] |= ARM_V_D;
- ++foff;
- continue;
+ ++foff;
+ continue;
+ }
}
- }
- else {
+ else {
if (ioff < 4) {
- u.i[0] = ((u.i[0] & 0xfff0ff00) |
- (JIT_FP << 16) | ioff);
- ++ioff;
- continue;
+ u.i[0] = ((u.i[0] & 0xfff0ff00) |
+ (JIT_FP << 16) | ioff);
+ ++ioff;
+ continue;
}
- }
- u.i[0] = (u.i[0] & 0xffffff00) | (offset >> 2);
- break;
+ }
+ u.i[0] = (u.i[0] & 0xffffff00) | (offset >> 2);
+ break;
case ARM_CC_AL|ARM_VSTR|ARM_V_F64|ARM_P:
- if (jit_hardfp_p()) {
+ if (jit_hardfp_p()) {
if (foff & 1)
- ++foff;
+ ++foff;
if (foff < 16) {
- reg = (u.i[0] >> 12) & 0xf;
- u.i[0] = (ARM_CC_AL|ARM_VMOV_F|ARM_V_F64 |
- ((foff >> 1) << 12) | reg);
- foff += 2;
- continue;
+ reg = (u.i[0] >> 12) & 0xf;
+ u.i[0] = (ARM_CC_AL|ARM_VMOV_F|ARM_V_F64 |
+ ((foff >> 1) << 12) | reg);
+ foff += 2;
+ continue;
+ }
}
- }
- else {
+ else {
if (ioff & 1)
- ++ioff;
+ ++ioff;
if (ioff < 4) {
- u.i[0] = ((u.i[0] & 0xfff0ff00) |
- (JIT_FP << 16) | ioff);
- ioff += 2;
- continue;
+ u.i[0] = ((u.i[0] & 0xfff0ff00) |
+ (JIT_FP << 16) | ioff);
+ ioff += 2;
+ continue;
+ }
}
- }
- if (offset & 7)
+ if (offset & 7)
offset += sizeof(int);
- u.i[0] = (u.i[0] & 0xffffff00) | (offset >> 2);
- break;
+ u.i[0] = (u.i[0] & 0xffffff00) | (offset >> 2);
+ break;
case ARM_CC_AL|ARM_STRI|ARM_P:
arm_stri:
- if (size == 8 && (ioff & 1))
+ if (size == 8 && (ioff & 1))
++ioff;
- if (ioff < 4) {
+ if (ioff < 4) {
u.i[0] = ((u.i[0] & 0xfff0f000) |
(JIT_FP << 16) | (ioff << 2));
++ioff;
if (size == 8) {
- u.i[1] = ((u.i[1] & 0xfff0f000) |
- (JIT_FP << 16) | (ioff << 2));
- ++ioff;
+ u.i[1] = ((u.i[1] & 0xfff0f000) |
+ (JIT_FP << 16) | (ioff << 2));
+ ++ioff;
}
continue;
- }
- if (size == 8 && (offset & 7))
+ }
+ if (size == 8 && (offset & 7))
offset += sizeof(int);
- u.i[0] = (u.i[0] & 0xfffff000) | offset;
- if (size == 8)
+ u.i[0] = (u.i[0] & 0xfffff000) | offset;
+ if (size == 8)
u.i[1] = (u.i[1] & 0xfffff000) | (offset + 4);
- break;
+ break;
default:
- /* offset too large */
- if ((u.i[0] & 0xfff00000) == (ARM_CC_AL|ARM_STRI|ARM_P))
+ /* offset too large */
+ if ((u.i[0] & 0xfff00000) == (ARM_CC_AL|ARM_STRI|ARM_P))
goto arm_stri;
- abort();
- }
- }
+ abort();
+ }
+#endif
offset += size;
}
+
jitl->reglist = ((1 << ioff) - 1) & 0xf;
if (jitl->stack_length < offset) {
jitl->stack_length = offset;