int_mult_upper
- Date:
10-12-2011
NAME
_int_mult_upper, INT_MULT_UPPER - Multiplies integers and returns the uppermost bits
SYNOPSIS
C Synopsis
#include <intrinsics.h>
unsigned long _int_mult_upper (long i, long j);
Fortran Synopsis
INT_MULT_UPPER ([I=]i, [J=]j)
INTEGER (KIND=4|8) i, j
IMPLEMENTATION
Cray Linux Environment (CLE)
STANDARDS
C extension
Fortran extension
DESCRIPTION
This hardware intrinsic function takes advantage of a hardware instruction. For C code, the _int_mult_upper hardware intrinsic multiplies two 64-bit integers, as if they were unsigned, and returns the upper (leftmost) 64 bits of the 128-bit unsigned result.
For Fortran code, the INT_MULT_UPPER() intrinsic accepts 32-bit or 64-bit integers and returns the results shown by the following table.
INT_MULT_UPPER()
--------------------------------------------------------------
Returns upper x bits from a result of
Size of both arguments y bits
--------------------------------------------------------------
32 bits 32 bits/64 bits
64 bits 64 bits/128 bits
--------------------------------------------------------------
INT_MULT_UPPER() accepts the following arguments:
- i
The i argument can be a scalar or an array.
- j
The j argument can be a scalar or an array. If it is an array, it must be of the same shape as the i argument.
INT_MULT_UPPER() is an elemental function. The name of this intrinsic cannot be passed as an argument.
If i and j are scalar, the result is a scalar.
If i is an array and j is scalar, the result is an array of the same shape as i, in which each element is the result of the product of ii and j, as described previously.
If i is scalar and j is an array, the result is an array of the same shape as j, in which each element is the result of the product of i and ji as described previously.
If both i and j are arrays, the result is an array of the same shape as i, in which each element is the result of the product of ii and ji as described previously.
NOTES
C
The compiler generates inline code to produce the result.
EXAMPLES
Fortran example:
INTEGER (KIND=8) ii(128), jj, result(128)
!Compute ii and jj
result = INT_MULT_UPPER(ii, jj)
SEE ALSO
For a list of C intrinsic functions, see the Cray C and C++ Reference Manual.