This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] [2/2] divmod transform: override expand_divmod_libfunc for ARM and add test-cases
- From: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- To: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- Cc: nd <nd at arm dot com>, gcc Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Kugan Vivekanandarajah <kugan dot vivekanandarajah at linaro dot org>, Jim Wilson <jim dot wilson at linaro dot org>
- Date: Fri, 29 Jul 2016 22:13:36 +0530
- Subject: Re: [RFC] [2/2] divmod transform: override expand_divmod_libfunc for ARM and add test-cases
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMnLxj0PcvmW=zCq+30eHwv+3KUZuyr+SGXv0Ms47udL=g@mail.gmail.com> <CAAgBjMn2Z7JNej-P2W8tsQTNH=BM+6VqdUpTC-YwkqmkP6BLJw@mail.gmail.com> <CAJA7tRbJ_SH7zpRFE00wN7teQVUKo2Dvu3B5YW+3tz4fOH+fTA@mail.gmail.com> <CAAgBjM=GPmexjifW58AE6+eOL-xryDMp6WqZMrugX+REQJMv6A@mail.gmail.com> <f0c340cd-ed42-0b14-6e18-ea2223d8356e@arm.com> <CAAgBjMm+Ta4cfbmccrjhaz9ZpeYkq+OFDyL=UKEddi7JxmjO0w@mail.gmail.com>
On 29 July 2016 at 05:40, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
> On 28 July 2016 at 20:14, Ramana Radhakrishnan
> <ramana.radhakrishnan@arm.com> wrote:
>>
>>> appear UNSUPPORTED.
>>> That's because this config appears to define
>>> __ARM_ARCH_EXT_IDIV__ however idiv appears not to be present.
>>>
>>> For instance __aeabi_div is called to perform
>>> division for the following test-case:
>>> int f(int x, int y)
>>> {
>>> int r = x / y;
>>> return r;
>>> }
>>>
>>> Compiling with -O2:
>>> f:
>>> @ args = 0, pretend = 0, frame = 0
>>> @ frame_needed = 0, uses_anonymous_args = 0
>>> push {r4, lr}
>>> bl __aeabi_idiv
>>> pop {r4, pc}
>>>
>>> I assumed if __ARM_ARCH_EXT_IDIV was defined, then
>>> there should have been idiv instead of call to __aeabi_div
>>> or am I missing something ?
>>>
>>> Um I had configured with --with-tune=cortex-a9. Is that incorrect for
>>> armv8l-unknown-linux-gnueabihf ?
>>
>> --with-tune shouldn't make a difference to code generation settings. The code generation you are showing is certainly odd for this testcase - and not something I can reproduce on pristine trunk - so sounds like something's broken by your patch . You should be seeing an sdiv in this case in the output - Look at the .arch directive at the top of your file - maybe that gives you a clue in terms of making sure that you had configured the toolchain correctly.
> Hi,
> There is no .arch in the assembly however there's .cpu arm10dtmi at
> the top, full assembly: http://pastebin.com/6tzckiG0
> With pristine trunk (r238800), I still get __aeabi_idiv for the above test-case.
> config opts: --enable-languages=c,c++ --target=armv8l-linux-gnueabihf
> --with-arch=armv8-a --with-fpu=neon-fp-armv8 --with-float=hard
> --with-mode=thumb --enable-multiarch --disable-multilib
> Tried with native stage-1 build and cross build.
> I verified that __ARM_ARCH_EXT_IDIV__ is defined, with following
> test-case, which fails to compile.
> #ifdef __ARM_ARCH_EXT_IDIV__
> #error "has div insn"
> #endif
> int x;
Apparently looks like I screwed sth in my build :/
After re-building from scratch, I could get sdiv in the output -;)
Verified that the patch does not regress on armv8l-unknown-linux-gnu
and cross-tested on arm*-*-*.
Ok for trunk ?
Thanks,
Prathamesh
>
> Thanks,
> Prathamesh
>>
>>
>> regards
>> Ramana
>>
>>>
>>> xgcc -v:
>>> Using built-in specs.
>>> COLLECT_GCC=armhf-bootstrap-build/gcc/xgcc
>>> Target: armv8l-unknown-linux-gnueabihf
>>> Configured with: ../gcc/configure --enable-languages=c,c++,fortran
>>> --with-arch=armv8-a --with-fpu=neon-fp-armv8 --with-float=hard
>>> --with-mode=thumb --enable-multiarch --with-tune=cortex-a9
>>> --disable-multilib
>>> Thread model: posix
>>> gcc version 7.0.0 20160727 (experimental) (GCC)
>>>
>>> Thanks,
>>> Prathamesh
>>>>
>>>> Thanks,
>>>> Ramana
>>