public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Add preferred_for_{size,speed} attributes
@ 2014-10-17 14:47 Richard Sandiford
  2014-10-17 14:48 ` [PATCH 1/5] Add recog_constrain_insn Richard Sandiford
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Richard Sandiford @ 2014-10-17 14:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: vmakarov, ubizjak, markus, Ganesh.Gopalasubramanian

This patch implements the approach I suggested in:

    https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00371.html

for fixing PR61360.  To recap, the problem is with the use of "enabled" in
the i386.md pattern:

(define_insn "*float<SWI48:mode><MODEF:mode>2_sse"
  [(set (match_operand:MODEF 0 "register_operand" "=f,x,x")
	(float:MODEF
	  (match_operand:SWI48 1 "nonimmediate_operand" "m,r,m")))]
  "SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH"
  "@
   fild%Z1\t%1
   %vcvtsi2<MODEF:ssemodesuffix><SWI48:rex64suffix>\t{%1, %d0|%d0, %1}
   %vcvtsi2<MODEF:ssemodesuffix><SWI48:rex64suffix>\t{%1, %d0|%d0, %1}"
  [(set_attr "type" "fmov,sseicvt,sseicvt")
   (set_attr "prefix" "orig,maybe_vex,maybe_vex")
   (set_attr "mode" "<MODEF:MODE>")
   (set (attr "prefix_rex")
     (if_then_else
       (and (eq_attr "prefix" "maybe_vex")
	    (match_test "<SWI48:MODE>mode == DImode"))
       (const_string "1")
       (const_string "*")))
   (set_attr "unit" "i387,*,*")
   (set_attr "athlon_decode" "*,double,direct")
   (set_attr "amdfam10_decode" "*,vector,double")
   (set_attr "bdver1_decode" "*,double,direct")
   (set_attr "fp_int_src" "true")
   (set (attr "enabled")
     (cond [(eq_attr "alternative" "0")
              (symbol_ref "TARGET_MIX_SSE_I387
                           && X87_ENABLE_FLOAT (<MODEF:MODE>mode,
                                                <SWI48:MODE>mode)")
            (eq_attr "alternative" "1")
              /* ??? For sched1 we need constrain_operands to be able to
                 select an alternative.  Leave this enabled before RA.  */
              (symbol_ref "TARGET_INTER_UNIT_CONVERSIONS
                           || optimize_function_for_size_p (cfun)
                           || !(reload_completed
                                || reload_in_progress
                                || lra_in_progress)")
           ]
           (symbol_ref "true")))
   ])

The attribute was only really supposed to test properties of the currently-
selected target.  It wasn't supposed to test function-specific size/speed
properties like the above pattern does.

So the idea was instead to add two new attributes that say whether
an alternative should be used when optimising for speed or size.
These attributes would just be strong optimisation hints; they wouldn't
be correctness properties in the way that "enabled" is.  There are some
cases where we could end up with a size-only alternative in code
optimised for speed, or vice versa, but the idea would be to reduce
them as far as possible.

The main advantage of this approach is that we can take block-level
size/speed choices into account, rather than just looking at the
function-level choice.

Series tested on x86_64-linux-gnu.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-08-03 14:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-17 14:47 [PATCH 0/5] Add preferred_for_{size,speed} attributes Richard Sandiford
2014-10-17 14:48 ` [PATCH 1/5] Add recog_constrain_insn Richard Sandiford
2014-10-21 14:56   ` Vladimir Makarov
2014-10-21 15:45   ` Jeff Law
2014-10-17 14:51 ` [PATCH 2/5] Add preferred_for_{size,speed} attributes Richard Sandiford
2014-10-21 14:57   ` Vladimir Makarov
2014-10-21 17:34   ` Jeff Law
2015-08-03 14:54   ` H.J. Lu
2014-10-17 14:52 ` [PATCH 3/5] Pass an alternative_mask to constrain_operands Richard Sandiford
2014-10-21 15:36   ` Vladimir Makarov
2014-10-21 17:46   ` Jeff Law
2014-10-17 14:55 ` [PATCH 4/5] Remove recog_data.enabled_alternatives Richard Sandiford
2014-10-21 14:57   ` Vladimir Makarov
2014-10-21 15:35   ` Jeff Law
2014-10-17 14:58 ` [PATCH 5/5] Use preferred_for_speed in i386.md Richard Sandiford
2014-10-17 16:59   ` Uros Bizjak
2014-10-21 15:08   ` Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).