public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Enable GCC with CMOVxx
@ 2009-07-20 21:37 Lingchuan (LC) Meng
  2009-07-20 22:15 ` Michael Meissner
  0 siblings, 1 reply; 3+ messages in thread
From: Lingchuan (LC) Meng @ 2009-07-20 21:37 UTC (permalink / raw)
  To: gcc-help

Hi all,

I'm trying to enable gcc 4.3.2 on Ubuntu to compile C code with
support of conditional moves. (and Conditional Moves as the only
enabled optimization)

I can see CMOVxx in the assembly compiled with "-O" option. However,
no CMOVxx is found in the assembly generated with just
"-fif-conversion" option.

More surprisingly (well, at least to me), I listed all the enabled
optimization options of "-O", and put them in one line. Then I
compiled the same code as:

gcc -S -falign-loops                 -fargument-alias
-fasynchronous-unwind-tables   -fbranch-count-reg            -fcommon
                   -fcprop-registers             -fdce
        -fdefer-pop                   -fdse
-fearly-inlining              -fgcse-lm
-fguess-branch-probability    -fif-conversion
-fif-conversion2              -finline-functions-called-once
-fipa-pure-const              -fipa-reference               -fivopts
                  -fjump-tables                 -fmerge-constants
       -fmove-loop-invariants        -fomit-frame-pointer
-fpeephole                    -frename-registers
-frerun-cse-after-loop        -fsched-interblock
-fsched-spec                  -fsched-stalled-insns-dep
-fsigned-zeros                -fsplit-ivs-in-unroller
-fsplit-wide-types            -ftoplevel-reorder
-ftrapping-math               -ftree-ccp                    -ftree-ch
                  -ftree-copy-prop              -ftree-copyrename
       -ftree-cselim                 -ftree-dce
-ftree-dominator-opts         -ftree-dse                    -ftree-fre
                  -ftree-loop-im                -ftree-loop-ivcanon
       -ftree-loop-optimize          -ftree-reassoc
-ftree-salias                 -ftree-scev-cprop
-ftree-sink                   -ftree-sra                    -ftree-ter
                  -ftree-vect-loop-version      -funit-at-a-time
       -fvar-tracking                -fvect-cost-model
-fweb -o test.s test.c

And there is still no conditional moves in the assembly. I assume the
list of options would be equivalent to -O.

Please advise what you think of this problem.

My guess is that the order of the optimization options may be making
the difference.

Thank you very much!

LC

-- 
Best regards,

Lingchuan Meng

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Enable GCC with CMOVxx
  2009-07-20 21:37 Enable GCC with CMOVxx Lingchuan (LC) Meng
@ 2009-07-20 22:15 ` Michael Meissner
  2009-07-21 15:20   ` Lingchuan (LC) Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Meissner @ 2009-07-20 22:15 UTC (permalink / raw)
  To: Lingchuan (LC) Meng; +Cc: gcc-help

On Mon, Jul 20, 2009 at 05:37:29PM -0400, Lingchuan (LC) Meng wrote:
> Hi all,
> 
> I'm trying to enable gcc 4.3.2 on Ubuntu to compile C code with
> support of conditional moves. (and Conditional Moves as the only
> enabled optimization)
> 
> I can see CMOVxx in the assembly compiled with "-O" option. However,
> no CMOVxx is found in the assembly generated with just
> "-fif-conversion" option.
> 
> More surprisingly (well, at least to me), I listed all the enabled
> optimization options of "-O", and put them in one line. Then I
> compiled the same code as:

Several optimizations require a certain optimization level, and are not done
even if you specify the -f option.  If conversion is one such optimization,
where the functions gate_handle_if_conversion and
gate_handle_if_conversion_after_combine, and
gate_handle_if_conversion_after_reload in ifcvt.c all have explicit tests for
optimize being greater than 0 in addition to the -f option flag(s).  I would
suspect this is because if conversion needs some of the dataflow passes that
are not normally run for -O0.  From the ChangeLogs, it looks like the functions
were originally added in July 2005.

-- 
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Enable GCC with CMOVxx
  2009-07-20 22:15 ` Michael Meissner
@ 2009-07-21 15:20   ` Lingchuan (LC) Meng
  0 siblings, 0 replies; 3+ messages in thread
From: Lingchuan (LC) Meng @ 2009-07-21 15:20 UTC (permalink / raw)
  To: Michael Meissner, Lingchuan (LC) Meng, gcc-help, eljay

Hi Michael and John,

Thank you for your replies.

I managed to get around it for my particular case:  determining the
performance difference of the "-fif-conversion" option. I copy this to
the list in case someone else has similar problem in the future.

You're both right on that the "-fif-conversion" option works only with
certain optimization level specified, such as "-O" and "-O2".

And you can turn it off by "-fno-if-conversion". So "-O2
-fno-if-conversion" would compile the code with all the optimization
options in O2 default except for "-fif-conversion".

For general case, link:
http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Optimize-Options.html#Optimize-Options
says:

"Options of the form -fflag specify machine-independent flags. Most
flags have both positive and negative forms; the negative form of
-ffoo would be -fno-foo."

Please correct if I misunderstand anything.

Thank you.

LC

On Mon, Jul 20, 2009 at 6:15 PM, Michael
Meissner<meissner@linux.vnet.ibm.com> wrote:
> On Mon, Jul 20, 2009 at 05:37:29PM -0400, Lingchuan (LC) Meng wrote:
>> Hi all,
>>
>> I'm trying to enable gcc 4.3.2 on Ubuntu to compile C code with
>> support of conditional moves. (and Conditional Moves as the only
>> enabled optimization)
>>
>> I can see CMOVxx in the assembly compiled with "-O" option. However,
>> no CMOVxx is found in the assembly generated with just
>> "-fif-conversion" option.
>>
>> More surprisingly (well, at least to me), I listed all the enabled
>> optimization options of "-O", and put them in one line. Then I
>> compiled the same code as:
>
> Several optimizations require a certain optimization level, and are not done
> even if you specify the -f option.  If conversion is one such optimization,
> where the functions gate_handle_if_conversion and
> gate_handle_if_conversion_after_combine, and
> gate_handle_if_conversion_after_reload in ifcvt.c all have explicit tests for
> optimize being greater than 0 in addition to the -f option flag(s).  I would
> suspect this is because if conversion needs some of the dataflow passes that
> are not normally run for -O0.  From the ChangeLogs, it looks like the functions
> were originally added in July 2005.
>
> --
> Michael Meissner, IBM
> 4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
> meissner@linux.vnet.ibm.com
>



-- 
Best regards,

Lingchuan Meng

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-21 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-20 21:37 Enable GCC with CMOVxx Lingchuan (LC) Meng
2009-07-20 22:15 ` Michael Meissner
2009-07-21 15:20   ` Lingchuan (LC) Meng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).