This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [RFC] [2/2] divmod transform: override expand_divmod_libfunc for ARM and add test-cases


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


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