|
|
1.1 root 1: //////////
2: / n1/i386/tables/ashift.t
3: //////////
4:
5: /////////
6: /
7: / Assigned shift left (<<=), assigned shift right (>>=).
8: / Signed and unsigned right shifts are different (SAR != SHR).
9: / Signed and unsigned left shifts are identical (SAL == SHL).
10: / Shifts by byte immediates on are done directly.
11: / Harder shifts use the CL shift opcode.
12: / The [TL OP0] macro maps ZSAL or ZSAR into a signed or unsigned
13: / shift of the appropriate width, e.g. ZSAR could become ZSHR or ZSARB, etc.
14: / The [OP1] macro is just the unsigned shift ZSHL or ZSHR.
15: / This makes this table much shorter; see n1/i386/outmch.c for the gory details.
16: / The result of a shift by more than 32 bits is undefined behavior.
17: / This table simply generates a shift by the arg,
18: / and the i386 uses the shift count modulo 32.
19: /
20: /////////
21:
22: ASHL:
23: ASHR:
24:
25: //////////
26: / Longs.
27: //////////
28:
29: / Integer op= byte constant.
30: % PEFFECT|PVALUE|PREL
31: LONG ANYR * * TEMP
32: ADR|LV SINT|UINT
33: SHCNT|MMX LONG
34: [TL OP0] [AL],[AR]
35: [IFV] [TL ZMOVSX] [R],[AL]
36: [IFR] [REL0] [LAB]
37:
38: #ifdef BOGUS
39: / This entry generates much better code
40: / than the non-BOGUS entries which replaces it,
41: / but it is wrong when [AL] uses ECX for indexing (it gets clobbered).
42: / Retained here in hope of seeing a better way out of this mess sometime.
43: / Integer op= long.
44: % PEFFECT|PVALUE
45: LONG ANYR * ECX TEMP
46: ADR|LV SINT|UINT
47: ADR LONG
48: [ZMOV] [REGNO ECX],[AR]
49: [TL OP0] [AL],[REGNO CL]
50: [IFV] [TL ZMOVSX] [R],[AL]
51: #endif
52:
53: / Long op= long.
54: / Save and restore ECX in case [AL] uses it, cf. remarks above.
55: % PEFFECT|PVALUE
56: LONG ANYR * * TEMP
57: ADR|LV LONG
58: ADR LONG
59: [ZMOV] [R],[AL]
60: [ZPUSH] [REGNO ECX] / save in case [AL] uses it
61: [ZMOV] [REGNO ECX],[AR]
62: [TL OP0] [R],[REGNO CL]
63: [ZPOP] [REGNO ECX] / and restore
64: [ZMOV] [AL],[R]
65:
66: //////////
67: / Words and bytes.
68: //////////
69:
70: / Short op= long.
71: / Save and restore ECX in case [AL] uses it, cf. remarks above.
72: / The [IFV] is necessary e.g. when negative signed arg gets left shifted to 0.
73: % PEFFECT|PVALUE|PBYTE
74: LONG ANYR * * TEMP
75: ADR|LV SHORT
76: ADR LONG
77: [TL ZMOVSX] [R],[AL]
78: [ZPUSH] [REGNO ECX]
79: [ZMOV] [REGNO ECX],[AR]
80: [TL OP0] [TL R],[REGNO CL]
81: [ZPOP] [REGNO ECX]
82: [TL ZMOV] [AL],[TL R]
83: [IFV] [TL ZMOVSX] [R], [TL R]
84:
85: //////////
86: / Fields.
87: //////////
88:
89: / Field op= byte constant.
90: % PEFFECT|PVALUE|PBYTE
91: LONG ANYR * * TEMP
92: ADR|LV FLD
93: SHCNT|MMX LONG
94: [TL ZMOVZX] [R],[AL] / fetch
95: [ZAND] [R],[EMASK] / extract
96: [OP1] [R],[AR] / shift
97: [ZAND] [R],[EMASK] / mask
98: [TL ZAND] [AL],[TL CMASK] / clear
99: [TL ZOR] [AL],[TL R] / store
100:
101: / Long field op= long.
102: % PEFFECT|PVALUE|PBYTE
103: LONG ANYR * * TEMP
104: ADR|LV FLD
105: ADR LONG
106: [TL ZMOVZX] [R],[AL] / fetch
107: [ZAND] [R],[EMASK] / extract
108: [ZPUSH] [REGNO ECX] / save in case [AL] uses it
109: [ZMOV] [REGNO ECX],[AR] / count to CL
110: [OP1] [R],[REGNO CL] / shift
111: [ZPOP] [REGNO ECX] / restore
112: [ZAND] [R],[EMASK] / mask
113: [TL ZAND] [AL],[TL CMASK] / clear
114: [TL ZOR] [AL],[TL R] / store
115:
116: //////////
117: / end of n1/i386/tables/ashift.t
118: //////////
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.