[Bug fortran/38282] Add the remaining HPF bit intrinsics

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 27 11:15:00 GMT 2008



------- Comment #1 from burnus at gcc dot gnu dot org  2008-11-27 11:14 -------
(In reply to comment #0)
> POPCNT and POPPAR are present in many other compilers

And (even) more interestingly they are part of the Fortran 2008 Candidate
Release (as you also mentioned):

  13.7.128 POPCNT (I)
  Description. Number of one bits.
  Class. Elemental function.
  Argument. I shall be of type integer.
  Result Characteristics. Default integer.
  Result Value. The result value is equal to the number of one bits in the 
    sequence of bits of I. The model for the interpretation of an integer value
    as a sequence of bits is in 13.3.

  13.7.129 POPPAR (I)
  Description. Parity expressed as 0 or 1.
  Class. Elemental function.
  Argument. I shall be of type integer.
  Result Characteristics. Default integer.
  Result Value. POPPAR (I) has the value 1 if POPCNT (I) is odd, and 0 if
    POPCNT (I) is even.

 * * *

For completeness:

Fortran 2008 and also the HPF standard also list the following "Array Reduction
Functions" (HPF):

- IALL - Bitwise AND of all the elements of ARRAY along dimension DIM
         corresponding to the true elements of the mask
- IANY - Bitwise OR of all the elements of ARRAY along dimension DIM 
         corresponding to the true elements of MASK.
- IPARITY - Bitwise exclusive OR of all the elements of ARRAY along dimension
         DIM corresponding to the true elements of MASK.
- PARITY - True if and only if an odd number of values are true in MASK
         along dimension DIM.

And Fortran 2008 also the following elemental procedures for bits:
- DSHIFTL(I,J,SHIFT) - Combined left shift
- DSHIFTR(I,J,SHIFT) - Combined right shift
- SHIFTA - Right shift with fill.
- SHIFTL - Left shift
- SHIFTR - Right shift
- MASKL  Left justified mask
- MASKR - Right justified mask
- BGE - True if and only if I is bitwise greater than or equal to J
- BGT - True if and only if I is bitwise greater than J.
- BLE - True if and only if I is bitwise less than or equal to J
- BLT - True if and only if I is bitwise less than J.
- MERGE_BITS - Merge of bits under mask


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38282



More information about the Gcc-bugs mailing list