Merge remote-tracking branch 'origin/nasm-2.15.xx'
[nasm.git] / misc / genfma.pl
blob2b6a65c54ef8b60a3da10630e42732c47b7dc474
1 #!/usr/bin/perl
2 %packed_insns = (
3 'vfmadd' => 0x98,
4 'vfmaddsub' => 0x96,
5 'vfmsubadd' => 0x97,
6 'vfmsub' => 0x9a,
7 'vfnmadd' => 0x9c,
8 'vfnmsub' => 0x9e
9 );
11 %scalar_insns = (
12 'vfmadd' => 0x99,
13 'vfmsub' => 0x9b,
14 'vfnmadd' => 0x9d,
15 'vfnmsub' => 0x9f
18 foreach $pi ( sort(keys(%packed_insns)) ) {
19 $op = $packed_insns{$pi};
20 foreach $order ('132', '213', '231') {
21 $xorder = substr($order,1,1).substr($order,0,1).substr($order,2,1);
22 foreach $o ($order, $xorder) {
23 for ($w = 0; $w < 2; $w++) {
24 $suf = $w ? 'pd' : 'ps';
25 for ($l = 128; $l <= 256; $l <<= 1) {
26 $sx = ($l == 256) ? 'SY' : 'SO';
27 $mm = ($l == 256) ? 'ymm' : 'xmm';
28 printf "%-15s %-31s %-8s%-39s %s\n",
29 "\U${pi}${o}${suf}",
30 "${mm}reg,${mm}reg,${mm}rm",
31 "[rvm:",
32 sprintf("vex.dds.%d.66.0f38.w%d %02x /r]",
33 $l, $w, $op),
34 "FMA,FUTURE,${sx}";
38 $op += 0x10;
42 foreach $si ( sort(keys(%scalar_insns)) ) {
43 $op = $scalar_insns{$si};
44 foreach $order ('132', '213', '231') {
45 $xorder = substr($order,1,1).substr($order,0,1).substr($order,2,1);
46 foreach $o ($order, $xorder) {
47 for ($w = 0; $w < 2; $w++) {
48 $suf = $w ? 'sd' : 'ss';
49 $sx = $w ? 'SQ' : 'SD';
50 $l = 128;
51 $mm = 'xmm';
52 printf "%-15s %-31s %-8s%-39s %s\n",
53 "\U${si}${o}${suf}",
54 "${mm}reg,${mm}reg,${mm}rm",
55 '[rvm:',
56 sprintf("vex.dds.%d.66.0f38.w%d %02x /r]",
57 $l, $w, $op),
58 "FMA,FUTURE,${sx}";
61 $op += 0x10;