Subject: reduction intrinsics

From: Guy Steele <[email-masked]>
Date: Wed, 6 May 92 14:29:30 EDT

Proposal for reduction instrinsics for HPF

Guy L. Steele Jr.
Thinking Machines Corporation
Version of May 6, 1992

Just as we have the correpondences:

	operator/intrinsic	reduction intrinsic

		+			SUM
		*			PRODUCT
		.AND.			ALL
		.OR.			ANY
		MAX			MAXVAL
		MIN			MINVAL

it would be useful to have reduction versions of certain
other operators and intrinsics in the language that happen
to be associative and commutative:

				    proposed
	operator/intrinsic	reduction intrinsic

		IAND			AND
		IOR			OR
		IEOR			EOR
		.NEQV.			PARITY

Thus

	AND( (/ 7,3,10 /) )  yields 2
	 OR( (/ 7,3,10 /) )  yields 15
	EOR( (/ 7,3,10 /) )  yields 14

      LOGICAL T,F
      PARAMETER (T = .TRUE., F = .FALSE. )      !just for conciseness

      PARITY( (/ T,F,F,T,T,F,F,F,T,T /) )  yields .TRUE.
      PARITY( (/ T,F,F,T,T,F,F,F,T,F /) )  yields .FALSE.

Some of these are particularly valuable if corresponding
parallel-prefix intrinsics are also defined (see separate proposal).