diff mbox

[RFC,LIBGCC,2,of,2] 64 bit divide implementation for processor without hw divide instruction

Message ID 52957548.8060308@linaro.org
State Accepted
Headers show

Commit Message

Kugan Vivekanandarajah Nov. 27, 2013, 4:30 a.m. UTC
On 27/11/13 02:07, Richard Earnshaw wrote:
> On 23/11/13 01:54, Kugan wrote:

[snip]

>> +2013-11-22  Kugan Vivekanandarajah  <kuganv@linaro.org>
>> +
>> +	* libgcc/config/arm/pbapi-lib.h (HAVE_NO_HW_DIVIDE): Define for
> 
> It's bpabi-lib.h

Thanks for the review.

>> +	__ARM_ARCH_7_A__.
>> +
>>
>>
> 
> No, this will:
> 1) Do the wrong thing for Cortex-a7, A12 and A15 (which all have HW
> divide, and currently define __ARM_ARCH_7_A__).
> 2) Do the wrong thing for v7-M and v7-R devices, which have Thumb HW
> division instructions.
> 3) Do the wrong thing for all pre-v7 devices, which don't have HW division.
> 
> I think the correct solution is to test !defined(__ARM_ARCH_EXT_IDIV__)

I understand it now and updated the code as attached.

+2013-11-27  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+	* config/arm/bpapi-lib.h (TARGET_HAS_NO_HW_DIVIDE): Define for
+	architectures that does not have hardware divide instruction.
+	i.e. architectures that does not define __ARM_ARCH_EXT_IDIV__.
+


Is this OK for trunk now?
Thanks,
Kugan

Comments

Kugan Vivekanandarajah Dec. 3, 2013, 6:39 a.m. UTC | #1
ping

Thanks,
Kugan

On 27/11/13 15:30, Kugan wrote:
> On 27/11/13 02:07, Richard Earnshaw wrote:
>> On 23/11/13 01:54, Kugan wrote:
> 
> [snip]
> 
>>> +2013-11-22  Kugan Vivekanandarajah  <kuganv@linaro.org>
>>> +
>>> +	* libgcc/config/arm/pbapi-lib.h (HAVE_NO_HW_DIVIDE): Define for
>>
>> It's bpabi-lib.h
> 
> Thanks for the review.
> 
>>> +	__ARM_ARCH_7_A__.
>>> +
>>>
>>>
>>
>> No, this will:
>> 1) Do the wrong thing for Cortex-a7, A12 and A15 (which all have HW
>> divide, and currently define __ARM_ARCH_7_A__).
>> 2) Do the wrong thing for v7-M and v7-R devices, which have Thumb HW
>> division instructions.
>> 3) Do the wrong thing for all pre-v7 devices, which don't have HW division.
>>
>> I think the correct solution is to test !defined(__ARM_ARCH_EXT_IDIV__)
> 
> I understand it now and updated the code as attached.
> 
> +2013-11-27  Kugan Vivekanandarajah  <kuganv@linaro.org>
> +
> +	* config/arm/bpapi-lib.h (TARGET_HAS_NO_HW_DIVIDE): Define for
> +	architectures that does not have hardware divide instruction.
> +	i.e. architectures that does not define __ARM_ARCH_EXT_IDIV__.
> +
> 
> 
> Is this OK for trunk now?
> Thanks,
> Kugan
>
Ian Lance Taylor Dec. 3, 2013, 2:50 p.m. UTC | #2
On Mon, Dec 2, 2013 at 10:39 PM, Kugan
<kugan.vivekanandarajah@linaro.org> wrote:
> ping

This patch needs to be approved by an ARM maintainer.

Ian

> On 27/11/13 15:30, Kugan wrote:
>> On 27/11/13 02:07, Richard Earnshaw wrote:
>>> On 23/11/13 01:54, Kugan wrote:
>>
>> [snip]
>>
>>>> +2013-11-22  Kugan Vivekanandarajah  <kuganv@linaro.org>
>>>> +
>>>> +   * libgcc/config/arm/pbapi-lib.h (HAVE_NO_HW_DIVIDE): Define for
>>>
>>> It's bpabi-lib.h
>>
>> Thanks for the review.
>>
>>>> +   __ARM_ARCH_7_A__.
>>>> +
>>>>
>>>>
>>>
>>> No, this will:
>>> 1) Do the wrong thing for Cortex-a7, A12 and A15 (which all have HW
>>> divide, and currently define __ARM_ARCH_7_A__).
>>> 2) Do the wrong thing for v7-M and v7-R devices, which have Thumb HW
>>> division instructions.
>>> 3) Do the wrong thing for all pre-v7 devices, which don't have HW division.
>>>
>>> I think the correct solution is to test !defined(__ARM_ARCH_EXT_IDIV__)
>>
>> I understand it now and updated the code as attached.
>>
>> +2013-11-27  Kugan Vivekanandarajah  <kuganv@linaro.org>
>> +
>> +     * config/arm/bpapi-lib.h (TARGET_HAS_NO_HW_DIVIDE): Define for
>> +     architectures that does not have hardware divide instruction.
>> +     i.e. architectures that does not define __ARM_ARCH_EXT_IDIV__.
>> +
>>
>>
>> Is this OK for trunk now?
>> Thanks,
>> Kugan
>>
>
Jeff Law Dec. 3, 2013, 7:47 p.m. UTC | #3
On 12/02/13 23:39, Kugan wrote:
>>
>> +2013-11-27  Kugan Vivekanandarajah  <kuganv@linaro.org>
>> +
>> +	* config/arm/bpapi-lib.h (TARGET_HAS_NO_HW_DIVIDE): Define for
>> +	architectures that does not have hardware divide instruction.
>> +	i.e. architectures that does not define __ARM_ARCH_EXT_IDIV__.
>> +
>>
>>
>> Is this OK for trunk now?
Yes, this part is fine too.  AFAICT, it just implements what Richard E. 
suggested ;-)

jeff
Christophe Lyon Dec. 4, 2013, 11:35 a.m. UTC | #4
Committed on Kugan's behalf as rev 205666.

Christophe.


On 3 December 2013 20:47, Jeff Law <law@redhat.com> wrote:
> On 12/02/13 23:39, Kugan wrote:
>>>
>>>
>>> +2013-11-27  Kugan Vivekanandarajah  <kuganv@linaro.org>
>>> +
>>> +       * config/arm/bpapi-lib.h (TARGET_HAS_NO_HW_DIVIDE): Define for
>>> +       architectures that does not have hardware divide instruction.
>>> +       i.e. architectures that does not define __ARM_ARCH_EXT_IDIV__.
>>> +
>>>
>>>
>>> Is this OK for trunk now?
>
> Yes, this part is fine too.  AFAICT, it just implements what Richard E.
> suggested ;-)
>
> jeff
diff mbox

Patch

diff --git a/libgcc/config/arm/bpabi-lib.h b/libgcc/config/arm/bpabi-lib.h
index e0e46a6..7c6b489 100644
--- a/libgcc/config/arm/bpabi-lib.h
+++ b/libgcc/config/arm/bpabi-lib.h
@@ -75,3 +75,7 @@ 
    helper functions - not everything in libgcc - in the interests of
    maintaining backward compatibility.  */
 #define LIBGCC2_FIXEDBIT_GNU_PREFIX
+
+#if (!defined(__ARM_ARCH_EXT_IDIV__))
+# define TARGET_HAS_NO_HW_DIVIDE
+#endif