FMA instructions won't be in Sandy Bridge
[nasm/nasm.git] / misc / genfma.pl
blob444fe9e8460f127723d7e48299c5ab03b2d8a455
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 'vfmnadd' => 0x9c,
15 'vfmnsub' => 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 $mm = $w ? 'ymm' : 'xmm';
26 $sx = $w ? 'SY' : 'SO';
27 $ww = $w ? 256 : 128;
28 printf "%-15s %-31s %-47s %s\n",
29 "\U${pi}${o}${suf}",
30 "${mm}reg,${mm}reg,${mm}rm",
31 sprintf("[rvm:\tvex.dds.%d.66.0f38.w%d %02x /r]",
32 $ww, $w, $op),
33 "FMA,FUTURE,${sx}";
34 printf "%-15s %-31s %-47s %s\n",
35 "\U${pi}${o}${suf}",
36 "${mm}reg,${mm}rm",
37 sprintf("[r+vm:\tvex.dds.%d.66.0f38.w%d %02x /r]",
38 $ww, $w, $op),
39 "FMA,FUTURE,${sx}";
42 $op++;
46 foreach $si ( sort(keys(%scalar_insns)) ) {
47 $op = $scalar_insns{$si};
48 foreach $order ('132', '213', '231') {
49 $xorder = substr($order,1,1).substr($order,0,1).substr($order,2,1);
50 foreach $o ($order, $xorder) {
51 for ($w = 0; $w < 2; $w++) {
52 $suf = $w ? 'sd' : 'ss';
53 $mm = 'xmm';
54 $sx = $w ? 'SQ' : 'SD';
55 $ww = 128;
56 printf "%-15s %-31s %-47s %s\n",
57 "\U${si}${o}${suf}",
58 "${mm}reg,${mm}reg,${mm}rm",
59 sprintf("[rvm:\tvex.dds.%d.66.0f38.w%d %02x /r]",
60 $ww, $w, $op),
61 "FMA,FUTURE,${sx}";
62 printf "%-15s %-31s %-47s %s\n",
63 "\U${si}${o}${suf}",
64 "${mm}reg,${mm}rm",
65 sprintf("[r+vm:\tvex.dds.%d.66.0f38.w%d %02x /r]",
66 $ww, $w, $op),
67 "FMA,FUTURE,${sx}";
70 $op++;