RSQ

Arithmetic

fixed bit field field the encoding fixes should be

Encoding

313029282726252423222120191817161514131211109876543210
001111destaddrsrc1src2desc

bits 31:0: 0011 11xx xxxx xxxx xxxx xxxx xxxx xxxx

Its format is @arith: format 1: src1 takes the address register. 1i (the I forms): src2 takes it.

Runs execute_RCP with Form() 1.

Fields

Its operation is 2 opcodes' (Form() tells them apart), so it may read the fields of their layouts too.

FieldBitsThe Sail reads it in
dest25:21ArithDest
addr20:19ArithA, ArithB
src118:12ArithA (18:14), ArithA
[13:7]13:7ArithB (not a field of the file)
src211:7ArithB
desc6:0ArithPattern

Operation Sail

RCP and RSQ: 1 / x and 1 / sqrt(x) of the first source's x; a zero operand (RSQ: one not above zero) leaves the destination alone, which avoids NaN, and a NaN one passes RCP's unordered !=

let rsq = Form() == 1;
let p = ArithPattern();
let a = ArithA(p, false);
let b = ArithB(p, false);
let d = ArithDest();
let v = V4At(a, 0);
IfBegin(if rsq then FCompare(4, v, FConst(0x00000000)) else FCompare(13, v, FConst(0x00000000)));
SetDestScalar(p, d, if rsq then FInvSqrt(v) else FDiv(FConst(0x3f800000), v));
IfEnd()

Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from nihstro's shader_bytecode.h (BSD-3-Clause), as Azahar reads them.