aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2008-09-28 23:07:01 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2008-09-28 16:07:01 -0700
commit4b49d9cebcb3e228467db4f45adfe00986f26f30 (patch)
tree9f196ee3834f09ea3f8097275cea07421e2990e8 /gcc
parent30deaaf309195b515d474935c283620973a1fb3e (diff)
downloadgcc-4b49d9cebcb3e228467db4f45adfe00986f26f30.zip
gcc-4b49d9cebcb3e228467db4f45adfe00986f26f30.tar.gz
gcc-4b49d9cebcb3e228467db4f45adfe00986f26f30.tar.bz2
re PR target/37640 (__sync_lock_test_and_set on PPC64 causes ICE)
2008-09-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR target/37640 * config/rs6000/rs6000.c (rs6000_expand_compare_and_swapqhi): Force address to a register before taking the lower part. 2008-09-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR target/37640 * gcc.c-torture/compile/sync-3.c: New testcase to check that addresses of non zero offset works. From-SVN: r140740
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rs6000/rs6000.c3
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/sync-3.c185
4 files changed, 199 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf55bdb..f5d7516 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR target/37640
+ * config/rs6000/rs6000.c (rs6000_expand_compare_and_swapqhi): Force
+ address to a register before taking the lower part.
+
2008-09-28 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.h (OVERRIDE_OPTIONS): Unset flag_dwarf2_cfi_asm
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 924fa9e..0940c22 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -14020,7 +14020,8 @@ rs6000_expand_compare_and_swapqhi (rtx dst, rtx mem, rtx oldval, rtx newval)
HOST_WIDE_INT imask = GET_MODE_MASK (mode);
/* Shift amount for subword relative to aligned word. */
- addrSI = force_reg (SImode, gen_lowpart_common (SImode, XEXP (mem, 0)));
+ addrSI = force_reg (GET_MODE (XEXP (mem, 0)), XEXP (mem, 0));
+ addrSI = force_reg (SImode, gen_lowpart_common (SImode, addrSI));
shift = gen_reg_rtx (SImode);
emit_insn (gen_rlwinm (shift, addrSI, GEN_INT (3),
GEN_INT (shift_mask)));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0723a51..26d16dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,10 @@
2008-09-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR target/37640
+ * gcc.c-torture/compile/sync-3.c: New testcase to check that
+ addresses of non zero offset works.
+
+2008-09-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
Kaushal Kantawala <kaushal_kantawala@playstation.sony.com>
PR tree-opt/36891
diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-3.c b/gcc/testsuite/gcc.c-torture/compile/sync-3.c
new file mode 100644
index 0000000..a31c926
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/sync-3.c
@@ -0,0 +1,185 @@
+/* Validate that each of the __sync builtins compiles. This won't
+ necessarily link, since the target might not support the builtin,
+ so this may result in external library calls. */
+
+void test_op_ignore (void)
+{
+signed char sc[2];
+unsigned char uc[2];
+signed short ss[2];
+unsigned short us[2];
+signed int si[2];
+unsigned int ui[2];
+signed long sl[2];
+unsigned long ul[2];
+signed long long sll[2];
+unsigned long long ull[2];
+ (void) __sync_fetch_and_add (&sc[1], -1);
+ (void) __sync_fetch_and_add (&uc[1], -1);
+ (void) __sync_fetch_and_add (&ss[1], -1);
+ (void) __sync_fetch_and_add (&us[1], -1);
+ (void) __sync_fetch_and_add (&si[1], -1);
+ (void) __sync_fetch_and_add (&ui[1], -1);
+ (void) __sync_fetch_and_add (&sl[1], -1);
+ (void) __sync_fetch_and_add (&ul[1], -1);
+ (void) __sync_fetch_and_add (&sll[1], -1);
+ (void) __sync_fetch_and_add (&ull[1], -1);
+
+ (void) __sync_fetch_and_sub (&sc[1], -1);
+ (void) __sync_fetch_and_sub (&uc[1], -1);
+ (void) __sync_fetch_and_sub (&ss[1], -1);
+ (void) __sync_fetch_and_sub (&us[1], -1);
+ (void) __sync_fetch_and_sub (&si[1], -1);
+ (void) __sync_fetch_and_sub (&ui[1], -1);
+ (void) __sync_fetch_and_sub (&sl[1], -1);
+ (void) __sync_fetch_and_sub (&ul[1], -1);
+ (void) __sync_fetch_and_sub (&sll[1], -1);
+ (void) __sync_fetch_and_sub (&ull[1], -1);
+
+ (void) __sync_fetch_and_or (&sc[1], -1);
+ (void) __sync_fetch_and_or (&uc[1], -1);
+ (void) __sync_fetch_and_or (&ss[1], -1);
+ (void) __sync_fetch_and_or (&us[1], -1);
+ (void) __sync_fetch_and_or (&si[1], -1);
+ (void) __sync_fetch_and_or (&ui[1], -1);
+ (void) __sync_fetch_and_or (&sl[1], -1);
+ (void) __sync_fetch_and_or (&ul[1], -1);
+ (void) __sync_fetch_and_or (&sll[1], -1);
+ (void) __sync_fetch_and_or (&ull[1], -1);
+
+ (void) __sync_fetch_and_xor (&sc[1], -1);
+ (void) __sync_fetch_and_xor (&uc[1], -1);
+ (void) __sync_fetch_and_xor (&ss[1], -1);
+ (void) __sync_fetch_and_xor (&us[1], -1);
+ (void) __sync_fetch_and_xor (&si[1], -1);
+ (void) __sync_fetch_and_xor (&ui[1], -1);
+ (void) __sync_fetch_and_xor (&sl[1], -1);
+ (void) __sync_fetch_and_xor (&ul[1], -1);
+ (void) __sync_fetch_and_xor (&sll[1], -1);
+ (void) __sync_fetch_and_xor (&ull[1], -1);
+
+ (void) __sync_fetch_and_and (&sc[1], -1);
+ (void) __sync_fetch_and_and (&uc[1], -1);
+ (void) __sync_fetch_and_and (&ss[1], -1);
+ (void) __sync_fetch_and_and (&us[1], -1);
+ (void) __sync_fetch_and_and (&si[1], -1);
+ (void) __sync_fetch_and_and (&ui[1], -1);
+ (void) __sync_fetch_and_and (&sl[1], -1);
+ (void) __sync_fetch_and_and (&ul[1], -1);
+ (void) __sync_fetch_and_and (&sll[1], -1);
+ (void) __sync_fetch_and_and (&ull[1], -1);
+
+ (void) __sync_fetch_and_nand (&sc[1], -1);
+ (void) __sync_fetch_and_nand (&uc[1], -1);
+ (void) __sync_fetch_and_nand (&ss[1], -1);
+ (void) __sync_fetch_and_nand (&us[1], -1);
+ (void) __sync_fetch_and_nand (&si[1], -1);
+ (void) __sync_fetch_and_nand (&ui[1], -1);
+ (void) __sync_fetch_and_nand (&sl[1], -1);
+ (void) __sync_fetch_and_nand (&ul[1], -1);
+ (void) __sync_fetch_and_nand (&sll[1], -1);
+ (void) __sync_fetch_and_nand (&ull[1], -1);
+}
+
+void test_fetch_and_op (void)
+{
+signed char sc[2];
+unsigned char uc[2];
+signed short ss[2];
+unsigned short us[2];
+signed int si[2];
+unsigned int ui[2];
+signed long sl[2];
+unsigned long ul[2];
+signed long long sll[2];
+unsigned long long ull[2];
+ sc[1] = __sync_fetch_and_add (&sc[1], -11);
+ uc[1] = __sync_fetch_and_add (&uc[1], -11);
+ ss[1] = __sync_fetch_and_add (&ss[1], -11);
+ us[1] = __sync_fetch_and_add (&us[1], -11);
+ si[1] = __sync_fetch_and_add (&si[1], -11);
+ ui[1] = __sync_fetch_and_add (&ui[1], -11);
+ sl[1] = __sync_fetch_and_add (&sl[1], -11);
+ ul[1] = __sync_fetch_and_add (&ul[1], -11);
+ sll[1] = __sync_fetch_and_add (&sll[1], -11);
+ ull[1] = __sync_fetch_and_add (&ull[1], -11);
+
+ sc[1] = __sync_fetch_and_sub (&sc[1], -11);
+ uc[1] = __sync_fetch_and_sub (&uc[1], -11);
+ ss[1] = __sync_fetch_and_sub (&ss[1], -11);
+ us[1] = __sync_fetch_and_sub (&us[1], -11);
+ si[1] = __sync_fetch_and_sub (&si[1], -11);
+ ui[1] = __sync_fetch_and_sub (&ui[1], -11);
+ sl[1] = __sync_fetch_and_sub (&sl[1], -11);
+ ul[1] = __sync_fetch_and_sub (&ul[1], -11);
+ sll[1] = __sync_fetch_and_sub (&sll[1], -11);
+ ull[1] = __sync_fetch_and_sub (&ull[1], -11);
+
+ sc[1] = __sync_fetch_and_or (&sc[1], -11);
+ uc[1] = __sync_fetch_and_or (&uc[1], -11);
+ ss[1] = __sync_fetch_and_or (&ss[1], -11);
+ us[1] = __sync_fetch_and_or (&us[1], -11);
+ si[1] = __sync_fetch_and_or (&si[1], -11);
+ ui[1] = __sync_fetch_and_or (&ui[1], -11);
+ sl[1] = __sync_fetch_and_or (&sl[1], -11);
+ ul[1] = __sync_fetch_and_or (&ul[1], -11);
+ sll[1] = __sync_fetch_and_or (&sll[1], -11);
+ ull[1] = __sync_fetch_and_or (&ull[1], -11);
+
+ sc[1] = __sync_fetch_and_xor (&sc[1], -11);
+ uc[1] = __sync_fetch_and_xor (&uc[1], -11);
+ ss[1] = __sync_fetch_and_xor (&ss[1], -11);
+ us[1] = __sync_fetch_and_xor (&us[1], -11);
+ si[1] = __sync_fetch_and_xor (&si[1], -11);
+ ui[1] = __sync_fetch_and_xor (&ui[1], -11);
+ sl[1] = __sync_fetch_and_xor (&sl[1], -11);
+ ul[1] = __sync_fetch_and_xor (&ul[1], -11);
+ sll[1] = __sync_fetch_and_xor (&sll[1], -11);
+ ull[1] = __sync_fetch_and_xor (&ull[1], -11);
+
+ sc[1] = __sync_fetch_and_and (&sc[1], -11);
+ uc[1] = __sync_fetch_and_and (&uc[1], -11);
+ ss[1] = __sync_fetch_and_and (&ss[1], -11);
+ us[1] = __sync_fetch_and_and (&us[1], -11);
+ si[1] = __sync_fetch_and_and (&si[1], -11);
+ ui[1] = __sync_fetch_and_and (&ui[1], -11);
+ sl[1] = __sync_fetch_and_and (&sl[1], -11);
+ ul[1] = __sync_fetch_and_and (&ul[1], -11);
+ sll[1] = __sync_fetch_and_and (&sll[1], -11);
+ ull[1] = __sync_fetch_and_and (&ull[1], -11);
+
+ sc[1] = __sync_fetch_and_nand (&sc[1], -11);
+ uc[1] = __sync_fetch_and_nand (&uc[1], -11);
+ ss[1] = __sync_fetch_and_nand (&ss[1], -11);
+ us[1] = __sync_fetch_and_nand (&us[1], -11);
+ si[1] = __sync_fetch_and_nand (&si[1], -11);
+ ui[1] = __sync_fetch_and_nand (&ui[1], -11);
+ sl[1] = __sync_fetch_and_nand (&sl[1], -11);
+ ul[1] = __sync_fetch_and_nand (&ul[1], -11);
+ sll[1] = __sync_fetch_and_nand (&sll[1], -11);
+ ull[1] = __sync_fetch_and_nand (&ull[1], -11);
+}
+
+void test_lock (void)
+{
+signed char sc[2];
+unsigned char uc[2];
+signed short ss[2];
+unsigned short us[2];
+signed int si[2];
+unsigned int ui[2];
+signed long sl[2];
+unsigned long ul[2];
+signed long long sll[2];
+unsigned long long ull[2];
+ sc[1] = __sync_lock_test_and_set (&sc[1], -1);
+ uc[1] = __sync_lock_test_and_set (&uc[1], -1);
+ ss[1] = __sync_lock_test_and_set (&ss[1], -1);
+ us[1] = __sync_lock_test_and_set (&us[1], -1);
+ si[1] = __sync_lock_test_and_set (&si[1], -1);
+ ui[1] = __sync_lock_test_and_set (&ui[1], -1);
+ sl[1] = __sync_lock_test_and_set (&sl[1], -1);
+ ul[1] = __sync_lock_test_and_set (&ul[1], -1);
+ sll[1] = __sync_lock_test_and_set (&sll[1], -1);
+ ull[1] = __sync_lock_test_and_set (&ull[1], -1);
+}