divmodqi.S: Return 0x00 by default for div by 0.
authorKaushik Phatak <kaushik.phatak@kpit.com>
Fri, 16 Oct 2015 21:47:07 +0000 (21:47 +0000)
committerDJ Delorie <dj@gcc.gnu.org>
Fri, 16 Oct 2015 21:47:07 +0000 (17:47 -0400)
* config/rl78/divmodqi.S: Return 0x00 by default for div by 0.
* config/rl78/divmodsi.S: Update return register to r8.
* config/rl78/divmodhi.S: Update return register to r8,r9.
Branch to main_loop_done_himode to pop registers before return.

From-SVN: r228926

libgcc/ChangeLog
libgcc/config/rl78/divmodhi.S
libgcc/config/rl78/divmodqi.S
libgcc/config/rl78/divmodsi.S

index 8676747211c4d447b011f4b6a17380f426761b38..d63a1716367626c3a194247c46bb777f0889a880 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-16  Kaushik Phatak  <kaushik.phatak@kpit.com>
+
+       * config/rl78/divmodqi.S: Return 0x00 by default for div by 0.
+       * config/rl78/divmodsi.S: Update return register to r8.
+       * config/rl78/divmodhi.S: Update return register to r8,r9.
+       Branch to main_loop_done_himode to pop registers before return.
+
 2015-10-09  Venkataramanan kumar <venkataramanan.kumar@amd.com>
 
        * config/i386/cpuinfo.c (get_amd_cpu): Detect bdver4.
index adf91e2c9e624ea820a44a226dc54a3045c7ce60..4340f1828e5d0a1353c89f13ae032e9da7e096cb 100644 (file)
@@ -454,7 +454,11 @@ __generic_himod:
        movw    ax, den
        cmpw    ax, #0
        bnz     $den_not_zero\which
+       .if \need_result
+       movw    quot, #0
+       .else
        movw    num, #0
+       .endif
        ret
 
 den_not_zero\which:
index b505336bee0d9af2b1f08b007c6dcf169a9a6ea6..667923809fb0f2a3d77b7214afae17e9ee4a5510 100644 (file)
@@ -63,7 +63,7 @@ num_eq_den\which:
        ret
        
 den_is_zero\which:
-       mov     r8, #0xff
+       mov     r8, #0x00
        ret
 
        ;; These routines leave DE alone - the signed functions use DE
index 987a9e31126a79729aefdefb584e95b8e29fb2f8..94bad1e6ca0764f92711149d49bb68fcf9e3014a 100644 (file)
@@ -688,9 +688,14 @@ __generic_simod:
        or      a, denB3        ; not x
        cmpw    ax, #0
        bnz     $den_not_zero\which
+       .if \need_result
+       movw    quotL, #0
+       movw    quotH, #0
+       .else
        movw    numL, #0
        movw    numH, #0
-       ret
+       .endif
+       br      $!main_loop_done_himode\which
 
 den_not_zero\which:
        .if \need_result