[PATCH] D12089: Implement __aeabi_c{d,f}{cmpeq,cmple,rcmple}.

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 10:41:29 PDT 2015


compnerd added inline comments.

================
Comment at: lib/builtins/arm/aeabi_cdcmp.S:44
@@ +43,3 @@
+        pop {lr}
+        b __aeabi_cdcmple
+END_COMPILERRT_FUNCTION(__aeabi_cdcmpeq)
----------------
jmgao wrote:
> compnerd wrote:
> > Wouldn't this be shorter as:
> > 
> >     __aeabi_cdcmpeq:
> >         push {r0-r3}
> >         blx __aeabi_cdcmpeq_check_nan
> >         cmp r0, #1
> >         pop {r0-r3}
> >         beq __aeabi_cdcmple
> >         msr CPSR_f, #APSR_C
> >         bx lr
> Yes it would, except {r0-r3, lr} for the push/pop since the call to __aeabi_cdcmpeq_check_nan will trash lr.
Ah, right.

================
Comment at: lib/builtins/arm/aeabi_cdcmp.S:75
@@ +74,3 @@
+        // Restore the argument registers
+        pop {r0, r1, r2, r3}
+
----------------
jmgao wrote:
> How about this?
> 
> ```
> __aeabi_cdcmple:
>     push {r0-r4, lr}
> 
>     bl __aeabi_dcmplt
>     cmp r0, #1
>     moveq r4, #0
>     beq 1f
> 
>     ldm sp, {r0-r3}
>     bl __aeabi_dcmpeq
>     cmp r0, #1
>     moveq r4, #(APSR_C | APSR_Z)
>     movne r4, #(APSR_C)
> 1:
>     msr CPSR_f, r4
>     pop {r0-r4, pc} 
> ```
I like the idea of the moveq/movne ... though, Im not sure I understand the purpose of using r4 rather than ip which is already a scratch register.  The pop {pc} has the issue that Renato pointed out wrt older chips, (the stack savings are probably not important).


http://reviews.llvm.org/D12089





More information about the llvm-commits mailing list