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: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Kugan Vivekanandarajah <kugan dot vivekanandarajah at linaro dot org>, Jim Wilson <jim dot wilson at linaro dot org>
- Date: Wed, 27 Jul 2016 14:26:11 +0100
- 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>
On Wed, May 25, 2016 at 1:49 PM, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
> On 23 May 2016 at 14:28, Prathamesh Kulkarni
> <prathamesh.kulkarni@linaro.org> wrote:
>> Hi,
>> This patch overrides expand_divmod_libfunc for ARM port and adds test-cases.
>> I separated the SImode tests into separate file from DImode tests
>> because certain arm configs (cortex-15) have hardware div insn for
>> SImode but not for DImode,
>> and for that config we want SImode tests to be disabled but not DImode tests.
>> The patch therefore has two target-effective checks: divmod and divmod_simode.
>> Cross-tested on arm*-*-*.
>> Bootstrap+test on arm-linux-gnueabihf in progress.
>> Does this patch look OK ?
> Hi,
> This version adds couple of more test-cases and fixes typo in
> divmod-3-simode.c, divmod-4-simode.c
>
> Thanks,
> Prathamesh
>>
>> Thanks,
>> Prathamesh
>From the patch (snipped out unnecessary parts)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 201aeb4..3bbf11b 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
<snip>
+ gcc_assert (quotient);
+ gcc_assert (remainder);
+
There's a trailing white space here.
+ *quot_p = quotient;
+ *rem_p = remainder;
+}
+# For ARM configs defining __ARM_ARCH_EXT_IDIV__, disable
divmod_simode test-cases
Very unhelpful comment ...
For versions of the architecture where there exists a DIV instruction,
the divmod helper function is not used, disable the software divmod
optimization.
+
+proc check_effective_target_arm_divmod_simode { } {
+ return [check_no_compiler_messages arm_divmod assembly {
+ #ifdef __ARM_ARCH_EXT_IDIV__
+ #error has div insn
+ #endif
+ int i;
+ }]
+}
+
+proc check_effective_target_divmod { } {
Missing comment above.
+ #TODO: Add checks for all targets that have either hardware divmod insn
+ # or define libfunc for divmod.
+ if { [istarget arm*-*-*]
+ || [istarget x86_64-*-*] } {
+ return 1
+ }
+ return 0
+}
The new helper functions need documentation in doc/sourcebuild.texi
Please repost with the doc changes, otherwise this is OK from my side.
Thanks,
Ramana