aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-12-04 14:44:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-12-04 14:44:57 +0000
commit881083d629878da043d3f0d7ab5584e77253626c (patch)
tree6da8594866f29cf2ae6e684675423173b67aca42
parent04be694e4d9132523f01de8d9873c6b07164afb2 (diff)
downloadgcc-881083d629878da043d3f0d7ab5584e77253626c.zip
gcc-881083d629878da043d3f0d7ab5584e77253626c.tar.gz
gcc-881083d629878da043d3f0d7ab5584e77253626c.tar.bz2
match-and-simplify.texi: Update for recent changes.
2014-12-04 Richard Biener <rguenther@suse.de> * doc/match-and-simplify.texi: Update for recent changes. From-SVN: r218372
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/doc/match-and-simplify.texi40
2 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7902ac0..f937c44 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-04 Richard Biener <rguenther@suse.de>
+
+ * doc/match-and-simplify.texi: Update for recent changes.
+
2014-12-04 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (ipa_alignment): New type.
diff --git a/gcc/doc/match-and-simplify.texi b/gcc/doc/match-and-simplify.texi
index d63d8b8..2d8faf8 100644
--- a/gcc/doc/match-and-simplify.texi
+++ b/gcc/doc/match-and-simplify.texi
@@ -224,6 +224,46 @@ In this example the pattern will be repeated four times with
@code{plus, minus, minus}, @code{minus, plus, plus},
@code{minus, plus, minus}.
+To avoid repeating operator lists in @code{for} you can name
+them via
+
+@smallexample
+(define_operator_list pmm plus minus mult)
+@end smallexample
+
+and use them in @code{for} operator lists where they get expanded.
+
+@smallexample
+(for opa (pmm trunc_div)
+ (simplify...
+@end smallexample
+
+So this example iterates over @code{plus}, @code{minus}, @code{mult}
+and @code{trunc_div}.
+
+Using operator lists can also remove the need to explicitely write
+a @code{for}. All operator list uses that appear in a @code{simplify}
+or @code{match} pattern in operator positions will implicitely
+be added to a new @code{for}. For example
+
+@smallexample
+(define_operator_list SQRT BUILT_IN_SQRTF BUILT_IN_SQRT BUILT_IN_SQRTL)
+(define_operator_list POW BUILT_IN_POWF BUILT_IN_POW BUILT_IN_POWL)
+(simplify
+ (SQRT (POW @@0 @@1))
+ (POW (abs @@0) (mult @@1 @{ built_real (TREE_TYPE (@@1), dconsthalf); @})))
+@end smallexample
+
+is the same as
+
+@smallexample
+(for SQRT (BUILT_IN_SQRTF BUILT_IN_SQRT BUILT_IN_SQRTL)
+ POW (BUILT_IN_POWF BUILT_IN_POW BUILT_IN_POWL)
+ (simplify
+ (SQRT (POW @@0 @@1))
+ (POW (abs @@0) (mult @@1 @{ built_real (TREE_TYPE (@@1), dconsthalf); @}))))
+@end smallexample
+
Another building block are @code{with} expressions in the
result expression which nest the generated code in a new C block
followed by its argument: