Debian Codegraph @

internal/load/tables.go

raw symbols SCIP
1 package load
2
3 // alias defines an opcode alias.
4 type alias struct {
5 From string
6 To string
7 }
8
9 // aliases defines a list of opcode aliases. Where possible these are extracted
10 // from the code (see note below).
11 var aliases = []alias{
12 // The PSHUFD/PSHUFL alias is not recorded in the list of "Annoying aliases" below. However the instructions are identical.
13 //
14 // Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/internal/obj/x86/asm6.go#L1365
15 //
16 // {APSHUFL, yxshuf, Pq, opBytes{0x70, 00}},
17 //
18 // Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/internal/obj/x86/asm6.go#L1688
19 //
20 // {APSHUFD, yxshuf, Pq, opBytes{0x70, 0}},
21 //
22 {"PSHUFD", "PSHUFL"},
23 }
24
25 // Go contains a list of self-proclaimed "Annoying aliases", as follows. We use
26 // a script to automatically extract this list from the source code (see the
27 // following go:generate line). Then we merge this with the manual list above.
28 //
29 // Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/asm/internal/arch/arch.go#L126-L182
30 //
31 // }
32 // // Annoying aliases.
33 // instructions["JA"] = x86.AJHI /* alternate */
34 // instructions["JAE"] = x86.AJCC /* alternate */
35 // instructions["JB"] = x86.AJCS /* alternate */
36 // instructions["JBE"] = x86.AJLS /* alternate */
37 // instructions["JC"] = x86.AJCS /* alternate */
38 // instructions["JCC"] = x86.AJCC /* carry clear (CF = 0) */
39 // instructions["JCS"] = x86.AJCS /* carry set (CF = 1) */
40 // instructions["JE"] = x86.AJEQ /* alternate */
41 // instructions["JEQ"] = x86.AJEQ /* equal (ZF = 1) */
42 // instructions["JG"] = x86.AJGT /* alternate */
43 // instructions["JGE"] = x86.AJGE /* greater than or equal (signed) (SF = OF) */
44 // instructions["JGT"] = x86.AJGT /* greater than (signed) (ZF = 0 && SF = OF) */
45 // instructions["JHI"] = x86.AJHI /* higher (unsigned) (CF = 0 && ZF = 0) */
46 // instructions["JHS"] = x86.AJCC /* alternate */
47 // instructions["JL"] = x86.AJLT /* alternate */
48 // instructions["JLE"] = x86.AJLE /* less than or equal (signed) (ZF = 1 || SF != OF) */
49 // instructions["JLO"] = x86.AJCS /* alternate */
50 // instructions["JLS"] = x86.AJLS /* lower or same (unsigned) (CF = 1 || ZF = 1) */
51 // instructions["JLT"] = x86.AJLT /* less than (signed) (SF != OF) */
52 // instructions["JMI"] = x86.AJMI /* negative (minus) (SF = 1) */
53 // instructions["JNA"] = x86.AJLS /* alternate */
54 // instructions["JNAE"] = x86.AJCS /* alternate */
55 // instructions["JNB"] = x86.AJCC /* alternate */
56 // instructions["JNBE"] = x86.AJHI /* alternate */
57 // instructions["JNC"] = x86.AJCC /* alternate */
58 // instructions["JNE"] = x86.AJNE /* not equal (ZF = 0) */
59 // instructions["JNG"] = x86.AJLE /* alternate */
60 // instructions["JNGE"] = x86.AJLT /* alternate */
61 // instructions["JNL"] = x86.AJGE /* alternate */
62 // instructions["JNLE"] = x86.AJGT /* alternate */
63 // instructions["JNO"] = x86.AJOC /* alternate */
64 // instructions["JNP"] = x86.AJPC /* alternate */
65 // instructions["JNS"] = x86.AJPL /* alternate */
66 // instructions["JNZ"] = x86.AJNE /* alternate */
67 // instructions["JO"] = x86.AJOS /* alternate */
68 // instructions["JOC"] = x86.AJOC /* overflow clear (OF = 0) */
69 // instructions["JOS"] = x86.AJOS /* overflow set (OF = 1) */
70 // instructions["JP"] = x86.AJPS /* alternate */
71 // instructions["JPC"] = x86.AJPC /* parity clear (PF = 0) */
72 // instructions["JPE"] = x86.AJPS /* alternate */
73 // instructions["JPL"] = x86.AJPL /* non-negative (plus) (SF = 0) */
74 // instructions["JPO"] = x86.AJPC /* alternate */
75 // instructions["JPS"] = x86.AJPS /* parity set (PF = 1) */
76 // instructions["JS"] = x86.AJMI /* alternate */
77 // instructions["JZ"] = x86.AJEQ /* alternate */
78 // instructions["MASKMOVDQU"] = x86.AMASKMOVOU
79 // instructions["MOVD"] = x86.AMOVQ
80 // instructions["MOVDQ2Q"] = x86.AMOVQ
81 // instructions["MOVNTDQ"] = x86.AMOVNTO
82 // instructions["MOVOA"] = x86.AMOVO
83 // instructions["PSLLDQ"] = x86.APSLLO
84 // instructions["PSRLDQ"] = x86.APSRLO
85 // instructions["PADDD"] = x86.APADDL
86 //
87 // return &Arch{
88 //
89
90 //go:generate ./annoyingaliases.sh zannoyingaliases.go
91
92 func init() {
93 aliases = append(aliases, annoyingaliases...)
94 }
95
96 // maskrequired is a set of AVX-512 opcodes where the mask register is required.
97 // Usually the mask register can be omitted, in which case K0 is implied.
98 var maskrequired = map[string]bool{
99 // Reference: https://github.com/golang/go/blob/4fd94558820100129b98f284e21b19fc27a99926/src/cmd/internal/obj/x86/asm6.go#L4219-L4240
100 //
101 // // Checks to warn about instruction/arguments combinations that
102 // // will unconditionally trigger illegal instruction trap (#UD).
103 // switch p.As {
104 // case AVGATHERDPD,
105 // AVGATHERQPD,
106 // AVGATHERDPS,
107 // AVGATHERQPS,
108 // AVPGATHERDD,
109 // AVPGATHERQD,
110 // AVPGATHERDQ,
111 // AVPGATHERQQ:
112 // // AVX512 gather requires explicit K mask.
113 // if p.GetFrom3().Reg >= REG_K0 && p.GetFrom3().Reg <= REG_K7 {
114 // if !avx512gatherValid(ctxt, p) {
115 // return
116 // }
117 // } else {
118 // if !avx2gatherValid(ctxt, p) {
119 // return
120 // }
121 // }
122 // }
123 //
124 "VGATHERDPD": true,
125 "VGATHERQPD": true,
126 "VGATHERDPS": true,
127 "VGATHERQPS": true,
128 "VPGATHERDD": true,
129 "VPGATHERQD": true,
130 "VPGATHERDQ": true,
131 "VPGATHERQQ": true,
132
133 // Restriction applies to SCATTER instructions too.
134 "VPSCATTERDD": true,
135 "VPSCATTERDQ": true,
136 "VPSCATTERQD": true,
137 "VPSCATTERQQ": true,
138 "VSCATTERDPD": true,
139 "VSCATTERDPS": true,
140 "VSCATTERQPD": true,
141 "VSCATTERQPS": true,
142 }