public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH (0/7)] Improve use of Widening Multiplies
@ 2011-06-23 14:38 Andrew Stubbs
  2011-06-23 14:39 ` [PATCH (1/7)] New optab framework for widening multiplies Andrew Stubbs
                   ` (9 more replies)
  0 siblings, 10 replies; 107+ messages in thread
From: Andrew Stubbs @ 2011-06-23 14:38 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]

Hi all,

This patch series is intended to improve use of widening multiply, and 
widening multiply-and-accumulate instructions. This is primarily for the 
benefit of ARM targets, but should give some improvements to other 
targets also.

The patches provide a number of improvements:

  * Support for instructions that widen by more than one mode
    (e.g. from HImode to DImode).

  * Use of widening multiplies even when the input mode is narrower than
    the instruction uses. (e.g. Use HI->DI to do QI->DI).

  * Use of signed widening multiplies (of a larger mode) where unsigned
    multiplies are not available.

  * Support for input operands with mis-matched signedness, with or
    without usmul_widen_optab.

  * Support for input operands with mis-matched mode [1].

  * Improved pattern matching in the widening_mult pass.
    * Recognition of true types, even if obscured by a cast.
    * Insertion of extra gimple statements where the existing code was
      incompatible with widening multiplies.
    * Recognition of widening multiply-and-accumulate even where the
      multiply expression was not widening.

The end result is that, on ARM, many many of the cases where the 
compiler would fall back to regular multiplies, extensions, and add 
instructions can now be handled with just one instruction.

For those interested in the before and after states, I have attached a 
couple of shell scripts. These generate test cases with many 
permutations of types and signedness.

[1] Operands of mis-matched mode are multiplied by extending the smaller 
one to match the larger one. Although this does not support mis-matched 
mode instructions directly, this ought to improve the chances of the 
combine pass doing The Right Thing. (Although this does depend on there 
being a suitable matched-mode instruction for widen_mult/expand to use.)

So, on to the patches ....

Andrew

[-- Attachment #2: script2 --]
[-- Type: text/plain, Size: 733 bytes --]

#!/bin/bash

for op in madd mul; do
  for i1 in char short int "long long"; do
    for i2 in char short int "long long"; do
      for o in char short int "long long"; do
	for x in unsigned signed; do
	  for y in unsigned signed; do
	    for z in unsigned signed; do
	      for c in cast nocast; do
		echo "$x $o"
		echo "${op}_${x}_${o/ /}_${y}_${i1/ /}_${z}_${i2/ /}_$c ($x $o a, $y $i1 *b, $z $i2 *c)"
		echo "{"
		case $op+$c in
		madd+cast)   echo "  return a + ($x $o)*b * ($x $o)*c;" ;;
		madd+nocast) echo "  return a + *b * *c;" ;;
		mul+cast)    echo "  return ($x $o)*b * ($x $o)*c;" ;;
		mul+nocast)  echo "  return *b * *c;" ;;
		esac
		echo "}"
		echo
	      done
	    done
	  done
	done
      done
    done
  done
done

[-- Attachment #3: script3 --]
[-- Type: text/plain, Size: 723 bytes --]

#!/bin/bash

for op in madd mul; do
  for i1 in char short int "long long"; do
    for i2 in char short int "long long"; do
      for o in char short int "long long"; do
	for x in unsigned signed; do
	  for y in unsigned signed; do
	    for z in unsigned signed; do
	      for c in cast nocast; do
		echo "$x $o"
		echo "${op}_${x}_${o/ /}_${y}_${i1/ /}_${z}_${i2/ /}_$c ($x $o a, $y $i1 b, $z $i2 c)"
		echo "{"
		case $op+$c in
		madd+cast)   echo "  return a + ($x $o)b * ($x $o)c;" ;;
		madd+nocast) echo "  return a + b * c;" ;;
		mul+cast)    echo "  return ($x $o)b * ($x $o)c;" ;;
		mul+nocast)  echo "  return b * c;" ;;
		esac
		echo "}"
		echo
	      done
	    done
	  done
	done
      done
    done
  done
done

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

