@@ -122,6 +122,16 @@ static inline int alternatives_text_reserved(void *start, void *end)
122
122
"(" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")), 0x90\n" \
123
123
alt_end_marker ":\n"
124
124
125
+ #define OLDINSTR_3 (oldinsn , n1 , n2 , n3 ) \
126
+ "# ALT: oldinstr3\n" \
127
+ "661:\n\t" oldinsn "\n662:\n" \
128
+ "# ALT: padding3\n" \
129
+ ".skip -((" alt_max_short(alt_max_short(alt_rlen(n1), alt_rlen(n2)), alt_rlen(n3)) \
130
+ " - (" alt_slen ")) > 0) * " \
131
+ "(" alt_max_short(alt_max_short(alt_rlen(n1), alt_rlen(n2)), alt_rlen(n3)) \
132
+ " - (" alt_slen ")), 0x90\n" \
133
+ alt_end_marker ":\n"
134
+
125
135
#define ALTINSTR_ENTRY (feature , num ) \
126
136
" .long 661b - .\n" /* label */ \
127
137
" .long " b_replacement (num )"f - .\n" /* new instruction */ \
@@ -155,6 +165,19 @@ static inline int alternatives_text_reserved(void *start, void *end)
155
165
ALTINSTR_REPLACEMENT(newinstr2, feature2, 2) \
156
166
".popsection\n"
157
167
168
+ #define ALTERNATIVE_3 (oldinsn , newinsn1 , feat1 , newinsn2 , feat2 , newinsn3 , feat3 ) \
169
+ OLDINSTR_3(oldinsn, 1, 2, 3) \
170
+ ".pushsection .altinstructions,\"a\"\n" \
171
+ ALTINSTR_ENTRY(feat1, 1) \
172
+ ALTINSTR_ENTRY(feat2, 2) \
173
+ ALTINSTR_ENTRY(feat3, 3) \
174
+ ".popsection\n" \
175
+ ".pushsection .altinstr_replacement, \"ax\"\n" \
176
+ ALTINSTR_REPLACEMENT(newinsn1, feat1, 1) \
177
+ ALTINSTR_REPLACEMENT(newinsn2, feat2, 2) \
178
+ ALTINSTR_REPLACEMENT(newinsn3, feat3, 3) \
179
+ ".popsection\n"
180
+
158
181
/*
159
182
* Alternative instructions for different CPU types or capabilities.
160
183
*
0 commit comments