[PATCH, i386]: Make CCNOmode compatible with CCGOCmode and with CCZmode

Uros Bizjak ubizjak@gmail.com
Sun May 14 20:20:00 GMT 2017


Hello!

Attached patch makes CCNOmode compatible with CCGOCmode and with
CCZmode, allowing post-reload compare elimiation to eliminate:

        testl   %r15d, %r15d
        movq    %rax, -552(%rbp)
        cmovns  %r15, %r13
        movq    %rsi, -568(%rbp)
-       testl   %r15d, %r15d
        jle     .L12207

CCNOmode means that we know that OF bit is zero, so we can combine it
with CCGOCmode, which expects garbage in OF. The resulting mode is
CCNOmode, which is more constrained mode of the mode pair.

CCZmode looks only at the ZF, and can be trivially combined into
CCNOmode, in the same way it is already combined into CCGCmode and
CCGOCmode.

2017-05-14  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386.i386.c (ix86_cc_modes_compatible): CCNOmode is
    compatible with CCGOCmode and with CCZmode.

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.
-------------- next part --------------
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 248033)
+++ config/i386/i386.c	(working copy)
@@ -23251,9 +23251,15 @@ ix86_cc_modes_compatible (machine_mode m1, machine
       || (m1 == CCGOCmode && m2 == CCGCmode))
     return CCGCmode;
 
-  if (m1 == CCZmode && (m2 == CCGCmode || m2 == CCGOCmode))
+  if ((m1 == CCNOmode && m2 == CCGOCmode)
+      || (m1 == CCGOCmode && m2 == CCNOmode))
+    return CCNOmode;
+
+  if (m1 == CCZmode
+      && (m2 == CCGCmode || m2 == CCGOCmode || m2 == CCNOmode))
     return m2;
-  else if (m2 == CCZmode && (m1 == CCGCmode || m1 == CCGOCmode))
+  else if (m2 == CCZmode
+	   && (m1 == CCGCmode || m1 == CCGOCmode || m1 == CCNOmode))
     return m1;
 
   switch (m1)


More information about the Gcc-patches mailing list