end of thread, other threads:[~2011-10-13 15:59 UTC | newest]

Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23 14:38 [PATCH (0/7)] Improve use of Widening Multiplies Andrew Stubbs
2011-06-23 14:39 ` [PATCH (1/7)] New optab framework for widening multiplies Andrew Stubbs
2011-07-09 15:38   ` Andrew Stubbs
2011-07-14 15:29     ` Andrew Stubbs
2011-07-22 13:01     ` Bernd Schmidt
2011-07-22 13:50       ` Andrew Stubbs
2011-07-22 14:01         ` Bernd Schmidt
2011-07-22 15:52           ` Andrew Stubbs
2011-08-19 14:41             ` Andrew Stubbs
2011-08-19 14:55               ` Richard Guenther
2011-08-19 15:07                 ` Andrew Stubbs
2011-08-19 16:40                   ` Andrew Stubbs
2011-06-23 14:41 ` [PATCH (2/7)] Widening multiplies by more than one mode Andrew Stubbs
2011-07-12 10:15   ` Andrew Stubbs
2011-07-12 11:05     ` Richard Guenther
2011-07-12 11:14       ` Richard Guenther
2011-07-12 11:38         ` Andrew Stubbs
2011-07-12 11:51           ` Richard Guenther
2011-07-21 19:51         ` Joseph S. Myers
2011-07-22  8:58           ` Andrew Stubbs
2011-07-14 14:17       ` Andrew Stubbs
2011-07-14 14:24         ` Richard Guenther
2011-08-19 14:45           ` Andrew Stubbs
2011-06-23 14:42 ` [PATCH (3/7)] Widening multiply-and-accumulate pattern matching Andrew Stubbs
2011-06-23 16:28   ` Richard Guenther
2011-06-24  8:14     ` Andrew Stubbs
2011-06-24  9:31       ` Richard Guenther
2011-06-24 14:08         ` Stubbs, Andrew
2011-06-24 16:13           ` Richard Guenther
2011-06-24 18:22             ` Stubbs, Andrew
2011-06-25  9:58               ` Richard Guenther
2011-06-28 11:32             ` Andrew Stubbs
2011-06-28 12:48               ` Richard Guenther
2011-06-28 16:37                 ` Michael Matz
2011-06-28 16:48                   ` Andrew Stubbs
2011-06-28 17:09                     ` Michael Matz
2011-07-01 11:58                       ` Stubbs, Andrew
2011-07-01 12:25                         ` Richard Guenther
2011-07-04 14:23                           ` Andrew Stubbs
2011-07-07 10:00                             ` Richard Guenther
2011-07-07 10:27                               ` Andrew Stubbs
2011-07-07 12:18                                 ` Andrew Stubbs
2011-07-07 12:34                                   ` Richard Guenther
2011-07-07 12:49                                     ` Richard Guenther
2011-07-08 12:55                                       ` Andrew Stubbs
2011-07-08 13:22                                         ` Richard Guenther
2011-07-11 17:01                               ` Andrew Stubbs
2011-07-12 11:05                                 ` Richard Guenther
2011-08-19 14:50                                   ` Andrew Stubbs
2011-07-14 14:26                                 ` Andrew Stubbs
2011-07-19  0:36                                   ` Janis Johnson
2011-07-19  9:01                                     ` Andrew Stubbs
2011-07-01 12:33                         ` Paolo Bonzini
2011-07-01 13:31                           ` Stubbs, Andrew
2011-07-01 14:41                             ` Paolo Bonzini
2011-07-01 14:55                               ` Stubbs, Andrew
2011-07-01 15:54                                 ` Paolo Bonzini
2011-07-01 18:18                                   ` Stubbs, Andrew
2011-07-01 15:10                             ` Stubbs, Andrew
2011-07-01 16:40                     ` Bernd Schmidt
2011-06-23 21:55   ` Janis Johnson
2011-06-23 14:43 ` [PATCH (4/7)] Unsigned multiplies using wider signed multiplies Andrew Stubbs
2011-06-28 13:28   ` Andrew Stubbs
2011-06-28 14:49     ` Andrew Stubbs
2011-07-04 14:27       ` Andrew Stubbs
2011-07-07 10:10         ` Richard Guenther
2011-07-07 10:42           ` Andrew Stubbs
2011-07-07 11:08             ` Richard Guenther
2011-07-12 14:10         ` Andrew Stubbs
2011-07-14 14:28           ` Andrew Stubbs
2011-07-14 14:31             ` Richard Guenther
2011-08-19 14:51               ` Andrew Stubbs
2011-06-28 13:30   ` Paolo Bonzini
2011-06-23 14:44 ` [PATCH (5/7)] Widening multiplies for mis-matched mode inputs Andrew Stubbs
2011-06-28 15:44   ` Andrew Stubbs
2011-07-04 14:29     ` Andrew Stubbs
2011-07-07 10:11       ` Richard Guenther
2011-07-14 14:34         ` Andrew Stubbs
2011-07-14 14:35           ` Richard Guenther
2011-08-19 14:54             ` Andrew Stubbs
2011-06-23 14:51 ` [PATCH (6/7)] More widening multiply-and-accumulate pattern matching Andrew Stubbs
2011-06-28 15:49   ` Andrew Stubbs
2011-07-04 14:32     ` Andrew Stubbs
2011-07-07 10:20       ` Richard Guenther
2011-07-14 14:35         ` Andrew Stubbs
2011-07-14 14:41           ` Richard Guenther
2011-08-19 15:03             ` Andrew Stubbs
2011-10-13 16:25               ` Matthew Gretton-Dann
2011-06-23 14:54 ` [PATCH (7/7)] Mixed-sign multiplies using narrowest mode Andrew Stubbs
2011-06-28 17:02   ` Andrew Stubbs
2011-07-14 14:44     ` Andrew Stubbs
2011-07-14 14:48       ` Richard Guenther
2011-08-19 15:56         ` Andrew Stubbs
2011-06-25 16:14 ` [PATCH (0/7)] Improve use of Widening Multiplies Bernd Schmidt
2011-06-27  9:16   ` Andrew Stubbs
2011-07-18 14:34 ` [PATCH (8/7)] Fix a bug in multiply-and-accumulate Andrew Stubbs
2011-07-18 16:09   ` Richard Guenther
2011-07-21 13:48     ` Andrew Stubbs
2011-08-19 16:22       ` Andrew Stubbs
2011-07-21 13:14 ` [PATCH (9/7)] Widening multiplies with constant inputs Andrew Stubbs
2011-07-21 14:34   ` Richard Guenther
2011-07-22 12:28     ` Andrew Stubbs
2011-07-22 12:32       ` Andrew Stubbs
2011-07-22 12:34         ` Richard Guenther
2011-07-22 16:06           ` Andrew Stubbs
2011-08-19 16:24             ` Andrew Stubbs
2011-08-19 16:52               ` H.J. Lu

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).