From 2aa2fd0a3da3a71252f3964d07c5d982b753f1ad Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 20 Nov 2002 03:14:19 +0000 Subject: [PATCH] * cpu/xstormy16.cpu (sdiv, divlh, sdivlh): New. --- ChangeLog | 4 ++++ cpu/xstormy16.cpu | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c4b9d72..a6728a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-11-19 DJ Delorie + + * cpu/xstormy16.cpu (sdiv, divlh, sdivlh): New. + 2002-11-05 Frank Ch. Eigler * dev.scm: Call getenv with a string, not a symbol. diff --git a/cpu/xstormy16.cpu b/cpu/xstormy16.cpu index b6bfd77..abc0097 100644 --- a/cpu/xstormy16.cpu +++ b/cpu/xstormy16.cpu @@ -1,5 +1,5 @@ ; xstormy16 CPU core description. -*- Scheme -*- -; Copyright (C) 2001 Red Hat, Inc. +; Copyright (C) 2001, 2002 Red Hat, Inc. ; This file is part of CGEN. ; See file COPYING.CGEN for details. @@ -1838,6 +1838,38 @@ (set-mem-psw R0 (udiv R0 R2))) () ) +(dni sdiv + "Signed Divide" + () + ("sdiv") + (+ (f-op #x00C8)) + (sequence () + (set R1 (mod HI R0 R2)) + (set-mem-psw R0 (div HI R0 R2))) + () +) +(dni sdivlh + "Divide 32/16" + () + ("sdivlh") + (+ (f-op #x00E0)) + (sequence ((SI value)) + (set value (add SI (sll SI (and SI R1 #xffff) #x10) (and SI R0 #xffff))) + (set R1 (mod SI value (ext SI (trunc HI R2)))) + (set-mem-psw R0 (div SI value (ext SI (trunc HI R2))))) + () +) +(dni divlh + "Divide 32/16" + () + ("divlh") + (+ (f-op #x00E8)) + (sequence ((SI value)) + (set value (add SI (sll SI (and SI R1 #xffff) #x10) (and SI R0 #xffff))) + (set R1 (umod SI value R2)) + (set-mem-psw R0 (udiv SI value R2))) + () +) ; System Control -- 2.43.5