diff mbox

[Fortran] DEC extra integer intrinsics

Message ID CAE4aFA=kcpmCwsOjb3xxhV9aD=KH7twMMc++iT7LxO5NmTEH-w@mail.gmail.com
State New
Headers show

Commit Message

Fritz Reese July 18, 2016, 4:51 p.m. UTC
All,

Attached is another extension patch introducing a new DEC
compatibility flag -fdec-intrinsic-ints. With this flag the compiler
recognizes the following variants for integer intrinsics which use a
B/I/J/K prefix (with byte/integer/long/quad kind parameters):

IABS (babs, iiabs, jiabs, kiabs)
BTEST (bbtest, bitest, bjtest, bktest)
IAND (biand, iiand, jiand, kiand)
IBCLR (bbclr, iibclr, jibclr, kibclr)
IBITS (bbits, iibits, jibits, kibits)
IEOR (bieor, iieor, jieor, kieor)
IOR (bior, iior, jior, kior)
ISHFT (bshft, iishft, jishft, kishft)
ISHFTC (bshftc, iishftc, jishftc, kishftc)
MOD (bmod, imod, jmod, kmod)
NOT (bnot, inot, jnot, knot)
FLOAT (floati, floatj, floatk)
MVBITS (bmvbits, imvbits, jmvbits, kmvbits)

The patch updates intrinsics.texi to include each new intrinsic
variant and provides its own testcase. With the patch the compiler
builds and passes all regression tests on x86-64-redhat-linux.

---
Fritz Reese

2016-07-18  Fritz Reese  <fritzoreese@gmail.com>

        New flag -fdec-intrinsic-ints for variants of integer intrinsics.

        gcc/fortran/
        * lang.opt: New option -fdec-intrinsic-ints.
        * gfortran.texi, invoke.texi, intrinsics.texi: Update documentation.
        * options.c (set_dec_flags): Enable with -fdec.
        * intrinsic.c (add_function, add_subroutine): New B/I/J/K
intrinsic variants.

        gcc/testsuite/gfortran.dg/
        * dec_intrinsic_ints.f90: New testcase.
diff mbox

Patch

From f5347dddc8e5cba1f4850576de76bf2defbaa2e1 Mon Sep 17 00:00:00 2001
From: Fritz O. Reese <fritzoreese@gmail.com>
Date: Mon, 30 May 2016 15:37:21 -0400
Subject: [PATCH] New flag -fdec-intrinsic-ints for variants of integer intrinsics.

	gcc/fortran/
	* lang.opt: New option -fdec-intrinsic-ints.
	* gfortran.texi, invoke.texi, intrinsics.texi: Update documentation.
	* options.c (set_dec_flags): Enable with -fdec.
	* intrinsic.c (add_function, add_subroutine): New B/I/J/K intrinsic
	variants.

	gcc/testsuite/gfortran.dg/
	* dec_intrinsic_ints.f90: New testcase.
---
 gcc/fortran/gfortran.texi                        |   53 ++++
 gcc/fortran/intrinsic.c                          |  362 ++++++++++++++++++++++
 gcc/fortran/intrinsic.texi                       |  201 +++++++++++-
 gcc/fortran/invoke.texi                          |    8 +-
 gcc/fortran/lang.opt                             |    4 +
 gcc/fortran/options.c                            |    1 +
 gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90 |  165 ++++++++++
 7 files changed, 780 insertions(+), 14 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90

diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 4d288ba..54d60ad 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 1d7503d..34ee134 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -1259,6 +1259,25 @@  add_functions (void)
 	     NULL, gfc_simplify_abs, gfc_resolve_abs,
 	     a, BT_INTEGER, di, REQUIRED);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_1 ("babs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER,
+          1, GFC_STD_GNU, NULL, gfc_simplify_abs, gfc_resolve_abs,
+          a, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_1 ("iiabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES,
+          BT_INTEGER, 2, GFC_STD_GNU, NULL, gfc_simplify_abs, gfc_resolve_abs,
+          a, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_1 ("jiabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES,
+          BT_INTEGER, 4, GFC_STD_GNU, NULL, gfc_simplify_abs, gfc_resolve_abs,
+          a, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_1 ("kiabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES,
+          BT_INTEGER, 8, GFC_STD_GNU, NULL, gfc_simplify_abs, gfc_resolve_abs,
+          a, BT_INTEGER, 8, REQUIRED);
+    }
+
   add_sym_1 ("dabs", GFC_ISYM_ABS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77,
 	     gfc_check_fn_d, gfc_simplify_abs, gfc_resolve_abs,
 	     a, BT_REAL, dd, REQUIRED);
@@ -1557,6 +1576,33 @@  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)
+    {
+      add_sym_2 ("bbtest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_LOGICAL, 1, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_btest,
+          gfc_resolve_btest,
+          i, BT_INTEGER, 1, REQUIRED,
+          pos, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("bitest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_LOGICAL, 2, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_btest,
+          gfc_resolve_btest,
+          i, BT_INTEGER, 2, REQUIRED,
+          pos, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("bjtest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_LOGICAL, 4, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_btest,
+          gfc_resolve_btest,
+          i, BT_INTEGER, 4, REQUIRED,
+          pos, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("bktest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_LOGICAL, 8, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_btest,
+          gfc_resolve_btest,
+          i, BT_INTEGER, 8, REQUIRED,
+          pos, BT_INTEGER, 8, REQUIRED);
+    }
+
   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 +1996,33 @@  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)
+    {
+      add_sym_2 ("biand", GFC_ISYM_IAND, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_iand, gfc_simplify_iand,
+          gfc_resolve_iand,
+          i, BT_INTEGER, 1, REQUIRED,
+          j, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("iiand", GFC_ISYM_IAND, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_iand, gfc_simplify_iand,
+          gfc_resolve_iand,
+          i, BT_INTEGER, 2, REQUIRED,
+          j, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jiand", GFC_ISYM_IAND, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_iand, gfc_simplify_iand,
+          gfc_resolve_iand,
+          i, BT_INTEGER, 4, REQUIRED,
+          j, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kiand", GFC_ISYM_IAND, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_iand, gfc_simplify_iand,
+          gfc_resolve_iand,
+          i, BT_INTEGER, 8, REQUIRED,
+          j, BT_INTEGER, 8, REQUIRED);
+    }
+
   make_generic ("iand", GFC_ISYM_IAND, GFC_STD_F95);
 
   add_sym_2 ("and", GFC_ISYM_AND, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
@@ -1981,6 +2054,33 @@  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)
+    {
+      add_sym_2 ("bbclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibclr,
+          gfc_resolve_ibclr,
+          i, BT_INTEGER, 1, REQUIRED,
+          pos, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("iibclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibclr,
+          gfc_resolve_ibclr,
+          i, BT_INTEGER, 2, REQUIRED,
+          pos, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jibclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibclr,
+          gfc_resolve_ibclr,
+          i, BT_INTEGER, 4, REQUIRED,
+          pos, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kibclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibclr,
+          gfc_resolve_ibclr,
+          i, BT_INTEGER, 8, REQUIRED,
+          pos, BT_INTEGER, 8, REQUIRED);
+    }
+
   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 +2088,70 @@  add_functions (void)
 	     i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED,
 	     ln, BT_INTEGER, di, REQUIRED);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_3 ("bbits", GFC_ISYM_IBITS, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_ibits, gfc_simplify_ibits,
+          gfc_resolve_ibits,
+          i, BT_INTEGER, 1, REQUIRED,
+          pos, BT_INTEGER, 1, REQUIRED,
+          ln, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_3 ("iibits", GFC_ISYM_IBITS, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_ibits, gfc_simplify_ibits,
+          gfc_resolve_ibits,
+          i, BT_INTEGER, 2, REQUIRED,
+          pos, BT_INTEGER, 2, REQUIRED,
+          ln, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_3 ("jibits", GFC_ISYM_IBITS, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_ibits, gfc_simplify_ibits,
+          gfc_resolve_ibits,
+          i, BT_INTEGER, 4, REQUIRED,
+          pos, BT_INTEGER, 4, REQUIRED,
+          ln, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_3 ("kibits", GFC_ISYM_IBITS, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_ibits, gfc_simplify_ibits,
+          gfc_resolve_ibits,
+          i, BT_INTEGER, 8, REQUIRED,
+          pos, BT_INTEGER, 8, REQUIRED,
+          ln, BT_INTEGER, 8, REQUIRED);
+    }
+
   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)
+    {
+      add_sym_2 ("bbset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibset,
+          gfc_resolve_ibset,
+          i, BT_INTEGER, 1, REQUIRED,
+          pos, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("iibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibset,
+          gfc_resolve_ibset,
+          i, BT_INTEGER, 2, REQUIRED,
+          pos, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibset,
+          gfc_resolve_ibset,
+          i, BT_INTEGER, 4, REQUIRED,
+          pos, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_bitfcn, gfc_simplify_ibset,
+          gfc_resolve_ibset,
+          i, BT_INTEGER, 8, REQUIRED,
+          pos, BT_INTEGER, 8, REQUIRED);
+    }
+
   make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95);
 
   add_sym_2 ("ichar", GFC_ISYM_ICHAR, CLASS_ELEMENTAL, ACTUAL_NO,
@@ -2007,6 +2165,33 @@  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)
+    {
+      add_sym_2 ("bieor", GFC_ISYM_IEOR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_ieor, gfc_simplify_ieor,
+          gfc_resolve_ieor,
+          i, BT_INTEGER, 1, REQUIRED,
+          j, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("iieor", GFC_ISYM_IEOR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_ieor, gfc_simplify_ieor,
+          gfc_resolve_ieor,
+          i, BT_INTEGER, 2, REQUIRED,
+          j, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jieor", GFC_ISYM_IEOR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_ieor, gfc_simplify_ieor,
+          gfc_resolve_ieor,
+          i, BT_INTEGER, 4, REQUIRED,
+          j, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kieor", GFC_ISYM_IEOR, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_ieor, gfc_simplify_ieor,
+          gfc_resolve_ieor,
+          i, BT_INTEGER, 8, REQUIRED,
+          j, BT_INTEGER, 8, REQUIRED);
+    }
+
   make_generic ("ieor", GFC_ISYM_IEOR, GFC_STD_F95);
 
   add_sym_2 ("xor", GFC_ISYM_XOR, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
@@ -2072,6 +2257,29 @@  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)
+    {
+      add_sym_2 ("bior", GFC_ISYM_IOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          1, GFC_STD_GNU, gfc_check_ior, gfc_simplify_ior, gfc_resolve_ior,
+          i, BT_INTEGER, 1, REQUIRED,
+          j, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("iior", GFC_ISYM_IOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          2, GFC_STD_GNU, gfc_check_ior, gfc_simplify_ior, gfc_resolve_ior,
+          i, BT_INTEGER, 2, REQUIRED,
+          j, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jior", GFC_ISYM_IOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          4, GFC_STD_GNU, gfc_check_ior, gfc_simplify_ior, gfc_resolve_ior,
+          i, BT_INTEGER, 4, REQUIRED,
+          j, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kior", GFC_ISYM_IOR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          8, GFC_STD_GNU, gfc_check_ior, gfc_simplify_ior, gfc_resolve_ior,
+          i, BT_INTEGER, 8, REQUIRED,
+          j, BT_INTEGER, 8, REQUIRED);
+    }
+
   make_generic ("ior", GFC_ISYM_IOR, GFC_STD_F95);
 
   add_sym_2 ("or", GFC_ISYM_OR, CLASS_IMPURE, ACTUAL_NO, BT_LOGICAL,
@@ -2139,6 +2347,33 @@  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)
+    {
+      add_sym_2 ("bshft", GFC_ISYM_ISHFT, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_ishft, gfc_simplify_ishft,
+          gfc_resolve_ishft,
+          i, BT_INTEGER, 1, REQUIRED,
+          sh, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("iishft", GFC_ISYM_ISHFT, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_ishft, gfc_simplify_ishft,
+          gfc_resolve_ishft,
+          i, BT_INTEGER, 2, REQUIRED,
+          sh, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jishft", GFC_ISYM_ISHFT, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_ishft, gfc_simplify_ishft,
+          gfc_resolve_ishft,
+          i, BT_INTEGER, 4, REQUIRED,
+          sh, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kishft", GFC_ISYM_ISHFT, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_ishft, gfc_simplify_ishft,
+          gfc_resolve_ishft,
+          i, BT_INTEGER, 8, REQUIRED,
+          sh, BT_INTEGER, 8, REQUIRED);
+    }
+
   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 +2381,37 @@  add_functions (void)
 	     i, BT_INTEGER, di, REQUIRED, sh, BT_INTEGER, di, REQUIRED,
 	     sz, BT_INTEGER, di, OPTIONAL);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_3 ("bshftc", GFC_ISYM_ISHFTC, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 1, GFC_STD_GNU, gfc_check_ishftc, gfc_simplify_ishftc,
+          gfc_resolve_ishftc,
+          i, BT_INTEGER, 1, REQUIRED,
+          sh, BT_INTEGER, 1, REQUIRED,
+          sz, BT_INTEGER, 1, OPTIONAL);
+
+      add_sym_3 ("iishftc", GFC_ISYM_ISHFTC, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 2, GFC_STD_GNU, gfc_check_ishftc, gfc_simplify_ishftc,
+          gfc_resolve_ishftc,
+          i, BT_INTEGER, 2, REQUIRED,
+          sh, BT_INTEGER, 2, REQUIRED,
+          sz, BT_INTEGER, 2, OPTIONAL);
+
+      add_sym_3 ("jishftc", GFC_ISYM_ISHFTC, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 4, GFC_STD_GNU, gfc_check_ishftc, gfc_simplify_ishftc,
+          gfc_resolve_ishftc,
+          i, BT_INTEGER, 4, REQUIRED,
+          sh, BT_INTEGER, 4, REQUIRED,
+          sz, BT_INTEGER, 4, OPTIONAL);
+
+      add_sym_3 ("kishftc", GFC_ISYM_ISHFTC, CLASS_ELEMENTAL, ACTUAL_NO,
+          BT_INTEGER, 8, GFC_STD_GNU, gfc_check_ishftc, gfc_simplify_ishftc,
+          gfc_resolve_ishftc,
+          i, BT_INTEGER, 8, REQUIRED,
+          sh, BT_INTEGER, 8, REQUIRED,
+          sz, BT_INTEGER, 8, OPTIONAL);
+    }
+
   make_generic ("ishftc", GFC_ISYM_ISHFTC, GFC_STD_F95);
 
   add_sym_2 ("kill", GFC_ISYM_KILL, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
@@ -2464,6 +2730,29 @@  add_functions (void)
 	     gfc_check_x_yd, gfc_simplify_mod, gfc_resolve_mod,
 	     a, BT_REAL, dd, REQUIRED, p, BT_REAL, dd, REQUIRED);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_2 ("bmod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER,
+          1, GFC_STD_GNU, gfc_check_a_p, gfc_simplify_mod, gfc_resolve_mod,
+          a, BT_INTEGER, 1, REQUIRED,
+          p, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_2 ("imod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER,
+          2, GFC_STD_GNU, gfc_check_a_p, gfc_simplify_mod, gfc_resolve_mod,
+          a, BT_INTEGER, 2, REQUIRED,
+          p, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_2 ("jmod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER,
+          4, GFC_STD_GNU, gfc_check_a_p, gfc_simplify_mod, gfc_resolve_mod,
+          a, BT_INTEGER, 4, REQUIRED,
+          p, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_2 ("kmod", GFC_ISYM_MOD, CLASS_ELEMENTAL, ACTUAL_YES, BT_INTEGER,
+          8, GFC_STD_GNU, gfc_check_a_p, gfc_simplify_mod, gfc_resolve_mod,
+          a, BT_INTEGER, 8, REQUIRED,
+          p, BT_INTEGER, 8, REQUIRED);
+    }
+
   make_generic ("mod", GFC_ISYM_MOD, GFC_STD_F77);
 
   add_sym_2 ("modulo", GFC_ISYM_MODULO, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, di, GFC_STD_F95,
@@ -2498,6 +2787,25 @@  add_functions (void)
 	     gfc_check_i, gfc_simplify_not, gfc_resolve_not,
 	     i, BT_INTEGER, di, REQUIRED);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_1 ("bnot", GFC_ISYM_NOT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          1, GFC_STD_GNU, gfc_check_i, gfc_simplify_not, gfc_resolve_not,
+          i, BT_INTEGER, 1, REQUIRED);
+
+      add_sym_1 ("inot", GFC_ISYM_NOT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          2, GFC_STD_GNU, gfc_check_i, gfc_simplify_not, gfc_resolve_not,
+          i, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_1 ("jnot", GFC_ISYM_NOT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          4, GFC_STD_GNU, gfc_check_i, gfc_simplify_not, gfc_resolve_not,
+          i, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_1 ("knot", GFC_ISYM_NOT, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER,
+          8, GFC_STD_GNU, gfc_check_i, gfc_simplify_not, gfc_resolve_not,
+          i, BT_INTEGER, 8, REQUIRED);
+    }
+
   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 +2916,21 @@  add_functions (void)
 	     gfc_check_float, gfc_simplify_float, NULL,
 	     a, BT_INTEGER, di, REQUIRED);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_1 ("floati", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL,
+          dr, GFC_STD_GNU, gfc_check_float, gfc_simplify_float, NULL,
+          a, BT_INTEGER, 2, REQUIRED);
+
+      add_sym_1 ("floatj", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL,
+          dr, GFC_STD_GNU, gfc_check_float, gfc_simplify_float, NULL,
+          a, BT_INTEGER, 4, REQUIRED);
+
+      add_sym_1 ("floatk", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL,
+          dr, GFC_STD_GNU, gfc_check_float, gfc_simplify_float, NULL,
+          a, BT_INTEGER, 8, REQUIRED);
+    }
+
   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 +3629,45 @@  add_subroutines (void)
 	      t, BT_INTEGER, di, REQUIRED, INTENT_INOUT,
 	      tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
 
+  if (flag_dec_intrinsic_ints)
+    {
+      add_sym_5s ("bmvbits", GFC_ISYM_MVBITS, CLASS_ELEMENTAL, BT_UNKNOWN, 0,
+          GFC_STD_F95, gfc_check_mvbits, NULL,
+          gfc_resolve_mvbits,
+          f, BT_INTEGER, 1, REQUIRED, INTENT_IN,
+          fp, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          ln, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          t, BT_INTEGER, 1, REQUIRED, INTENT_INOUT,
+          tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
+
+      add_sym_5s ("imvbits", GFC_ISYM_MVBITS, CLASS_ELEMENTAL, BT_UNKNOWN, 0,
+          GFC_STD_F95, gfc_check_mvbits, NULL,
+          gfc_resolve_mvbits,
+          f, BT_INTEGER, 2, REQUIRED, INTENT_IN,
+          fp, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          ln, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          t, BT_INTEGER, 2, REQUIRED, INTENT_INOUT,
+          tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
+
+      add_sym_5s ("jmvbits", GFC_ISYM_MVBITS, CLASS_ELEMENTAL, BT_UNKNOWN, 0,
+          GFC_STD_F95, gfc_check_mvbits, NULL,
+          gfc_resolve_mvbits,
+          f, BT_INTEGER, 4, REQUIRED, INTENT_IN,
+          fp, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          ln, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          t, BT_INTEGER, 4, REQUIRED, INTENT_INOUT,
+          tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
+
+      add_sym_5s ("kmvbits", GFC_ISYM_MVBITS, CLASS_ELEMENTAL, BT_UNKNOWN, 0,
+          GFC_STD_F95, gfc_check_mvbits, NULL,
+          gfc_resolve_mvbits,
+          f, BT_INTEGER, 8, REQUIRED, INTENT_IN,
+          fp, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          ln, BT_INTEGER, di, REQUIRED, INTENT_IN,
+          t, BT_INTEGER, 8, REQUIRED, INTENT_INOUT,
+          tp, BT_INTEGER, di, REQUIRED, INTENT_IN);
+    }
+
   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 8840630..ae5d814 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 e81fcd8..5c6537b 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
@@ -248,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 c9883fd..143c07d 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 e0c4265..daa8521 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/gfortran.dg/dec_intrinsic_ints.f90 b/gcc/testsuite/gfortran.dg/dec_intrinsic_ints.f90
new file mode 100644
index 0000000..faa3078
--- /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
-- 
1.7.1