--
--      Inmos Libraries
--      Copyright (C) 1988, 1989, 1990, 1991, 1993  Inmos Limited
--
--      This library is free software; you can redistribute it and/or
--      modify it under the terms of the GNU Lesser General Public
--      License as published by the Free Software Foundation; either
--      version 2 of the License, or (at your option) any later version.
--
--      This library is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--      Lesser General Public License for more details.
--
--      You should have received a copy of the GNU Lesser General Public
--      License along with this library; if not, write to the Free Software
--      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
--

--** @module forall

#IF (TARGET.BITS.PER.WORD = 16)

--{{{  #options and #comments
#OPTION "E V"  -- no compiler libs, no vector space
#COMMENT "Support routines library, V1.1 21/02/89"
#COMMENT "(c) Copyright INMOS Limited 1988"
--}}}

#PRAGMA TRANSLATE QUADSHIFTLEFT "QUADSHIFTLEFT%CHK"

#INCLUDE "realvals.inc"

--{{{  QUADSHIFTLEFT -- T2
PROC QUADSHIFTLEFT ([4]INT X.out, INT Guard.out, VAL [4]INT X.in,
                    VAL INT Guard.in, Places)

  -- Function version (10 Jun 87)

  INT carry, bits :
  SEQ
    IF
      Places < BitsPerWord
        SEQ
          X.out[3],  carry := SHIFTLEFT ( X.in[3],  X.in[2],  Places)
          X.out[2],  carry := SHIFTLEFT ( X.in[2],  X.in[1],  Places)
          X.out[1],  carry := SHIFTLEFT ( X.in[1],  X.in[0],  Places)
          X.out[0],  Guard.out := SHIFTLEFT ( X.in[0],  Guard.in,  Places)
      Places < (BitsPerWord * 2)
        SEQ
          bits := Places - BitsPerWord
          X.out[3],  carry := SHIFTLEFT ( X.in[2],  X.in[1],  bits)
          X.out[2],  carry := SHIFTLEFT ( X.in[1],  X.in[0],  bits)
          X.out[1],  X.out[0] := SHIFTLEFT ( X.in[0],  Guard.in,  bits)
          Guard.out := 0
      Places < (BitsPerWord * 3)
        SEQ
          bits := Places - (BitsPerWord * 2)
          X.out[3],  carry := SHIFTLEFT ( X.in[1],  X.in[0],  bits)
          X.out[2],  X.out[1] := SHIFTLEFT ( X.in[0],  Guard.in,  bits)
          X.out[0] := 0
          Guard.out := 0
      Places < (BitsPerWord * 5)
        SEQ
          bits := Places - (BitsPerWord * 3)
          X.out[3],  X.out[2] := SHIFTLEFT ( X.in[0],  Guard.in,  bits)
          X.out[1] := 0
          X.out[0] := 0
          Guard.out := 0
      TRUE
        SEQ
          X.out[3] := 0
          X.out[2] := 0
          X.out[1] := 0
          X.out[0] := 0
          Guard.out := 0
:
--}}}

#ENDIF
