summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-18 16:02:14 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-18 16:02:14 +0000
commit73b33d47426f3451639fb5e12160428c62aed776 (patch)
tree3d3344b42fb2435ba6ab5a5878ce553c432ba85d /gcc
parent5210db796309cfab53080cd417dc5d876e8d73a9 (diff)
downloadgcc-73b33d47426f3451639fb5e12160428c62aed776.tar.gz
* builtins.c (expand_builtin_sync_operation): Fold nand to and
for constants. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98324 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/builtins.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 924cf2624e5..621d26395a2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-18 Richard Henderson <rth@redhat.com>
+
+ * builtins.c (expand_builtin_sync_operation): Fold nand to and
+ for constants.
+
2005-04-18 Devang Patel <dpatel@apple.com>
* config/rs6000/atlivec.md (mulv4si3): New pattern.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 33102e08e55..e9077527c62 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5255,13 +5255,20 @@ expand_builtin_sync_operation (tree arglist, enum rtx_code code, bool after,
{
enum machine_mode mode;
rtx addr, val, mem;
+ tree valt;
/* Expand the operands. */
addr = expand_expr (TREE_VALUE (arglist), NULL, Pmode, EXPAND_SUM);
mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (TREE_VALUE (arglist))));
arglist = TREE_CHAIN (arglist);
- val = expand_expr (TREE_VALUE (arglist), NULL, mode, EXPAND_NORMAL);
+ valt = TREE_VALUE (arglist);
+ if (code == NOT && TREE_CONSTANT (valt))
+ {
+ valt = fold_build1 (BIT_NOT_EXPR, TREE_TYPE (valt), valt);
+ code = AND;
+ }
+ val = expand_expr (valt, NULL, mode, EXPAND_NORMAL);
/* Note that we explicitly do not want any alias information for this
memory, so that we kill all other live memories. Otherwise we don't