From: James Greenhalgh Date: Fri, 16 May 2014 09:23:28 +0000 (+0000) Subject: [AArch64 costs 16/18] Cost TRUNCATE X-Git-Tag: releases/gcc-5.1.0~7538 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb620c4a9a2120478ce4d6c9fc09826d39c89529;p=thirdparty%2Fgcc.git [AArch64 costs 16/18] Cost TRUNCATE gcc/ * config/aarch64/aarch64.c (aarch64_rtx_costs): Cost TRUNCATE. Co-Authored-By: Philipp Tomsich From-SVN: r210508 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4e6b1896b69..3515c6c40427 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-05-16 James Greenhalgh + Philipp Tomsich + + * config/aarch64/aarch64.c (aarch64_rtx_costs): Cost TRUNCATE. + 2014-05-16 James Greenhalgh Philipp Tomsich diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 503f9149828c..58627b5e4cec 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5724,6 +5724,39 @@ cost_plus: } return false; + case TRUNCATE: + + /* Decompose muldi3_highpart. */ + if (/* (truncate:DI */ + mode == DImode + /* (lshiftrt:TI */ + && GET_MODE (XEXP (x, 0)) == TImode + && GET_CODE (XEXP (x, 0)) == LSHIFTRT + /* (mult:TI */ + && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT + /* (ANY_EXTEND:TI (reg:DI)) + (ANY_EXTEND:TI (reg:DI))) */ + && ((GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ZERO_EXTEND + && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == ZERO_EXTEND) + || (GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == SIGN_EXTEND + && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == SIGN_EXTEND)) + && GET_MODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0)) == DImode + && GET_MODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 1), 0)) == DImode + /* (const_int 64) */ + && CONST_INT_P (XEXP (XEXP (x, 0), 1)) + && UINTVAL (XEXP (XEXP (x, 0), 1)) == 64) + { + /* UMULH/SMULH. */ + if (speed) + *cost += extra_cost->mult[mode == DImode].extend; + *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0), + MULT, 0, speed); + *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 1), 0), + MULT, 1, speed); + return true; + } + + /* Fall through. */ default: break; }