Data processing (scalar floating-point and Advanced SIMD)
fixed bit field field the encoding fixes should be
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | ftype | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | Rn | Rd | |||||||||
| opc | |||||||||||||||||||||||||||||||
00011110xx100001110000xxxxxxxxxx
let 'd = UInt(Rd);
let 'n = UInt(Rn);
esize : {16, 32, 64} = 16;
match ftype {
0b00 => {
esize = 32
},
0b01 => {
esize = 64
},
0b10 => {
throw(Error_Undefined())
},
0b11 => {
if HaveFP16Ext() then {
esize = 16
} else {
throw(Error_Undefined())
}
}
};
let 'esize = esize;
fpop : FPUnaryOp = undefined;
match opc {
0b00 => {
fpop = FPUnaryOp_MOV
},
0b01 => {
fpop = FPUnaryOp_ABS
},
0b10 => {
fpop = FPUnaryOp_NEG
},
0b11 => {
fpop = FPUnaryOp_SQRT
}
};
let fpop = fpop;
execute_aarch64_instrs_float_arithmetic_unary(d, esize, fpop, n)
CheckFPEnabled64();
let fpcr : FPCRType = FPCR_read();
let merge : bool = fpop != FPUnaryOp_MOV & IsMerging(fpcr);
result : bits(128) = if merge then V_read(d, 128) else 0[127 .. 0];
let operand : bits('esize) = V_read(n, esize);
match fpop {
FPUnaryOp_MOV => {
result = Elem_set(result, 0, esize, operand)
},
FPUnaryOp_ABS => {
result = Elem_set(result, 0, esize, FPAbs(operand))
},
FPUnaryOp_NEG => {
result = Elem_set(result, 0, esize, FPNeg(operand))
},
FPUnaryOp_SQRT => {
result = Elem_set(result, 0, esize, FPSqrt(operand, fpcr))
}
};
V_set(d, 128) = result
Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.