[PR rtl-optimization/20532] plus(ashift,ashift) -> mult may overflow

Jakub Jelinek jakub@redhat.com
Thu Mar 24 08:21:00 GMT 2005


On Thu, Mar 24, 2005 at 03:50:38AM -0300, Alexandre Oliva wrote:
> On Mar 23, 2005, Roger Sayle <roger@eyesopen.com> wrote:
> 
> > After two or three days on mainline without any reported problems,
> > this patch is also OK for the 4.0 branch (after bootstrapping and
> > regression testing there).
> 
> This is the backport to the 4.0 branch, involving only indentation
> changes.
> 

--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/gcc.target/i386/badshift.c 24 Mar 2005 06:11:28 -0000
@@ -0,0 +1,28 @@
+/* PR rtl-optimization/20532 */
+
+/* { dg-do run } */
+/* { dg-options "-m32 -march=i386 -O1" } */
+
+/* We used to optimize the DImode shift-by-32 to zero because in combine
+   we turned:
+
+     (v << 31) * (v << 31)

Isn't this typo?  s/\*/+/

+
+   into:
+
+     (v * (((HOST_WIDE_INT)1 << 31) + ((HOST_WIDE_INT)1 << 31)))

Also, wouldn't it be better to let the test run on all arches?
That way it catches possible future regressions on other arches too.
There is nothing i386 specific on the testcase.  The standard
requires long long to be at least 64-bit...
If you want -m32 -march=i386 specifically for IA-32, you can put it
into gcc.dg/torture and use something like:
/* { dg-options "" } */
/* { dg-options "-march=i386" { target i?86-*-* } } */
/* { dg-options "-m32 -march=i386" { target x86_64-*-* && ilp32 } } */

	Jakub



More information about the Gcc-patches mailing list