User`s guide

Cray XMT Programming Environment Users Guide
3.5.2 Anonymous futures
Often, a concurrent computation does not have a return value. An example of such
a concurrent computation is an I/O statement or a modification of global values.
You can express such a computation using an
anonymous future. An anonymous
future has no name or return statement. If the anonymous future does not access
a synchronized variable referenced by the main computation, there will be no
dependence between the future and the main computation. If a future does not create
a dependence, the future may not execute. An anonymous future does not need to
execute or finish for a program to terminate normally.
3.6 Testing Expressions Using Condition Codes
When you use arithmetic expressions in your code, you can test the expressions by
using the MTA_TEST_CC intrinsic function. This function returns condition codes
that identify problems in the expression. It uses the following prototype:
MTA_TEST_CC(expression, condition-mask)
MTA_TEST_CC evaluates the expression and generates a condition code. If the
resulting condition code is a member of the set of condition values in condition-mask,
true is returned; otherwise, false is returned.
The expression can be a scalar variable, a single arithmetic operation, or a machine
intrinsic. If you use a scalar variable, you must assign a value to it in the statement
immediately preceding the call to MTA_TEST_CC.InMTA_TEST_CC, you test the
operation on the right side of the assignment statement. The condition-mask should
evaluate to a compile-time constant. The condition codes and possible values for the
condition-mask are listed in Appendix D, Condition Codes on page 133.
Example 1. Testing a shift-left operation for a carried number
MTA_TEST_CC allows branching based on any of the condition codes produced by
the machine intrinsics. For example, consider the problem of testing to see if one of
the upper 32 bits in an integer is set. One approach is to use the MTA_SHIFT_LEFT
intrinsic function, which generates a carried number if a 1 bit is shifted out. When
using MTA_SHIFT_LEFT, you can use MTA_TEST_CC with the IF_CY condition
mask to check for a carried number, as shown in the following example.
enum{IF_CY = 16+32+64+128};
if(MTA_TEST_CC(MTA_SHIFT_LEFT(i, 32), IF_CY))
{
printf("One of the upper 32 bits was set\n");
}
In the previous example, the compiler would emit a SHIFT_LEFT_IMM_TEST
operation, followed by a conditional branch on carry.
34 S247920