From: amodra Date: Tue, 2 Feb 2016 01:29:17 +0000 (+0000) Subject: [RS6000] lqarx and stqcx. registers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19bf08e26644f73d9a4fc22648cb1854d4a33ce8;p=thirdparty%2Fgcc.git [RS6000] lqarx and stqcx. registers lqarx RT and stqcx. RS are valid only with even numbered gprs. The predicate to enforce this happens to allow a loophole, closed by this patch. PR target/69548 gcc/ * config/rs6000/predicates.md (quad_int_reg_operand): Don't allow subregs. gcc/testsuite/ * gcc.target/powerpc/pr69548.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233065 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d89607433b9..b061339ae064 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-02-02 Alan Modra + + PR target/69548 + * config/rs6000/predicates.md (quad_int_reg_operand): Don't + allow subregs. + 2016-02-02 Alan Modra PR target/68662 diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 5adc4de6a311..072291ef7d01 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -375,20 +375,19 @@ ;; Return 1 if op is a general purpose register that is an even register ;; which suitable for a load/store quad operation +;; Subregs are not allowed here because when they are combine can +;; create (subreg:PTI (reg:TI pseudo)) which will cause reload to +;; think the innermost reg needs reloading, in TImode instead of +;; PTImode. So reload will choose a reg in TImode which has no +;; requirement that the reg be even. (define_predicate "quad_int_reg_operand" - (match_operand 0 "register_operand") + (match_code "reg") { HOST_WIDE_INT r; if (!TARGET_QUAD_MEMORY && !TARGET_QUAD_MEMORY_ATOMIC) return 0; - if (GET_CODE (op) == SUBREG) - op = SUBREG_REG (op); - - if (!REG_P (op)) - return 0; - r = REGNO (op); if (r >= FIRST_PSEUDO_REGISTER) return 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f8ddd096882..c96277c93813 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-02-02 Alan Modra + + PR target/69548 + * gcc.target/powerpc/pr69548.c: New test. + 2016-02-01 Jakub Jelinek PR rtl-optimization/69592 diff --git a/gcc/testsuite/gcc.target/powerpc/pr69548.c b/gcc/testsuite/gcc.target/powerpc/pr69548.c new file mode 100644 index 000000000000..439f588b874b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr69548.c @@ -0,0 +1,11 @@ +/* { dg-do assemble { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -Os -mbig" } */ + +__int128 +quad_exchange (__int128 *ptr, __int128 newval) +{ + return __atomic_exchange_n (ptr, newval, __ATOMIC_RELAXED); +}