Here is the testcase which I added with the cse change: /* { dg-do compile { target *-octeon-* } } */ /* { dg-options "-O2" } */ /* { dg-final { scan-assembler "51" } } */ /* { dg-final { scan-assembler "movz" } } */ /* { dg-final { scan-assembler-not "beq" } } */ typedef unsigned long long uint64_t; union cvmx_buf_ptr { void* ptr; uint64_t u64; struct { uint64_t i : 1; uint64_t back : 4;
uint64_t pool : 3; uint64_t size :16; uint64_t addr :40; } s; };
typedef union cvmx_buf_ptr cvmx_buf_ptr_t;
void f(long long *a, long long use_ipd_no_wptr, uint64_t ptr) { cvmx_buf_ptr_t packet_ptr; packet_ptr.u64 = 0; if (use_ipd_no_wptr) { packet_ptr.s.pool = (0); packet_ptr.s.size = (16 * (128)); } packet_ptr.s.addr = ptr; *a = packet_ptr.u64; } --- CUT --- Basically it is checking for no branches (beq) and that conditional selection (movz) is created. It is also checking to make sure 0x51. Note this is a big-endian MIPS64r2 testcase. This code does show up in Cavium's simple-exec passthrough example in the hot loop which is why I was optimizing it.
Thanks, Andrew Pinski ________________________________________ From: Zhenqiang Chen zhenqiang.chen@linaro.org Sent: Sunday, June 15, 2014 8:29 PM To: Pinski, Andrew Cc: linaro-toolchain Subject: Re: [ACTIVITY] Week 24
On 16 June 2014 10:38, Pinski, Andrew Andrew.Pinski@caviumnetworks.com wrote:
- Investigate how to optimize large constant. Patch is in testing (TCWG-486, 5/10). Basic idea is:
- Do not split large constant when expanding.
- Improve cprop pass to check the rtx_cost when propagating constants.
I did this basic idea for MIPS64 and also caused cse to ignore the cost of constants when it was optimizing zero_extend on the lhs. This two things helped lot for optimizing of setting bit-fields to a constant (without a tree level pass).
Thanks for the comments. Do you have an example benefited from your cse changes? I want to verify it on ARM.
Thanks! -Zhenqiang
Thanks, Andrew Pinski
-----Original Message----- From: linaro-toolchain-bounces@lists.linaro.org [mailto:linaro-toolchain-bounces@lists.linaro.org] On Behalf Of Zhenqiang Chen Sent: Sunday, June 15, 2014 7:29 PM To: linaro-toolchain Subject: [ACTIVITY] Week 24
== Issues ==
- None.
== Progress ==
- Work out 4 patches to enhance loop2-invariant heuristics and send out for community review (TCWG-469, 3/10).
- Test the rebased ccmp patches (TCWG-488, 2/10).
- Investigate how to optimize large constant. Patch is in testing (TCWG-486, 5/10). Basic idea is:
- Do not split large constant when expanding.
- Improve cprop pass to check the rtx_cost when propagating constants.
== Plans ==
- Ping pending patches.
- Send out ccmp patches for review.
- Send out patches to optimize constant.
linaro-toolchain mailing list linaro-toolchain@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-toolchain