[PATCH] Improved udivmodsi4 with support for ARMv4

Joerg Sonnenberger joerg at NetBSD.org
Fri Jan 24 01:03:55 PST 2014



================
Comment at: lib/arm/udivmodsi4.S:22
@@ +21,3 @@
+#else
+#define	JMP(r)	mov	pc, r
+#endif
----------------
Saleem Abdulrasool wrote:
> bx is supported as of ARMv4T, I take it that you want to support pre-T versions of ARMv4?
Correct.

================
Comment at: lib/arm/udivmodsi4.S:59
@@ +58,3 @@
+#  ifdef __ARM_FEATURE_CLZ
+	clz	ip, r0
+	clz	r3, r1
----------------
Saleem Abdulrasool wrote:
> I think adding a reminder that due to the previous comparison, r0 >= r1 will hold would be nice.
That's what line 61 is about.

================
Comment at: lib/arm/udivmodsi4.S:111
@@ +110,3 @@
+
+	block(31)
+	block(30)
----------------
Saleem Abdulrasool wrote:
> Can you please rewrite the loop unrolling as:
> 
>     .macro block shift
>       cmp r0, r1, lsl # \shift
>       addhs r3, r3, #(1 << \shift)
>       subhs r0, r0, r1, lsl # \shift
>     .endm
> 
>     .Lround = 31
>     .rept 31
>       block .Lround
>       .Lround = .Lround - 1
>     .endr
>     LOCAL_LABEL(div0block):
>       block 0
> 
> The net effect is identical, but it is much simpler to maintain IMO.
GAS macros should burn in hell, so I disagree on this.

================
Comment at: lib/arm/udivsi3.S:1
@@ -1,2 +1,2 @@
-/*===-- udivsi3.S - 32-bit unsigned integer divide ------------------------===//
+/*===-- udivmodsi4.S - 32-bit unsigned integer divide and modulus ---------===//
  *
----------------
Saleem Abdulrasool wrote:
> I think that this update is incorrect.
Copy editing error. Fixed locally as well as the same issue in umodsi3.S.


http://llvm-reviews.chandlerc.com/D2595



More information about the llvm-commits mailing list