]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix emit_store_flag_force () function to fix ICE in int_mode_for_mode,
authorSudakshina Das <sudi.das@arm.com>
Wed, 21 Feb 2018 12:50:31 +0000 (12:50 +0000)
committerSudakshina Das <sudi@gcc.gnu.org>
Wed, 21 Feb 2018 12:50:31 +0000 (12:50 +0000)
at stor-layout.c:403 with arm-linux-gnueabi.

*** gcc/ChangeLog ***

2018-02-21  Sudakshina Das  <sudi.das@arm.com>

Backport from trunk
2018-01-10  Sudakshina Das  <sudi.das@arm.com>

PR target/82096
* expmed.c (emit_store_flag_force): Swap if const op0
and change VOIDmode to mode of op0.

*** gcc/testsuite/ChangeLog ***

2018-02-21  Sudakshina Das  <sudi.das@arm.com>

Backport from trunk
2018-01-12  Sudakshina Das  <sudi.das@arm.com>

* gcc.c-torture/compile/pr82096.c: Add dg-skip-if
directive.

Backport from trunk
2018-01-10  Sudakshina Das  <sudi.das@arm.com>

PR target/82096
* gcc.c-torture/compile/pr82096.c: New test.

From-SVN: r257871

gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr82096.c [new file with mode: 0644]

index 059f5e968d25d2e8fdf249c2be381c8b0304a9f6..cebcf8500bd151c99a0b8c1a3e8c0489bea6b1ca 100644 (file)
@@ -1,3 +1,12 @@
+2018-02-21  Sudakshina Das  <sudi.das@arm.com>
+
+       Backport from trunk
+       2018-01-10  Sudakshina Das  <sudi.das@arm.com>
+
+       PR target/82096
+       * expmed.c (emit_store_flag_force): Swap if const op0
+       and change VOIDmode to mode of op0.
+
 2018-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        Back port from trunk
index 55398a04504232a61e7afc7e4a7b4cd42221f7ab..80edb0d03fb7c75c488b52fcef5ba203d4341bf8 100644 (file)
@@ -5917,6 +5917,18 @@ emit_store_flag_force (rtx target, enum rtx_code code, rtx op0, rtx op1,
   if (tem != 0)
     return tem;
 
+  /* If one operand is constant, make it the second one.  Only do this
+     if the other operand is not constant as well.  */
+
+  if (swap_commutative_operands_p (op0, op1))
+    {
+      std::swap (op0, op1);
+      code = swap_condition (code);
+    }
+
+  if (mode == VOIDmode)
+    mode = GET_MODE (op0);
+
   if (!target)
     target = gen_reg_rtx (word_mode);
 
index 4f813486e0a57f7c2547ed46597c88eca2d81060..e940f712802d177d96399ae535d579d32c17173d 100644 (file)
@@ -1,3 +1,17 @@
+2018-02-21  Sudakshina Das  <sudi.das@arm.com>
+
+       Backport from trunk
+       2018-01-12  Sudakshina Das  <sudi.das@arm.com>
+
+       * gcc.c-torture/compile/pr82096.c: Add dg-skip-if
+       directive.
+
+       Backport from trunk
+       2018-01-10  Sudakshina Das  <sudi.das@arm.com>
+
+       PR target/82096
+       * gcc.c-torture/compile/pr82096.c: New test.
+
 2018-02-16  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/84277
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82096.c b/gcc/testsuite/gcc.c-torture/compile/pr82096.c
new file mode 100644 (file)
index 0000000..d144b70
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-require-effective-target arm_arch_v5t_ok { target arm*-*-* } } */
+/* { dg-skip-if "Do not combine float-abi values" { arm*-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+/* { dg-additional-options "-march=armv5t -mthumb -mfloat-abi=soft" { target arm*-*-* } } */
+
+static long long AL[24];
+
+int
+check_ok (void)
+{
+  return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, 0x1234567890ll));
+}