summaryrefslogtreecommitdiff
path: root/misc/genfma.pl
blob: 2b6a65c54ef8b60a3da10630e42732c47b7dc474 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl
%packed_insns = (
    'vfmadd'    => 0x98,
    'vfmaddsub' => 0x96,
    'vfmsubadd' => 0x97,
    'vfmsub'    => 0x9a,
    'vfnmadd'   => 0x9c,
    'vfnmsub'   => 0x9e
    );

%scalar_insns = (
    'vfmadd'    => 0x99,
    'vfmsub'    => 0x9b,
    'vfnmadd'   => 0x9d,
    'vfnmsub'   => 0x9f
    );

foreach $pi ( sort(keys(%packed_insns)) ) {
    $op = $packed_insns{$pi};
    foreach $order ('132', '213', '231') {
	$xorder = substr($order,1,1).substr($order,0,1).substr($order,2,1);
	foreach $o ($order, $xorder) {
	    for ($w = 0; $w < 2; $w++) {
		$suf = $w  ? 'pd' : 'ps';
		for ($l = 128; $l <= 256; $l <<= 1) {
		    $sx  = ($l == 256) ? 'SY' : 'SO';
		    $mm  = ($l == 256) ? 'ymm' : 'xmm';
		    printf "%-15s %-31s %-8s%-39s %s\n",
		    	"\U${pi}${o}${suf}",
			"${mm}reg,${mm}reg,${mm}rm",
		    	"[rvm:",
		        sprintf("vex.dds.%d.66.0f38.w%d %02x /r]",
			    $l, $w, $op),
		    "FMA,FUTURE,${sx}";
		}
	    }
	}
	$op += 0x10;
    }
}

foreach $si ( sort(keys(%scalar_insns)) ) {
    $op = $scalar_insns{$si};
    foreach $order ('132', '213', '231') {
	$xorder = substr($order,1,1).substr($order,0,1).substr($order,2,1);
	foreach $o ($order, $xorder) {
	    for ($w = 0; $w < 2; $w++) {
		$suf = $w ? 'sd' : 'ss';
		$sx  = $w ? 'SQ' : 'SD';
		$l  = 128;
		$mm  = 'xmm';
		printf "%-15s %-31s %-8s%-39s %s\n",
		    "\U${si}${o}${suf}",
		    "${mm}reg,${mm}reg,${mm}rm",
		    '[rvm:',
		    sprintf("vex.dds.%d.66.0f38.w%d %02x /r]",
			$l, $w, $op),
		"FMA,FUTURE,${sx}";
	    }
	}
	$op += 0x10;
    }
}