crs - Cross product

crs - Cross product

Calling Format

crs     dest{ .x | .y | .z | .xy | .xz | .yz | .xyz }, src0, src1

Operands

Name Registers
dest A temporary register.
Requires any one of { .x | .y | .z | .xy | .xz | .yz | .xyz } as the mask.
src0 A temporary register, an input register, or a floating-point constant register.
Swizzling not possible.
Cannot specify anything other than the default mask { .xyzw }.
src1 A temporary register, an input register, or a floating-point constant register.
Swizzling not possible.
Cannot specify anything other than the default mask { .xyzw }.

Cannot specify the same register for src0 and dest.
Cannot specify the same register for src1 and dest.
You cannot specify a floating-point constant register for both src0 and src1.
You cannot specify input registers using different indices for src0 and src1 at the same time.

Overview

Stores the cross product of three components of src0 and src1 in dest.

Operation

dest.x = src0.y * src1.z - src0.z * src1.y
dest.y = src0.z * src1.x - src0.x * src1.z
dest.z = src0.x * src1.y - src0.y * src1.x

Macro Expansion

mul     dest.xyz,  src0.yzx, src1.zxy
mad     dest.xyz, -src1.yzx, src0.zxy, dest

Code Example

crs     r0.xyz, c1, v2

Timetable

12345678
mul read MUL post write
mad STALL read MUL ADD post write

Revision History

2011/12/20
Initial version.

CONFIDENTIAL