summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opcodes/ChangeLog17
-rw-r--r--opcodes/cgen-ibld.in13
-rw-r--r--opcodes/epiphany-ibld.c13
-rw-r--r--opcodes/fr30-ibld.c13
-rw-r--r--opcodes/frv-ibld.c13
-rw-r--r--opcodes/ip2k-ibld.c13
-rw-r--r--opcodes/iq2000-ibld.c13
-rw-r--r--opcodes/lm32-ibld.c13
-rw-r--r--opcodes/m32c-ibld.c13
-rw-r--r--opcodes/m32r-ibld.c13
-rw-r--r--opcodes/mep-ibld.c13
-rw-r--r--opcodes/mt-ibld.c13
-rw-r--r--opcodes/or1k-ibld.c13
-rw-r--r--opcodes/xc16x-ibld.c13
-rw-r--r--opcodes/xstormy16-ibld.c13
15 files changed, 157 insertions, 42 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index da140496355..83cbe6fd2e5 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,22 @@
2016-02-02 Andrew Burgess <andrew.burgess@embecosm.com>
+ * cgen-ibld.in (insert_normal): Rework calculation of shift.
+ * epiphany-ibld.c: Regenerate.
+ * fr30-ibld.c: Regenerate.
+ * frv-ibld.c: Regenerate.
+ * ip2k-ibld.c: Regenerate.
+ * iq2000-ibld.c: Regenerate.
+ * lm32-ibld.c: Regenerate.
+ * m32c-ibld.c: Regenerate.
+ * m32r-ibld.c: Regenerate.
+ * mep-ibld.c: Regenerate.
+ * mt-ibld.c: Regenerate.
+ * or1k-ibld.c: Regenerate.
+ * xc16x-ibld.c: Regenerate.
+ * xstormy16-ibld.c: Regenerate.
+
+2016-02-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
* epiphany-dis.c: Regenerated from latest cpu files.
2016-02-01 Michael McConville <mmcco@mykolab.com>
diff --git a/opcodes/cgen-ibld.in b/opcodes/cgen-ibld.in
index 4730ff4ff6c..cd6fffa5aee 100644
--- a/opcodes/cgen-ibld.in
+++ b/opcodes/cgen-ibld.in
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/epiphany-ibld.c b/opcodes/epiphany-ibld.c
index c412169f4af..f978d4682ff 100644
--- a/opcodes/epiphany-ibld.c
+++ b/opcodes/epiphany-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c
index 12b17335ba8..1293e73ba29 100644
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/frv-ibld.c b/opcodes/frv-ibld.c
index bbcec67b3e6..dba36aa6042 100644
--- a/opcodes/frv-ibld.c
+++ b/opcodes/frv-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/ip2k-ibld.c b/opcodes/ip2k-ibld.c
index a46e34d7be3..fa6a736b060 100644
--- a/opcodes/ip2k-ibld.c
+++ b/opcodes/ip2k-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/iq2000-ibld.c b/opcodes/iq2000-ibld.c
index 74aa4da16a9..96faa3847a0 100644
--- a/opcodes/iq2000-ibld.c
+++ b/opcodes/iq2000-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/lm32-ibld.c b/opcodes/lm32-ibld.c
index 6a923c7a2f0..784acc02be4 100644
--- a/opcodes/lm32-ibld.c
+++ b/opcodes/lm32-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/m32c-ibld.c b/opcodes/m32c-ibld.c
index b93de263f62..7066bbf2ae0 100644
--- a/opcodes/m32c-ibld.c
+++ b/opcodes/m32c-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/m32r-ibld.c b/opcodes/m32r-ibld.c
index a1bbcef8bcd..2b9e93a9010 100644
--- a/opcodes/m32r-ibld.c
+++ b/opcodes/m32r-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/mep-ibld.c b/opcodes/mep-ibld.c
index d1e33fa730f..0faf9481d9d 100644
--- a/opcodes/mep-ibld.c
+++ b/opcodes/mep-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/mt-ibld.c b/opcodes/mt-ibld.c
index ffc7910d6ee..c678e996953 100644
--- a/opcodes/mt-ibld.c
+++ b/opcodes/mt-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/or1k-ibld.c b/opcodes/or1k-ibld.c
index 040bd00bacb..b934ce1b9fc 100644
--- a/opcodes/or1k-ibld.c
+++ b/opcodes/or1k-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/xc16x-ibld.c b/opcodes/xc16x-ibld.c
index 3deb3b0241f..43c7a160e23 100644
--- a/opcodes/xc16x-ibld.c
+++ b/opcodes/xc16x-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}
diff --git a/opcodes/xstormy16-ibld.c b/opcodes/xstormy16-ibld.c
index 4d963945c85..2d05229ba66 100644
--- a/opcodes/xstormy16-ibld.c
+++ b/opcodes/xstormy16-ibld.c
@@ -207,12 +207,19 @@ insert_normal (CGEN_CPU_DESC cd,
#if CGEN_INT_INSN_P
{
- int shift;
+ int shift_within_word, shift_to_word, shift;
+ /* How to shift the value to BIT0 of the word. */
+ shift_to_word = total_length - (word_offset + word_length);
+
+ /* How to shift the value to the field within the word. */
if (CGEN_INSN_LSB0_P)
- shift = (word_offset + start + 1) - length;
+ shift_within_word = start + 1 - length;
else
- shift = total_length - (word_offset + start + length);
+ shift_within_word = word_length - start - length;
+
+ /* The total SHIFT, then mask in the value. */
+ shift = shift_to_word + shift_within_word;
*buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
}