In a number of cases we use ALTERNATIVE_2 with both replacement insns /
insn sequences being identical. Avoid emitting the same code twice, and
instead alias the necessary helper labels to the existing ones.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
#define decl_repl(insn, nr) .L\@_repl_s\()nr: insn; .L\@_repl_e\()nr:
#define repl_len(nr) (.L\@_repl_e\()nr - .L\@_repl_s\()nr)
+#define clone_repl(new, old) .equiv .L\@_repl_s\()new, .L\@_repl_s\()old; \
+ .equiv .L\@_repl_e\()new, .L\@_repl_e\()old
#define as_max(a, b) ((a) ^ (((a) ^ (b)) & -as_true((a) < (b))))
.section .altinstr_replacement, "ax", @progbits
decl_repl(\newinstr1, 1)
+ .ifnes "\newinstr2", "\newinstr1"
decl_repl(\newinstr2, 2)
+ .else
+ clone_repl(2, 1)
+ .endif
.popsection
.endm