J3/13-230
To: J3
From: Van Snyder
Subject: BEQ, BNE instrinsic functions
Date: 2013 January 30
Title: BEQ, BNE instrinsic functions
Submitted by: Van Snyder
Status: For consideration
Basic functionality: Add intrinsic functions to test for equality and
inequality of bit strings.
Rationale: Testing for equality of bit strings (I,J) requires one of
the following:
if ( BLE(I,J) .and. BLE(J,I) ) ....
if ( POPCNT(IEOR(I,J)) == 0 ) ....
if ( I == J ) ....
The first two are cryptic and increase long-term cost for developers,
and for processor implementors if they optimize. They are inefficient
unless the processor recognizes the idiom.
The third is required by 4.4.2.2p1 to fail on ones-complement or
sign-magnitude platforms if I == +0 and J == -0.
Estimated impact: Minor
Markham M6 conformance: Remove simple deficiency and discrepancy.
Detailed specification: Add intrinsic functions to test for equality and
inequality of bit strings.
Draft edits: To estimate scope of project
Insert subclause 13.7.21a after 13.7.21:
<<13.7.21a BLE (I, J)>>
Description. Bitwise equality.
Class. Elemental function.
Arguments.
I shall be of type integer or a .
J shall be of type integer or a .
Result Characteristics. Default logical.
Result Value. The result is true if each bit of I has the same value
as the corresponding bit of J; otherwise the result is false.
The interpretation of a as a sequence of bits is
described in 4.7. The interpretation of an integer value as a sequence
of bits is described in 13.3.
Example. BLE ( B"1100", B"1100" ) has the value true. BLE ( B"1010",
B"1100") has the value false.
Insert subclause 13.7.32a after 13.7.32:
<<13.7.32a BNE (I, J)>>
Description. Bitwise inequality.
Class. Elemental function.
Arguments.
I shall be of type integer or a .
J shall be of type integer or a .
Result Characteristics. Default logical.
Result Value. The result is true if any bit of I has a different value
from the corresponding bit of J; otherwise the result is false.
The interpretation of a as a sequence of bits is
described in 4.7. The interpretation of an integer value as a sequence
of bits is described in 13.3.
Example. BNE ( B"1010", B"1100") has the value true. BNE ( B"1100",
B"1100" ) has the value false.