X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=cpu%2Ffrv.cpu;h=893592427dce4553925bcfd00d4550e7f29709e4;hb=c7c7219d3a06a714e04e73ebd029811e6bd5bd37;hp=8f00c002ac3775121f3bc23ac2539dc9fb893f04;hpb=90219bd0f3e7ff1b4988da0ae32a14f813f7cacc;p=binutils-gdb.git diff --git a/cpu/frv.cpu b/cpu/frv.cpu index 8f00c002ac3..893592427dc 100644 --- a/cpu/frv.cpu +++ b/cpu/frv.cpu @@ -1,6 +1,6 @@ ; Fujitsu FRV opcode support, for GNU Binutils. -*- Scheme -*- ; -; Copyright 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +; Copyright 2000, 2001, 2003, 2004, 2007, 2009 Free Software Foundation, Inc. ; ; Contributed by Red Hat Inc; developed under contract from Fujitsu. ; @@ -8,7 +8,7 @@ ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by -; the Free Software Foundation; either version 2 of the License, or +; the Free Software Foundation; either version 3 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, @@ -18,7 +18,8 @@ ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software -; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +; MA 02110-1301, USA. (include "simplify.inc") @@ -2808,12 +2809,21 @@ (dbmr20 2084) (dbmr21 2085) (dbmr22 2086) (dbmr23 2087) (dbmr30 2088) (dbmr31 2089) (dbmr32 2090) (dbmr33 2091) - (cpcfr 2092) (cpcr 2093) (cpsr 2094) + (cpcfr 2304) (cpcr 2305) (cpsr 2306) (cptr 2307) + (cphsr0 2308) (cphsr1 2309) (cpesr0 2320) (cpesr1 2321) + (cpemr0 2322) (cpemr1 2323) - (cpesr0 2096) (cpesr1 2097) - (cpemr0 2098) (cpemr1 2099) + (iperr0 2324) (iperr1 2325) (ipjsr 2326) (ipjrr 2327) + (ipcsr0 2336) (ipcsr1 2337) (ipcwer0 2338) (ipcwer1 2339) + (ipcwr 2340) - (ihsr8 3848) + (mbhsr 2352) (mbssr 2353) (mbrsr 2354) (mbsdr 2355) + (mbrdr 2356) (mbsmr 2357) (mbstr0 2359) (mbstr1 2360) + + (slpr 2368) (sldr 2369) (slhsr 2370) (sltr 2371) + (slwr 2372) + + (ihsr8 3848) (ihsr9 3849) (ihsr10 3850) ) ) @@ -8219,18 +8229,28 @@ (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) (set arghi (halfword hi FRintj 0)) (set arglo (halfword lo FRintj 0)) - (saturate-v (abs arghi) 32767 -32768 (msr-sie-fri-hi) + ; We extend the argument before the abs operation so we can + ; notice -32768 overflowing as 32768. + (saturate-v (abs (ext DI arghi)) 32767 -32768 (msr-sie-fri-hi) (halfword hi FRintk 0)) - (saturate-v (abs arglo) 32767 -32768 (msr-sie-fri-lo) + (saturate-v (abs (ext DI arglo)) 32767 -32768 (msr-sie-fri-lo) (halfword lo FRintk 0))) ((fr400 (unit u-media-1)) (fr450 (unit u-media-1)) (fr550 (unit u-media))) ) +; How to extend from a mode to get the intended signedness. +(define-pmacro (DI-ext-HI x) (ext DI x)) +(define-pmacro (DI-ext-UHI x) (zext DI x)) +(define-pmacro (DI-ext-DI x) x) + (define-pmacro (media-arith-sat-semantics operation arg1 arg2 res mode max min sie) (sequence ((DI tmp)) - (set tmp (operation arg1 arg2)) + ; Make sure we saturate at max/min against a value that is + ; sign- or zero-extended appropriately from "mode". + (set tmp (operation DI + ((.sym DI-ext- mode) arg1) ((.sym DI-ext- mode) arg2))) (saturate-v tmp max min sie res)) )