summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorforeese <foreese@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-03 14:55:26 +0000
committerforeese <foreese@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-03 14:55:26 +0000
commit278b4698e4abfa5ce80b40960db595dbf28ac488 (patch)
tree2f17abc1e7e1eb41d4214cc06d7bc3d073ff0b98
parent860c3c853dccac3428d411994085aaf3abb0d8be (diff)
downloadgcc-278b4698e4abfa5ce80b40960db595dbf28ac488.tar.gz
2016-08-03 Fritz Reese <fritzoreese@gmail.com>
gcc/fortran/ * lang.opt: New option -fdec-intrinsic-ints. * options.c (set_dec_flags): Enable with -fdec. * gfortran.texi, invoke.texi, intrinsics.texi: Update documentation. * intrinsic.c (add_function, add_subroutine): New B/I/J/K intrinsic variants. gcc/testsuite/gfortran.dg/ * dec_intrinsic_ints.f90: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239078 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/gfortran.texi53
-rw-r--r--gcc/fortran/intrinsic.c111
-rw-r--r--gcc/fortran/intrinsic.texi201
-rw-r--r--gcc/fortran/invoke.texi9
-rw-r--r--gcc/fortran/lang.opt4
-rw-r--r--gcc/fortran/options.c1
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90165
9 files changed, 542 insertions, 14 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d39bd9a1cfc..04726bb5dc1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2016-08-03 Fritz Reese <fritzoreese@gmail.com>
+
+ * lang.opt: New option -fdec-intrinsic-ints.
+ * options.c (set_dec_flags): Enable with -fdec.
+ * gfortran.texi, invoke.texi, intrinsics.texi: Update documentation.
+ * intrinsic.c (add_function, add_subroutine): New B/I/J/K intrinsic
+ variants.
+
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/41922
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index cc80204b793..b34ae86b741 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1461,6 +1461,7 @@ without warning.
* Read/Write after EOF marker::
* STRUCTURE and RECORD::
* UNION and MAP::
+* Type variants for integer intrinsics::
@end menu
@node Old-style kind specifications
@@ -2367,6 +2368,58 @@ a.h === '.C'
a.l === '.D'
@end example
+@node Type variants for integer intrinsics
+@subsection Type variants for integer intrinsics
+@cindex intrinsics, integer
+
+Similar to the D/C prefixes to real functions to specify the input/output
+types, GNU Fortran offers B/I/J/K prefixes to integer functions for
+compatibility with DEC programs. The types implied by each are:
+
+@example
+@code{B} - @code{INTEGER(kind=1)}
+@code{I} - @code{INTEGER(kind=2)}
+@code{J} - @code{INTEGER(kind=4)}
+@code{K} - @code{INTEGER(kind=8)}
+@end example
+
+GNU Fortran supports these with the flag @option{-fdec-intrinsic-ints}.
+Intrinsics for which prefixed versions are available and in what form are noted
+in @ref{Intrinsic Procedures}. The complete list of supported intrinsics is
+here:
+
+@multitable @columnfractions .2 .2 .2 .2 .2
+
+@headitem Intrinsic @tab B @tab I @tab J @tab K
+
+@item @code{@ref{ABS}}
+ @tab @code{BABS} @tab @code{IIABS} @tab @code{JIABS} @tab @code{KIABS}
+@item @code{@ref{BTEST}}
+ @tab @code{BBTEST} @tab @code{BITEST} @tab @code{BJTEST} @tab @code{BKTEST}
+@item @code{@ref{IAND}}
+ @tab @code{BIAND} @tab @code{IIAND} @tab @code{JIAND} @tab @code{KIAND}
+@item @code{@ref{IBCLR}}
+ @tab @code{BBCLR} @tab @code{IIBCLR} @tab @code{JIBCLR} @tab @code{KIBCLR}
+@item @code{@ref{IBITS}}
+ @tab @code{BBITS} @tab @code{IIBITS} @tab @code{JIBITS} @tab @code{KIBITS}
+@item @code{@ref{IBSET}}
+ @tab @code{BBSET} @tab @code{IIBSET} @tab @code{JIBSET} @tab @code{KIBSET}
+@item @code{@ref{IEOR}}
+ @tab @code{BIEOR} @tab @code{IIEOR} @tab @code{JIEOR} @tab @code{KIEOR}
+@item @code{@ref{IOR}}
+ @tab @code{BIOR} @tab @code{IIOR} @tab @code{JIOR} @tab @code{KIOR}
+@item @code{@ref{ISHFT}}
+ @tab @code{BSHFT} @tab @code{IISHFT} @tab @code{JISHFT} @tab @code{KISHFT}
+@item @code{@ref{ISHFTC}}
+ @tab @code{BSHFTC} @tab @code{IISHFTC} @tab @code{JISHFTC} @tab @code{KISHFTC}
+@item @code{@ref{MOD}}
+ @tab @code{BMOD} @tab @code{IMOD} @tab @code{JMOD} @tab @code{KMOD}
+@item @code{@ref{NOT}}
+ @tab @code{BNOT} @tab @code{INOT} @tab @code{JNOT} @tab @code{KNOT}
+@item @code{@ref{REAL}}
+ @tab @code{--} @tab @code{FLOATI} @tab @code{FLOATJ} @tab @code{FLOATK}
+@end multitable
+
@node Extensions not implemented in GNU Fortran
@section Extensions not implemented in GNU Fortran
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 1d7503dc9fd..ca28eac8cf7 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -1255,6 +1255,14 @@ add_functions (void)
gfc_check_abs, gfc_simplify_abs, gfc_resolve_abs,
a, BT_REAL, dr, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("babs", GFC_STD_GNU);
+ make_alias ("iiabs", GFC_STD_GNU);
+ make_alias ("jiabs", GFC_STD_GNU);
+ make_alias ("kiabs", GFC_STD_GNU);
+ }
+
add_sym_1 ("iabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER, di, GFC_STD_F77,
NULL, gfc_simplify_abs, gfc_resolve_abs,
a, BT_INTEGER, di, REQUIRED);
@@ -1557,6 +1565,14 @@ add_functions (void)
gfc_check_bitfcn, gfc_simplify_btest, gfc_resolve_btest,
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bbtest", GFC_STD_GNU);
+ make_alias ("bitest", GFC_STD_GNU);
+ make_alias ("bjtest", GFC_STD_GNU);
+ make_alias ("bktest", GFC_STD_GNU);
+ }
+
make_generic ("btest", GFC_ISYM_BTEST, GFC_STD_F95);
add_sym_2 ("ceiling", GFC_ISYM_CEILING, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
@@ -1950,6 +1966,14 @@ add_functions (void)
gfc_check_iand, gfc_simplify_iand, gfc_resolve_iand,
i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("biand", GFC_STD_GNU);
+ make_alias ("iiand", GFC_STD_GNU);
+ make_alias ("jiand", GFC_STD_GNU);
+ make_alias ("kiand", GFC_STD_GNU);
+ }
+
make_generic ("iand", GFC_ISYM_IAND, GFC_STD_F95);
add_sym_2 ("and", GFC_ISYM_AND, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
@@ -1981,6 +2005,14 @@ add_functions (void)
gfc_check_bitfcn, gfc_simplify_ibclr, gfc_resolve_ibclr,
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bbclr", GFC_STD_GNU);
+ make_alias ("iibclr", GFC_STD_GNU);
+ make_alias ("jibclr", GFC_STD_GNU);
+ make_alias ("kibclr", GFC_STD_GNU);
+ }
+
make_generic ("ibclr", GFC_ISYM_IBCLR, GFC_STD_F95);
add_sym_3 ("ibits", GFC_ISYM_IBITS, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
@@ -1988,12 +2020,28 @@ add_functions (void)
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED,
ln, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bbits", GFC_STD_GNU);
+ make_alias ("iibits", GFC_STD_GNU);
+ make_alias ("jibits", GFC_STD_GNU);
+ make_alias ("kibits", GFC_STD_GNU);
+ }
+
make_generic ("ibits", GFC_ISYM_IBITS, GFC_STD_F95);
add_sym_2 ("ibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
gfc_check_bitfcn, gfc_simplify_ibset, gfc_resolve_ibset,
i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bbset", GFC_STD_GNU);
+ make_alias ("iibset", GFC_STD_GNU);
+ make_alias ("jibset", GFC_STD_GNU);
+ make_alias ("kibset", GFC_STD_GNU);
+ }
+
make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95);
add_sym_2 ("ichar", GFC_ISYM_ICHAR, CLASS_ELEMENTAL, ACTUAL_NO,
@@ -2007,6 +2055,14 @@ add_functions (void)
gfc_check_ieor, gfc_simplify_ieor, gfc_resolve_ieor,
i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bieor", GFC_STD_GNU);
+ make_alias ("iieor", GFC_STD_GNU);
+ make_alias ("jieor", GFC_STD_GNU);
+ make_alias ("kieor", GFC_STD_GNU);
+ }
+
make_generic ("ieor", GFC_ISYM_IEOR, GFC_STD_F95);
add_sym_2 ("xor", GFC_ISYM_XOR, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
@@ -2072,6 +2128,14 @@ add_functions (void)
gfc_check_ior, gfc_simplify_ior, gfc_resolve_ior,
i, BT_INTEGER, di, REQUIRED, j, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bior", GFC_STD_GNU);
+ make_alias ("iior", GFC_STD_GNU);
+ make_alias ("jior", GFC_STD_GNU);
+ make_alias ("kior", GFC_STD_GNU);
+ }
+
make_generic ("ior", GFC_ISYM_IOR, GFC_STD_F95);
add_sym_2 ("or", GFC_ISYM_OR, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
@@ -2139,6 +2203,14 @@ add_functions (void)
gfc_check_ishft, gfc_simplify_ishft, gfc_resolve_ishft,
i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bshft", GFC_STD_GNU);
+ make_alias ("iishft", GFC_STD_GNU);
+ make_alias ("jishft", GFC_STD_GNU);
+ make_alias ("kishft", GFC_STD_GNU);
+ }
+
make_generic ("ishft", GFC_ISYM_ISHFT, GFC_STD_F95);
add_sym_3 ("ishftc", GFC_ISYM_ISHFTC, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95,
@@ -2146,6 +2218,14 @@ add_functions (void)
i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED,
sz, BT_INTEGER, di, OPTIONAL);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bshftc", GFC_STD_GNU);
+ make_alias ("iishftc", GFC_STD_GNU);
+ make_alias ("jishftc", GFC_STD_GNU);
+ make_alias ("kishftc", GFC_STD_GNU);
+ }
+
make_generic ("ishftc", GFC_ISYM_ISHFTC, GFC_STD_F95);
add_sym_2 ("kill", GFC_ISYM_KILL, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
@@ -2456,6 +2536,14 @@ add_functions (void)
gfc_check_a_p, gfc_simplify_mod, gfc_resolve_mod,
a, BT_INTEGER, di, REQUIRED, p, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bmod", GFC_STD_GNU);
+ make_alias ("imod", GFC_STD_GNU);
+ make_alias ("jmod", GFC_STD_GNU);
+ make_alias ("kmod", GFC_STD_GNU);
+ }
+
add_sym_2 ("amod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77,
NULL, gfc_simplify_mod, gfc_resolve_mod,
a, BT_REAL, dr, REQUIRED, p, BT_REAL, dr, REQUIRED);
@@ -2498,6 +2586,14 @@ add_functions (void)
gfc_check_i, gfc_simplify_not, gfc_resolve_not,
i, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bnot", GFC_STD_GNU);
+ make_alias ("inot", GFC_STD_GNU);
+ make_alias ("jnot", GFC_STD_GNU);
+ make_alias ("knot", GFC_STD_GNU);
+ }
+
make_generic ("not", GFC_ISYM_NOT, GFC_STD_F95);
add_sym_2 ("norm2", GFC_ISYM_NORM2, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr,
@@ -2608,6 +2704,13 @@ add_functions (void)
gfc_check_float, gfc_simplify_float, NULL,
a, BT_INTEGER, di, REQUIRED);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("floati", GFC_STD_GNU);
+ make_alias ("floatj", GFC_STD_GNU);
+ make_alias ("floatk", GFC_STD_GNU);
+ }
+
add_sym_1 ("dfloat", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU,
gfc_check_float, gfc_simplify_dble, gfc_resolve_dble,
a, BT_REAL, dr, REQUIRED);
@@ -3306,6 +3409,14 @@ add_subroutines (void)
t, BT_INTEGER, di, REQUIRED, INTENT_INOUT,
tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
+ if (flag_dec_intrinsic_ints)
+ {
+ make_alias ("bmvbits", GFC_STD_GNU);
+ make_alias ("imvbits", GFC_STD_GNU);
+ make_alias ("jmvbits", GFC_STD_GNU);
+ make_alias ("kmvbits", GFC_STD_GNU);
+ }
+
add_sym_1s ("random_number", GFC_ISYM_RANDOM_NUMBER, CLASS_IMPURE,
BT_UNKNOWN, 0, GFC_STD_F95,
gfc_check_random_number, NULL, gfc_resolve_random_number,
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 88406301d9f..ae5d814004f 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -401,6 +401,10 @@ end program test_abort
@fnindex IABS
@fnindex ZABS
@fnindex CDABS
+@fnindex BABS
+@fnindex IIABS
+@fnindex JIABS
+@fnindex KIABS
@cindex absolute value
@table @asis
@@ -446,6 +450,10 @@ end program test_abs
@item @code{CABS(A)} @tab @code{COMPLEX(4) A} @tab @code{REAL(4)} @tab Fortran 77 and later
@item @code{DABS(A)} @tab @code{REAL(8) A} @tab @code{REAL(8)} @tab Fortran 77 and later
@item @code{IABS(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab Fortran 77 and later
+@item @code{BABS(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIABS(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIABS(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIABS(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
@item @code{ZABS(A)} @tab @code{COMPLEX(8) A} @tab @code{COMPLEX(8)} @tab GNU extension
@item @code{CDABS(A)} @tab @code{COMPLEX(8) A} @tab @code{COMPLEX(8)} @tab GNU extension
@end multitable
@@ -2666,6 +2674,10 @@ The return value is of type @code{LOGICAL} and of the default kind.
@node BTEST
@section @code{BTEST} --- Bit test function
@fnindex BTEST
+@fnindex BBTEST
+@fnindex BITEST
+@fnindex BJTEST
+@fnindex BKTEST
@cindex bits, testing
@table @asis
@@ -2674,7 +2686,7 @@ The return value is of type @code{LOGICAL} and of the default kind.
in @var{I} is set. The counting of the bits starts at 0.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -2703,8 +2715,17 @@ program test_btest
end do
end program test_btest
@end smallexample
-@end table
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{BTEST(I,POS)} @tab @code{INTEGER I,POS} @tab @code{LOGICAL} @tab F95 and later
+@item @code{BBTEST(I,POS)} @tab @code{INTEGER(1) I,POS} @tab @code{LOGICAL(1)} @tab GNU extension
+@item @code{BITEST(I,POS)} @tab @code{INTEGER(2) I,POS} @tab @code{LOGICAL(2)} @tab GNU extension
+@item @code{BJTEST(I,POS)} @tab @code{INTEGER(4) I,POS} @tab @code{LOGICAL(4)} @tab GNU extension
+@item @code{BKTEST(I,POS)} @tab @code{INTEGER(8) I,POS} @tab @code{LOGICAL(8)} @tab GNU extension
+@end multitable
+@end table
@node C_ASSOCIATED
@section @code{C_ASSOCIATED} --- Status of a C pointer
@@ -6972,6 +6993,10 @@ END PROGRAM
@node IAND
@section @code{IAND} --- Bitwise logical and
@fnindex IAND
+@fnindex BIAND
+@fnindex IIAND
+@fnindex JIAND
+@fnindex KIAND
@cindex bitwise logical and
@cindex logical and, bitwise
@@ -6980,7 +7005,7 @@ END PROGRAM
Bitwise logical @code{AND}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7010,6 +7035,16 @@ PROGRAM test_iand
END PROGRAM
@end smallexample
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{IAND(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BIAND(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIAND(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIAND(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIAND(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
@@ -7124,6 +7159,10 @@ Fortran 2003 functions and subroutines: @ref{GET_COMMAND},
@node IBCLR
@section @code{IBCLR} --- Clear bit
@fnindex IBCLR
+@fnindex BBCLR
+@fnindex IIBCLR
+@fnindex JIBCLR
+@fnindex KIBCLR
@cindex bits, unset
@cindex bits, clear
@@ -7133,7 +7172,7 @@ Fortran 2003 functions and subroutines: @ref{GET_COMMAND},
@var{POS} set to zero.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7151,6 +7190,16 @@ Elemental function
The return value is of type @code{INTEGER} and of the same kind as
@var{I}.
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{IBCLR(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BBCLR(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIBCLR(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIBCLR(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIBCLR(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}, @ref{MVBITS}
@@ -7161,6 +7210,10 @@ The return value is of type @code{INTEGER} and of the same kind as
@node IBITS
@section @code{IBITS} --- Bit extraction
@fnindex IBITS
+@fnindex BBITS
+@fnindex IIBITS
+@fnindex JIBITS
+@fnindex KIBITS
@cindex bits, get
@cindex bits, extract
@@ -7173,7 +7226,7 @@ zeroed. The value of @code{POS+LEN} must be less than or equal to the
value @code{BIT_SIZE(I)}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7192,6 +7245,16 @@ Elemental function
The return value is of type @code{INTEGER} and of the same kind as
@var{I}.
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{IBITS(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BBITS(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIBITS(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIBITS(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIBITS(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{BIT_SIZE}, @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
@end table
@@ -7201,6 +7264,10 @@ The return value is of type @code{INTEGER} and of the same kind as
@node IBSET
@section @code{IBSET} --- Set bit
@fnindex IBSET
+@fnindex BBSET
+@fnindex IIBSET
+@fnindex JIBSET
+@fnindex KIBSET
@cindex bits, set
@table @asis
@@ -7209,7 +7276,7 @@ The return value is of type @code{INTEGER} and of the same kind as
@var{POS} set to one.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7227,6 +7294,16 @@ Elemental function
The return value is of type @code{INTEGER} and of the same kind as
@var{I}.
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{IBSET(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BBSET(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIBSET(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIBSET(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIBSET(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}, @ref{MVBITS}
@@ -7358,6 +7435,10 @@ end program test_idate
@node IEOR
@section @code{IEOR} --- Bitwise logical exclusive or
@fnindex IEOR
+@fnindex BIEOR
+@fnindex IIEOR
+@fnindex JIEOR
+@fnindex KIEOR
@cindex bitwise logical exclusive or
@cindex logical exclusive or, bitwise
@@ -7367,7 +7448,7 @@ end program test_idate
@var{J}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7388,6 +7469,16 @@ The return type is @code{INTEGER}, of the same kind as the
arguments. (If the argument kinds differ, it is of the same kind as
the larger argument.)
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{IEOR(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BIEOR(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIEOR(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIEOR(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIEOR(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
@end table
@@ -7662,6 +7753,10 @@ The return value is a @code{INTEGER(8)} variable.
@node IOR
@section @code{IOR} --- Bitwise logical or
@fnindex IOR
+@fnindex BIOR
+@fnindex IIOR
+@fnindex JIOR
+@fnindex KIOR
@cindex bitwise logical or
@cindex logical or, bitwise
@@ -7671,7 +7766,7 @@ The return value is a @code{INTEGER(8)} variable.
@var{J}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7692,6 +7787,16 @@ The return type is @code{INTEGER}, of the same kind as the
arguments. (If the argument kinds differ, it is of the same kind as
the larger argument.)
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{IOR(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BIOR(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IIOR(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JIOR(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KIOR(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
@end table
@@ -7945,6 +8050,10 @@ END PROGRAM
@node ISHFT
@section @code{ISHFT} --- Shift bits
@fnindex ISHFT
+@fnindex BSHFT
+@fnindex IISHFT
+@fnindex JISHFT
+@fnindex KISHFT
@cindex bits, shift
@table @asis
@@ -7958,7 +8067,7 @@ value is undefined. Bits shifted out from the left end or right end are
lost; zeros are shifted in from the opposite end.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -7976,6 +8085,16 @@ Elemental function
The return value is of type @code{INTEGER} and of the same kind as
@var{I}.
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{ISHFT(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BSHFT(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IISHFT(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JISHFT(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KISHFT(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{ISHFTC}
@end table
@@ -7985,6 +8104,10 @@ The return value is of type @code{INTEGER} and of the same kind as
@node ISHFTC
@section @code{ISHFTC} --- Shift bits circularly
@fnindex ISHFTC
+@fnindex BSHFTC
+@fnindex IISHFTC
+@fnindex JISHFTC
+@fnindex KISHFTC
@cindex bits, shift circular
@table @asis
@@ -7999,7 +8122,7 @@ a right shift. The absolute value of @var{SHIFT} must be less than
equivalent to @code{BIT_SIZE(I)}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -8020,6 +8143,16 @@ the value must be greater than zero and less than or equal to
The return value is of type @code{INTEGER} and of the same kind as
@var{I}.
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{ISHFTC(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BSHFTC(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IISHFTC(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JISHFTC(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KISHFTC(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{ISHFT}
@end table
@@ -9843,6 +9976,10 @@ cases, the result is of the same type and kind as @var{ARRAY}.
@fnindex MOD
@fnindex AMOD
@fnindex DMOD
+@fnindex BMOD
+@fnindex IMOD
+@fnindex JMOD
+@fnindex KMOD
@cindex remainder
@cindex division, remainder
@@ -9851,7 +9988,7 @@ cases, the result is of the same type and kind as @var{ARRAY}.
@code{MOD(A,P)} computes the remainder of the division of A by P@.
@item @emph{Standard}:
-Fortran 77 and later
+Fortran 77 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -9898,6 +10035,10 @@ end program test_mod
@item @code{MOD(A,P)} @tab @code{INTEGER A,P} @tab @code{INTEGER} @tab Fortran 95 and later
@item @code{AMOD(A,P)} @tab @code{REAL(4) A,P} @tab @code{REAL(4)} @tab Fortran 95 and later
@item @code{DMOD(A,P)} @tab @code{REAL(8) A,P} @tab @code{REAL(8)} @tab Fortran 95 and later
+@item @code{BMOD(A,P)} @tab @code{INTEGER(1) A,P} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IMOD(A,P)} @tab @code{INTEGER(2) A,P} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JMOD(A,P)} @tab @code{INTEGER(4) A,P} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KMOD(A,P)} @tab @code{INTEGER(8) A,P} @tab @code{INTEGER(8)} @tab GNU extension
@end multitable
@item @emph{See also}:
@@ -10017,6 +10158,10 @@ end program test_move_alloc
@node MVBITS
@section @code{MVBITS} --- Move bits from one integer to another
@fnindex MVBITS
+@fnindex BMVBITS
+@fnindex IMVBITS
+@fnindex JMVBITS
+@fnindex KMVBITS
@cindex bits, move
@table @asis
@@ -10029,7 +10174,7 @@ affected by the movement of bits is unchanged. The values of
@code{BIT_SIZE(FROM)}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental subroutine
@@ -10047,6 +10192,16 @@ same kind as @var{FROM}.
@item @var{TOPOS} @tab The type shall be @code{INTEGER}.
@end multitable
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{MVBITS(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BMVBITS(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{IMVBITS(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JMVBITS(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KMVBITS(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IBCLR}, @ref{IBSET}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
@end table
@@ -10250,6 +10405,10 @@ END PROGRAM
@node NOT
@section @code{NOT} --- Logical negation
@fnindex NOT
+@fnindex BNOT
+@fnindex INOT
+@fnindex JNOT
+@fnindex KNOT
@cindex bits, negate
@cindex bitwise logical not
@cindex logical not, bitwise
@@ -10259,7 +10418,7 @@ END PROGRAM
@code{NOT} returns the bitwise Boolean inverse of @var{I}.
@item @emph{Standard}:
-Fortran 95 and later
+Fortran 95 and later, has overloads that are GNU extensions
@item @emph{Class}:
Elemental function
@@ -10276,6 +10435,16 @@ Elemental function
The return type is @code{INTEGER}, of the same kind as the
argument.
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{NOT(A)} @tab @code{INTEGER A} @tab @code{INTEGER} @tab Fortran 95 and later
+@item @code{BNOT(A)} @tab @code{INTEGER(1) A} @tab @code{INTEGER(1)} @tab GNU extension
+@item @code{INOT(A)} @tab @code{INTEGER(2) A} @tab @code{INTEGER(2)} @tab GNU extension
+@item @code{JNOT(A)} @tab @code{INTEGER(4) A} @tab @code{INTEGER(4)} @tab GNU extension
+@item @code{KNOT(A)} @tab @code{INTEGER(8) A} @tab @code{INTEGER(8)} @tab GNU extension
+@end multitable
+
@item @emph{See also}:
@ref{IAND}, @ref{IEOR}, @ref{IOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}
@@ -11192,6 +11361,9 @@ end program test_rank
@fnindex REALPART
@fnindex FLOAT
@fnindex DFLOAT
+@fnindex FLOATI
+@fnindex FLOATJ
+@fnindex FLOATK
@fnindex SNGL
@cindex conversion, to real
@cindex complex numbers, real part
@@ -11252,6 +11424,9 @@ end program test_real
@item Name @tab Argument @tab Return type @tab Standard
@item @code{FLOAT(A)} @tab @code{INTEGER(4)} @tab @code{REAL(4)} @tab Fortran 77 and later
@item @code{DFLOAT(A)} @tab @code{INTEGER(4)} @tab @code{REAL(8)} @tab GNU extension
+@item @code{FLOATI(A)} @tab @code{INTEGER(2)} @tab @code{REAL(4)} @tab GNU extension
+@item @code{FLOATJ(A)} @tab @code{INTEGER(4)} @tab @code{REAL(4)} @tab GNU extension
+@item @code{FLOATK(A)} @tab @code{INTEGER(8)} @tab @code{REAL(4)} @tab GNU extension
@item @code{SNGL(A)} @tab @code{INTEGER(8)} @tab @code{REAL(4)} @tab Fortran 77 and later
@end multitable
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 87baf15862b..2fd12cb6a1a 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -116,7 +116,8 @@ by type. Explanations are in the following sections.
@xref{Fortran Dialect Options,,Options controlling Fortran dialect}.
@gccoptlist{-fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code @gol
-fd-lines-as-comments @gol
--fdec -fdec-structure -fdefault-double-8 -fdefault-integer-8 @gol
+-fdec -fdec-structure -fdec-intrinsic-ints @gol
+-fdefault-double-8 -fdefault-integer-8 @gol
-fdefault-real-8 -fdollar-ok -ffixed-line-length-@var{n} @gol
-ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol
-ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol
@@ -239,6 +240,7 @@ full documentation.
Other flags enabled by this switch are:
@option{-fdollar-ok} @option{-fcray-pointer} @option{-fdec-structure}
+@option{-fdec-intrinsic-ints}
@item -fdec-structure
@opindex @code{fdec-structure}
@@ -247,6 +249,11 @@ Enable DEC @code{STRUCTURE} and @code{RECORD} as well as @code{UNION},
provided for compatibility only; Fortran 90 derived types should be used
instead where possible.
+@item -fdec-intrinsic-ints
+@opindex @code{fdec-intrinsic-ints}
+Enable B/I/J/K kind variants of existing integer functions (e.g. BIAND, IIAND,
+JIAND, etc...). For a complete list of intrinsics see the full documentation.
+
@item -fdollar-ok
@opindex @code{fdollar-ok}
@cindex @code{$}
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index 8f8b299bf1f..4ff54e2ca8b 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -424,6 +424,10 @@ fdec
Fortran
Enable all DEC language extensions.
+fdec-intrinsic-ints
+Fortran Var(flag_dec_intrinsic_ints)
+Enable kind-specific variants of integer intrinsic functions.
+
fdec-structure
Fortran
Enable support for DEC STRUCTURE/RECORD.
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 5a91ec1b209..4aa8303dfeb 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -53,6 +53,7 @@ static void
set_dec_flags (int value)
{
gfc_option.flag_dec_structure = value;
+ flag_dec_intrinsic_ints = value;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ab2f25eabc..cafdb6d29e5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-08-03 Fritz Reese <fritzoreese@gmail.com>
+
+ * gfortran.dg/dec_intrinsic_ints.f90: New testcase.
+
2016-08-03 Richard Biener <rguenther@suse.de>
* c-c++-common/ubsan/pr71403-1.c: Use dg-additional-options
diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90 b/gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90
new file mode 100644
index 00000000000..faa30788f44
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90
@@ -0,0 +1,165 @@
+! { dg-do compile }
+! { dg-options "-fdec-intrinsic-ints" }
+!
+! Test B/I/J/K integer intrinsics.
+!
+program main
+
+implicit none
+
+integer*1 :: ab = 9_1, bb = 3_1, cb
+integer*2 :: ai = 9_2, bi = 3_2, ci
+integer*4 :: aj = 9_4, bj = 3_4, cj
+integer*8 :: ak = 9_8, bk = 3_8, ck
+integer :: a = 9 , b = 3 , c
+
+integer*1 :: ib = 9_1, bpos = 3_1
+integer*2 :: ii = 9_2, ipos = 3_2
+integer*4 :: ij = 9_4, jpos = 3_4
+integer*8 :: ik = 9_8, kpos = 3_8
+integer :: i = 9 , pos = 3
+
+integer*1 :: ba, bc, bd
+integer*2 :: ia, ic, id
+integer*4 :: ja, jb, jc, jd
+integer*8 :: ka, kb, kc, kd
+
+logical*1 :: lb
+logical*2 :: li
+logical*4 :: lj
+logical*8 :: lk
+logical :: l
+
+real :: r
+
+lb = bbtest(ib, bpos)
+li = bitest(ii, ipos)
+lj = bjtest(ij, jpos)
+lk = bktest(ik, kpos)
+l = btest(i , pos)
+
+lb = bbtest(9_1, 3_1)
+li = bitest(9_2, 3_2)
+lj = bjtest(9_4, 3_4)
+lk = bktest(9_8, 3_8)
+l = btest(9 , 3 )
+
+r = floati(ai)
+r = floatj(aj)
+r = floatk(ak)
+r = float (a )
+
+r = floati(9_2)
+r = floatj(9_4)
+r = floatk(9_8)
+r = float (9 )
+
+bb = babs(ab)
+bi = iiabs(ai)
+bj = jiabs(aj)
+bk = kiabs(ak)
+b = iabs(a )
+
+bb = babs(9_1)
+bi = iiabs(9_2)
+bj = jiabs(9_4)
+bk = kiabs(9_8)
+b = iabs(9 )
+
+cb = biand(ab, bb)
+ci = iiand(ai, bi)
+cj = jiand(aj, bj)
+ck = kiand(ak, bk)
+c = iand(a , b )
+
+cb = biand(9_1, 3_1)
+ci = iiand(9_2, 3_2)
+cj = jiand(9_4, 3_4)
+ck = kiand(9_8, 3_8)
+c = iand(9 , 3 )
+
+cb = bbclr(ib, bpos)
+ci = iibclr(ii, ipos)
+cj = jibclr(ij, jpos)
+ck = kibclr(ik, kpos)
+c = ibclr(i , pos)
+
+cb = bbclr(9_1, 3_1)
+ci = iibclr(9_2, 3_2)
+cj = jibclr(9_4, 3_4)
+ck = kibclr(9_8, 3_8)
+c = ibclr(i , pos)
+
+cb = bbset(ib, bpos)
+ci = iibset(ii, ipos)
+cj = jibset(ij, jpos)
+ck = kibset(ik, kpos)
+c = ibset(i , pos)
+
+cb = bbset(9_1, 3_1)
+ci = iibset(9_2, 3_2)
+cj = jibset(9_4, 3_4)
+ck = kibset(9_8, 3_8)
+c = ibset(i , pos)
+
+cb = bieor(ab, bb)
+ci = iieor(ai, bi)
+cj = jieor(aj, bj)
+ck = kieor(ak, bk)
+c = ieor(a , b )
+
+cb = bieor(9_1, 3_1)
+ci = iieor(9_2, 3_2)
+cj = jieor(9_4, 3_4)
+ck = kieor(9_8, 3_8)
+c = ieor(9 , 3 )
+
+cb = bior(ab, bb)
+ci = iior(ai, bi)
+cj = jior(aj, bj)
+ck = kior(ak, bk)
+c = ior(a , b )
+
+cb = bior(9_1, 3_1)
+ci = iior(9_2, 3_2)
+cj = jior(9_4, 3_4)
+ck = kior(9_8, 3_8)
+c = ior(9 , 3 )
+
+cb = bmod(ab, bb)
+ci = imod(ai, bi)
+cj = jmod(aj, bj)
+ck = kmod(ak, bk)
+c = mod(a , b )
+
+cb = bmod(9_1, 3_1)
+ci = imod(9_2, 3_2)
+cj = jmod(9_4, 3_4)
+ck = kmod(9_8, 3_8)
+c = mod(9 , 3 )
+
+ba = bbits(121, 10, 5)
+call bmvbits(121_1, 2, 3, ba, 1)
+bc = bshftc(ba, 3, 6)
+bd = bshft(bc, -3)
+ba = bnot(bd)
+
+ia = iibits(357, 10, 5)
+call imvbits(357_2, 8, 3, ia, 1)
+ic = iishftc(ia, 3, 6)
+id = iishft(ic, -3)
+ia = inot(id)
+
+ja = jibits(357, 10, 5)
+call jmvbits(357_4, 8, 3, ja, 1)
+jc = jishftc(ja, 3, 6)
+jd = jishft(jc, -3)
+ja = jnot(jd)
+
+ka = kibits(357_8, 10_8, 5_8)
+call kmvbits(357_8, 8_8, 3_8, ka, 1_8)
+kc = kishftc(ka, 3_8, 6_8)
+kd = kishft(kc, -3_8)
+ka = knot(kd)
+
+end program