From: Jozef Lawrynowicz Date: Mon, 7 Oct 2019 20:05:30 +0000 (+0000) Subject: msp430-protos.h (msp430_split_addsi): New prototype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53f450825dd09f95eb7c57677f1803371c57763a;p=gcc.git msp430-protos.h (msp430_split_addsi): New prototype. 2019-10-07 Jozef Lawrynowicz * config/msp430/msp430-protos.h (msp430_split_addsi): New prototype. * config/msp430/msp430.c (msp430_split_addsi): New. * config/msp430/msp430.md: Call msp430_split_addsi () instead of using a block of C code for splitting addsi. From-SVN: r276670 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbdce86a0f8..91ebb5a114c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-10-07 Jozef Lawrynowicz + + * config/msp430/msp430-protos.h (msp430_split_addsi): New prototype. + * config/msp430/msp430.c (msp430_split_addsi): New. + * config/msp430/msp430.md: Call msp430_split_addsi () instead of using + a block of C code for splitting addsi. + 2019-10-07 Uroš Bizjak * config/i386/i386-expand.c (ix86_expand_floorceildf_32, diff --git a/gcc/config/msp430/msp430-protos.h b/gcc/config/msp430/msp430-protos.h index 1c1757fc7ab..37ca48297ac 100644 --- a/gcc/config/msp430/msp430-protos.h +++ b/gcc/config/msp430/msp430-protos.h @@ -44,6 +44,7 @@ void msp430_output_labelref (FILE *, const char *); void msp430_register_pragmas (void); rtx msp430_return_addr_rtx (int); void msp430_split_movsi (rtx *); +int msp430_split_addsi (rtx *); void msp430_start_function (FILE *, const char *, tree); rtx msp430_subreg (machine_mode, rtx, machine_mode, int); bool msp430_use_f5_series_hwmult (void); diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 354b4ddb419..add19bdb97c 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -2841,6 +2841,29 @@ msp430_subreg (machine_mode mode, rtx r, machine_mode omode, int byte) return rv; } +int +msp430_split_addsi (rtx *operands) +{ + operands[3] = msp430_subreg (HImode, operands[0], SImode, 0); + operands[4] = msp430_subreg (HImode, operands[1], SImode, 0); + operands[5] = msp430_subreg (HImode, operands[2], SImode, 0); + operands[6] = msp430_subreg (HImode, operands[0], SImode, 2); + operands[7] = msp430_subreg (HImode, operands[1], SImode, 2); + operands[8] = msp430_subreg (HImode, operands[2], SImode, 2); + + /* BZ 64160: Do not use this splitter when the dest partially overlaps the + source. */ + if (reg_overlap_mentioned_p (operands[3], operands[7]) + || reg_overlap_mentioned_p (operands[3], operands[8])) + return 1; + + if (GET_CODE (operands[5]) == CONST_INT) + operands[9] = GEN_INT (INTVAL (operands[5]) & 0xffff); + else + operands[9] = gen_rtx_ZERO_EXTEND (SImode, operands[5]); + return 0; +} + /* Called by movsi_x to generate the HImode operands. */ void msp430_split_movsi (rtx *operands) diff --git a/gcc/config/msp430/msp430.md b/gcc/config/msp430/msp430.md index c72f7aade30..e1c61f5ea3d 100644 --- a/gcc/config/msp430/msp430.md +++ b/gcc/config/msp430/msp430.md @@ -423,23 +423,9 @@ (zero_extend:HI (reg:BI CARRY)))) ] " - operands[3] = msp430_subreg (HImode, operands[0], SImode, 0); - operands[4] = msp430_subreg (HImode, operands[1], SImode, 0); - operands[5] = msp430_subreg (HImode, operands[2], SImode, 0); - operands[6] = msp430_subreg (HImode, operands[0], SImode, 2); - operands[7] = msp430_subreg (HImode, operands[1], SImode, 2); - operands[8] = msp430_subreg (HImode, operands[2], SImode, 2); - - /* BZ 64160: Do not use this splitter when the dest partially overlaps the source. */ - if (reg_overlap_mentioned_p (operands[3], operands[7]) - || reg_overlap_mentioned_p (operands[3], operands[8])) - FAIL; - - if (GET_CODE (operands[5]) == CONST_INT) - operands[9] = GEN_INT (INTVAL (operands[5]) & 0xffff); - else - operands[9] = gen_rtx_ZERO_EXTEND (SImode, operands[5]); - " + if (msp430_split_addsi (operands)) + FAIL; + " )