From: Michael Meissner Date: Fri, 27 Aug 2010 21:32:44 +0000 (+0000) Subject: Improve floating point conversions on powerpc X-Git-Tag: releases/gcc-4.6.0~4810 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7042fe5ef83ff0585eb91144817105f26d566d4c;p=thirdparty%2Fgcc.git Improve floating point conversions on powerpc From-SVN: r163598 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3206c38ff82c..b2410225ccb6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,123 @@ +2010-08-23 Michael Meissner + + * config/rs6000/rs6000-protos.h (rs6000_address_for_fpconvert): + New declaration. + (rs6000_allocate_stack_temp): Ditto. + (rs6000_expand_convert_si_to_sfdf): Ditto. + + * config/rs6000/rs6000.c (rs6000_override_options): Adjust long + line. Update the options set if power6 or power7 server/embedded + type options are used. If we give a warning for no vsx under + -mcpu=power7 -mno-altivec, mark -mvsx as an explicit option. + (rs6000_allocate_stack_temp): New function to allocate a stack + tempoary and adjust the address so it meets either REG+OFFSET or + REG+REG addressing requirements. + (rs6000_address_for_fpconvert): Adjust REG+OFFSET addresses so + that they can be used with the LFIWAX/LFIWZX instrucitons. + (rs6000_expand_convert_si_to_sfdf): New helper funciton for + converting signed/unsigned SImode to either SFmode/DFmode. + + * config/rs6000/rs6000.h (TARGET_FCFID): New macros to determine + whether certain instructions can be generated. + (TARGET_FCTIDZ): Ditto. + (TARGET_STFIWX): Ditto. + (TARGET_LFIWAX): Ditto. + (TARGET_LFIWZX): Ditto. + (TARGET_FCFIDS): Ditto. + (TARGET_FCFIDU): Ditto. + (TARGET_FCFIDUS): Ditto. + (TARGET_FCTIDUZ): Ditto. + (TARGET_FCTIWUZ): Ditto. + + * config/rs6000/rs6000.md (UNSPEC_FCTIW): New unspec constants. + (UNSPEC_FCTID): Ditto. + (UNSPEC_LFIWAX): Ditto. + (UNSPEC_LFIWZX): Ditto. + (UNSPEC_FCTIWUZ): Ditto. + (rreg): Use correct constraints. + (SI_CONVERT_FP): New mode attribute for floating point conversion + tests. + (E500_CONVERT): Ditto. + (lfiwax): New insns for converting from integer to floating point + utilizing newer instructions. Attempt to optimize conversions + that come from memory so that we don't load the value into a GPR, + spill it to the stack and reload it into a FPR. + (floatsi2_lfiwax): Ditto. + (floatsi2_lfiwax_mem): Ditto. + (floatsi2_lfiwax_mem2): Ditto. + (lfiwzx): Ditto. + (floatunssi2_lfiwzx): Ditto. + (floatunssi2_lfiwzx_mem): Ditto. + (floatunssi2_lfiwzx_mem2): Ditto. + (floatdidf2_mem): Ditto. + (floatunsdidf2_fcfidu): Ditto. + (floatunsdidf2_mem): Ditto. + (floatunsdisf2): Ditto. + (floatunsdisf2_fcfidus): Ditto. + (floatunsdisf2_mem): Ditto. + (floatsidf2): Add support for LFIWAX/LFIWZX/FCFIDS/FCFIDU/FCFIDUS. + Use FCFID on 32-bit hosts that support it. + (floatsidf2_internal): Ditto. + (floatunssisf2): Ditto. + (floatunssidf2): Ditto. + (floatunssidf2_internal): Ditto. + (floatsisf2): Ditto. + (floatdidf2): Ditto. + (floatdidf2_fpr): Ditto. + (floatunsdidf2): Ditto. + (floatdisf2): Ditto. + (floatdisf2_fcfids): Ditto. + (floatdisf2_internal1): Ditto. + (fixuns_truncsfsi2): Delete, merge into common pattern for both + SF/DF. Add power7 support. + (fix_truncsfsi2): Ditto. + (fixuns_truncdfsi2): Ditto. + (fixuns_truncdfdi2): Ditto. + (fix_truncdfsi2): Ditto. + (fix_truncdfsi2_internal): Ditto. + (fix_truncdfsi2_internal_gfxopt): Ditto. + (fix_truncdfsi2_mfpgpr): Ditto. + (fctiwz): Ditto. + (btruncdf2): Ditto. + (btruncdf2_fpr): Ditto. + (btructsf2): Ditto. + (ceildf2): Ditto. + (ceildf2_fpr): Ditto. + (ceilsf2): Ditto. + (floordf2): Ditto. + (floordf2_fpr): Ditto. + (floorsf2): Ditto. + (rounddf2): Ditto. + (rounddf2_fpr): Ditto. + (roundsf2): Ditto. + (fix_truncsi2): Combine SF/DF conversion into one insn. + (fix_truncdi2): Ditto. + (fixuns_truncsi2): Ditto. + (fixuns_truncdi2): Ditto. + (fctiwz_): Ditto. + (btrunc2): Ditto. + (btrunc2_fpr): Ditto. + (ceil2): Ditto. + (ceil2_fpr): Ditto. + (floor2): Ditto. + (float2_fpr): Ditto. + (round2): Ditto. + (round2_fpr): Ditto. + (fix_truncsi2_stfiwx): New insn for machines with STFIWX. + (fixuns_truncsi2_stfiwx): Ditto. + (fix_truncdfsi2_internal): Ditto. + (fix_truncsi2_mem): Combiner pattern to eliminate storing + converted value on stack, loaded into GPR, and then stored into + the final destination. + (fix_truncdi2_fctidz): New pattern for targets supporting + FCTIDZ. + (lrintdi2): New insn, provide the lrint builtin functions. + (ftruncdf2): Delete, unused. + (fix_trunctfsi2_internal): Use gen_fctiwz_df, not gen_fctiwz. + + * config/rs6000/vsx.md (toplevel): Update copyright year. + (VSr2): Use "ws" contraint for DFmode, not "!r#r". + (VSr3): Ditto. 2010-08-27 Basile Starynkevitch Jeremie Salvucci diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 79370d88435c..0d26511524bf 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -129,6 +129,9 @@ extern void rs6000_emit_parity (rtx, rtx); extern rtx rs6000_machopic_legitimize_pic_address (rtx, enum machine_mode, rtx); +extern rtx rs6000_address_for_fpconvert (rtx); +extern rtx rs6000_allocate_stack_temp (enum machine_mode, bool, bool); +extern void rs6000_expand_convert_si_to_sfdf (rtx, rtx, bool); #endif /* RTX_CODE */ #ifdef TREE_CODE diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c5ed8d63a7e6..6bebca919fe6 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2510,10 +2510,10 @@ rs6000_override_options (const char *default_cpu) POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_PPC_GFXOPT | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_MFPGPR | MASK_RECIP_PRECISION}, - {"power7", PROCESSOR_POWER7, + {"power7", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */ POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD - | MASK_VSX| MASK_RECIP_PRECISION}, /* Don't add MASK_ISEL by default */ + | MASK_VSX | MASK_RECIP_PRECISION}, {"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK}, {"powerpc64", PROCESSOR_POWERPC64, POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64}, @@ -2550,15 +2550,19 @@ rs6000_override_options (const char *default_cpu) ISA_2_1_MASKS = MASK_MFCRF, ISA_2_2_MASKS = (ISA_2_1_MASKS | MASK_POPCNTB | MASK_FPRND), - /* For ISA 2.05, do not add MFPGPR, since it isn't in ISA 2.06, and - don't add ALTIVEC, since in general it isn't a win on power6. */ - ISA_2_5_MASKS = (ISA_2_2_MASKS | MASK_CMPB | MASK_RECIP_PRECISION - | MASK_DFP), + /* For ISA 2.05, do not add MFPGPR, since it isn't in ISA 2.06, and don't + add ALTIVEC, since in general it isn't a win on power6. In ISA 2.04, + fsel, fre, fsqrt, etc. were no longer documented as optional. Group + masks by server and embedded. */ + ISA_2_5_MASKS_EMBEDDED = (ISA_2_2_MASKS | MASK_CMPB | MASK_RECIP_PRECISION + | MASK_PPC_GFXOPT | MASK_PPC_GPOPT), + ISA_2_5_MASKS_SERVER = (ISA_2_5_MASKS_EMBEDDED | MASK_DFP), /* For ISA 2.06, don't add ISEL, since in general it isn't a win, but altivec is a win so enable it. */ - ISA_2_6_MASKS = (ISA_2_5_MASKS | MASK_ALTIVEC | MASK_POPCNTD - | MASK_VSX | MASK_RECIP_PRECISION) + ISA_2_6_MASKS_EMBEDDED = (ISA_2_5_MASKS_EMBEDDED | MASK_POPCNTD), + ISA_2_6_MASKS_SERVER = (ISA_2_5_MASKS_SERVER | MASK_POPCNTD | MASK_ALTIVEC + | MASK_VSX) }; /* Numerous experiment shows that IRA based loop pressure @@ -2699,15 +2703,22 @@ rs6000_override_options (const char *default_cpu) { warning (0, msg); target_flags &= ~ MASK_VSX; + target_flags_explicit |= MASK_VSX; } } /* For the newer switches (vsx, dfp, etc.) set some of the older options, unless the user explicitly used the -mno-