]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/38554 (ICE when compiling pamfunc.c in netpbm with -O1 enabled)
authorAdam Nemet <anemet@caviumnetworks.com>
Fri, 16 Jan 2009 18:56:47 +0000 (18:56 +0000)
committerAdam Nemet <nemet@gcc.gnu.org>
Fri, 16 Jan 2009 18:56:47 +0000 (18:56 +0000)
PR target/38554
* expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift
the subreg from a lowpart subreg if it is also casting the value.

testsuite/
PR target/38554
* gcc.c-torture/compile/pr38554.c: New test.

From-SVN: r143440

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

index b6e30e058eb2ded8cf76f86fe00717bc12a00d28..3c2457d84e611d405e45e570e517148b9bd016e6 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-16  Adam Nemet  <anemet@caviumnetworks.com>
+
+       PR target/38554
+       * expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift
+       the subreg from a lowpart subreg if it is also casting the value.
+
 2009-01-16  Sebastian Pop  <sebastian.pop@amd.com>
            Tobias Grosser  <tobi.grosser@amd.com>
 
index 9ee5f29883d064975e6b1bc07a102cceb2751053..da0db3b834732264c5df579a0ec4228bd1ee414d 100644 (file)
@@ -2136,7 +2136,8 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
        op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1)
                       % GET_MODE_BITSIZE (mode));
       else if (GET_CODE (op1) == SUBREG
-              && subreg_lowpart_p (op1))
+              && subreg_lowpart_p (op1)
+              && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))))
        op1 = SUBREG_REG (op1);
     }
 
index 96b4ce583d73425d9c498bb7e475a474e44f0523..4a41a218ab172ec746f4fe5d6464ce31daa8a273 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-16  Adam Nemet  <anemet@caviumnetworks.com>
+
+       PR target/38554
+       * gcc.c-torture/compile/pr38554.c: New test.
+
 2009-01-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/38579
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38554.c b/gcc/testsuite/gcc.c-torture/compile/pr38554.c
new file mode 100644 (file)
index 0000000..7d40a22
--- /dev/null
@@ -0,0 +1,45 @@
+typedef unsigned long sample;
+struct pam
+{
+  sample maxval;
+};
+typedef sample *tuple;
+enum function
+  {
+    FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR,
+    FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT
+  };
+struct cmdlineInfo
+{
+  enum function function;
+  union
+  {
+    float divisor;
+    unsigned int shiftCount;
+  }
+    u;
+};
+applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam,
+               struct pam const outpam, tuple * const inputRow,
+               tuple * const outputRow)
+{
+  float const oneOverDivisor = 1 / cmdline.u.divisor;
+  int col;
+  {
+    int plane;
+    {
+      sample const inSample = inputRow[col][plane];
+      sample outSample;
+      switch (cmdline.function)
+        {
+        case FN_DIVIDE:
+          outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5));
+          break;
+        case FN_SHIFTLEFT:
+          outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval;
+        }
+      outputRow[col][plane] =
+        ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample));
+    }
+  }
+}