[PATCH] D31716: [Builtins] Fix div0 error in udivsi3

Weiming Zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 10:11:53 PDT 2017


weimingz created this revision.

Need to save `lr` before bl to aeabi_div0


https://reviews.llvm.org/D31716

Files:
  lib/builtins/arm/udivsi3.S


Index: lib/builtins/arm/udivsi3.S
===================================================================
--- lib/builtins/arm/udivsi3.S
+++ lib/builtins/arm/udivsi3.S
@@ -186,9 +186,12 @@
 LOCAL_LABEL(divby0):
 	movs	r0, #0
 #      if defined(__ARM_EABI__)
+	push {r6, lr}
 	bl	__aeabi_idiv0 // due to relocation limit, can't use b.
-#      endif
+	pop  {r6, pc}
+#      else
 	JMP(lr)
+#      endif
 
 
 #if __ARM_ARCH_ISA_THUMB == 1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31716.94254.patch
Type: text/x-patch
Size: 432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170405/3ed2a3be/attachment.bin>


More information about the llvm-commits mailing list