aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/msp430/msp430.c
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2019-06-16 21:24:56 +0000
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>2019-06-16 21:24:56 +0000
commit0fcc78f79e85b816480e0425cc8d7c496e739e88 (patch)
tree588d5986dd2a505d0fff820371c546025752c25e /gcc/config/msp430/msp430.c
parent1409f3b0f39baa489d4cc467a3489dfe78653ec4 (diff)
downloadgcc-0fcc78f79e85b816480e0425cc8d7c496e739e88.zip
gcc-0fcc78f79e85b816480e0425cc8d7c496e739e88.tar.gz
gcc-0fcc78f79e85b816480e0425cc8d7c496e739e88.tar.bz2
MSP430: Implement 64-bit shifts in assembly code
gcc/ChangeLog: 2019-06-16 Jozef Lawrynowicz <jozef.l@mittosystems.com> * config/msp430/msp430.c (msp430_expand_helper): Setup arguments which describe how to perform MSPABI compliant 64-bit shift. * config/msp430/msp430.md (ashldi3): New define_expand. (ashrdi3): New define_expand. (lshrdi3): New define_expand. libgcc/ChangeLog: 2019-06-16 Jozef Lawrynowicz <jozef.l@mittosystems.com> * config/msp430/slli.S (__mspabi_sllll): New library function for performing a logical left shift of a 64-bit value. * config/msp430/srai.S (__mspabi_srall): New library function for performing a arithmetic right shift of a 64-bit value. * config/msp430/srll.S (__mspabi_srlll): New library function for performing a logical right shift of a 64-bit value. gcc/testsuite/ChangeLog: 2019-06-16 Jozef Lawrynowicz <jozef.l@mittosystems.com> * gcc.target/msp430/mspabi_sllll.c: New test. * gcc.target/msp430/mspabi_srall.c: New test. * gcc.target/msp430/mspabi_srlll.c: New test. * gcc.c-torture/execute/shiftdi-2.c: New test. From-SVN: r272360
Diffstat (limited to 'gcc/config/msp430/msp430.c')
-rw-r--r--gcc/config/msp430/msp430.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 020e980..365e9eb 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -3046,6 +3046,7 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
{
rtx c, f;
char *helper_const = NULL;
+ int arg1 = 12;
int arg2 = 13;
int arg1sz = 1;
machine_mode arg0mode = GET_MODE (operands[0]);
@@ -3079,6 +3080,13 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
arg2 = 14;
arg1sz = 2;
}
+ else if (arg1mode == DImode)
+ {
+ /* Shift value in R8:R11, shift amount in R12. */
+ arg1 = 8;
+ arg1sz = 4;
+ arg2 = 12;
+ }
if (const_variants
&& CONST_INT_P (operands[2])
@@ -3091,7 +3099,7 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
snprintf (helper_const, len, "%s_%d", helper_name, (int) INTVAL (operands[2]));
}
- emit_move_insn (gen_rtx_REG (arg1mode, 12),
+ emit_move_insn (gen_rtx_REG (arg1mode, arg1),
operands[1]);
if (!helper_const)
emit_move_insn (gen_rtx_REG (arg2mode, arg2),
@@ -3104,12 +3112,13 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
RTL_CONST_CALL_P (c) = 1;
f = 0;
- use_regs (&f, 12, arg1sz);
+ use_regs (&f, arg1, arg1sz);
if (!helper_const)
use_regs (&f, arg2, 1);
add_function_usage_to (c, f);
emit_move_insn (operands[0],
+ /* Return value will always start in R12. */
gen_rtx_REG (arg0mode, 12));
}