This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC PR43721] Optimize a/b and a%b to single divmod call

I have attached revamped version of Kugan's patch
( for PR43721.
divmod pass dump:

The approach I took is similar to sincos pass, which involves two parts:
a) divmod pass that transforms:
t1 = a / b;
t2 = a % b;
to the following sequence:
complex_tmp = DIVMOD (a, b);

b) DIVMOD(a, b) is represented as an internal-fn and is expanded by
I am not sure if I have done this correctly. I was somehow looking to
reuse expand_divmod() but am not able to figure out how to do that
(AFAIU expand_divmod() strictly returns either the quotient or
remainder but never both which is what I want), so ended up with
manually expanding to rtx.

While going through the sincos pass in execute_cse_sincos_1, I didn't
understand the following:
 if (gimple_purge_dead_eh_edges (gimple_bb (stmt)))
          cfg_changed = true;
Um why is the call to gimple_purge_dead_eh_edges necessary here?

A silly question, what options to pass to gcc to print statistics ? I
added statistics_counter_event to keep track of number of calls
inserted/used but not sure how to print them :/

I would be grateful for suggestions for improving the patch.

Thank you,

Attachment: ChangeLog.txt
Description: Text document

Attachment: patch.diff
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]