3 #define FbinOp(S, ASM) uint64_t S(uint64_t a, uint64_t b) \
6 asm ("llihf %[res],801\n" ASM \
7 : [res]"=&r"(res) : [a]"r"(a), [b]"r"(b) : "cc"); \
11 /* AND WITH COMPLEMENT */
12 FbinOp(_ncrk
, ".insn rrf, 0xB9F50000, %[res], %[b], %[a], 0\n")
13 FbinOp(_ncgrk
, ".insn rrf, 0xB9E50000, %[res], %[b], %[a], 0\n")
16 FbinOp(_nnrk
, ".insn rrf, 0xB9740000, %[res], %[b], %[a], 0\n")
17 FbinOp(_nngrk
, ".insn rrf, 0xB9640000, %[res], %[b], %[a], 0\n")
20 FbinOp(_nxrk
, ".insn rrf, 0xB9770000, %[res], %[b], %[a], 0\n")
21 FbinOp(_nxgrk
, ".insn rrf, 0xB9670000, %[res], %[b], %[a], 0\n")
24 FbinOp(_nork
, ".insn rrf, 0xB9760000, %[res], %[b], %[a], 0\n")
25 FbinOp(_nogrk
, ".insn rrf, 0xB9660000, %[res], %[b], %[a], 0\n")
27 /* OR WITH COMPLEMENT */
28 FbinOp(_ocrk
, ".insn rrf, 0xB9750000, %[res], %[b], %[a], 0\n")
29 FbinOp(_ocgrk
, ".insn rrf, 0xB9650000, %[res], %[b], %[a], 0\n")
31 int main(int argc
, char *argv
[])
33 if (_ncrk(0xFF88, 0xAA11) != 0x0000032100000011ull
||
34 _nnrk(0xFF88, 0xAA11) != 0x00000321FFFF55FFull
||
35 _nork(0xFF88, 0xAA11) != 0x00000321FFFF0066ull
||
36 _nxrk(0xFF88, 0xAA11) != 0x00000321FFFFAA66ull
||
37 _ocrk(0xFF88, 0xAA11) != 0x00000321FFFFAA77ull
||
38 _ncgrk(0xFF88, 0xAA11) != 0x0000000000000011ull
||
39 _nngrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFF55FFull
||
40 _nogrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFF0066ull
||
41 _nxgrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFFAA66ull
||
42 _ocgrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFFAA77ull
)