diff options
Diffstat (limited to 'include/opcode/arc-func.h')
-rw-r--r-- | include/opcode/arc-func.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/opcode/arc-func.h b/include/opcode/arc-func.h index 9f0ea32..96ffcff 100644 --- a/include/opcode/arc-func.h +++ b/include/opcode/arc-func.h @@ -25,6 +25,7 @@ ATTRIBUTE_UNUSED static unsigned replace_none (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x00; return insn; } @@ -37,6 +38,7 @@ replace_none (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_bits8 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xff; insn |= ((value >> 0) & 0x00ff) << 0; return insn; @@ -50,6 +52,7 @@ replace_bits8 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_bits16 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffff; insn |= ((value >> 0) & 0xffff) << 0; return insn; @@ -63,6 +66,7 @@ replace_bits16 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_bits24 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffff; insn |= ((value >> 0) & 0xffffff) << 0; return insn; @@ -76,6 +80,7 @@ replace_bits24 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_word32 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffffff; insn |= ((value >> 0) & 0xffffffff) << 0; return insn; @@ -89,6 +94,7 @@ replace_word32 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_limm (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffffff; insn |= ((value >> 0) & 0xffffffff) << 0; return insn; @@ -102,6 +108,7 @@ replace_limm (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_limms (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xffffffff; insn |= ((value >> 0) & 0xffffffff) << 0; return insn; @@ -115,6 +122,7 @@ replace_limms (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp21h (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7feffc0; insn |= ((value >> 0) & 0x03ff) << 17; insn |= ((value >> 10) & 0x03ff) << 6; @@ -129,6 +137,7 @@ replace_disp21h (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp21w (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7fcffc0; insn |= ((value >> 0) & 0x01ff) << 18; insn |= ((value >> 9) & 0x03ff) << 6; @@ -143,6 +152,7 @@ replace_disp21w (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp25h (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7feffcf; insn |= ((value >> 0) & 0x03ff) << 17; insn |= ((value >> 10) & 0x03ff) << 6; insn |= ((value >> 20) & 0x000f) << 0; @@ -158,6 +168,7 @@ replace_disp25h (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp25w (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7fcffcf; insn |= ((value >> 0) & 0x01ff) << 18; insn |= ((value >> 9) & 0x03ff) << 6; insn |= ((value >> 19) & 0x000f) << 0; @@ -173,6 +184,7 @@ replace_disp25w (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x1ff; insn |= ((value >> 0) & 0x01ff) << 0; return insn; @@ -186,6 +198,7 @@ replace_disp9 (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9ls (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0xff8000; insn |= ((value >> 0) & 0x00ff) << 16; insn |= ((value >> 8) & 0x0001) << 15; @@ -200,6 +213,7 @@ replace_disp9ls (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9s (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x1ff; insn |= ((value >> 0) & 0x01ff) << 0; return insn; @@ -213,6 +227,7 @@ replace_disp9s (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp13s (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7ff; insn |= ((value >> 0) & 0x07ff) << 0; return insn; @@ -226,6 +241,7 @@ replace_disp13s (unsigned insn, int value ATTRIBUTE_UNUSED) ATTRIBUTE_UNUSED static unsigned replace_disp9s1 (unsigned insn, int value ATTRIBUTE_UNUSED) { + insn = insn & ~0x7e7; insn |= ((value >> 0) & 0x0007) << 0; insn |= ((value >> 3) & 0x003f) << 5; |