From c6bb32e9d1df5e15b55dbb72aebcf632644ca2ce Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 2 Sep 2025 18:18:07 -0700 Subject: [PATCH] preinsns.pl: don't allow KTEST to be just TEST The semantics for KTEST are so very different from TEST that it would be a bad idea to allow the TEST spelling. Signed-off-by: H. Peter Anvin (Intel) --- x86/preinsns.pl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/x86/preinsns.pl b/x86/preinsns.pl index 01de4124..80499b63 100755 --- a/x86/preinsns.pl +++ b/x86/preinsns.pl @@ -222,25 +222,26 @@ $macros{'k'} = { } # Allow instruction without K - my @on; - foreach my $oi (@ol) { - # Remove first capital K - ($xins = $oi) =~ s/\bK//; - push(@on, $xins); + if ($ins !~ /^\bKTEST/) { + my @on; + foreach my $oi (@ol) { + # Remove first capital K + ($xins = $oi) =~ s/\bK//; + push(@on, $xins); + } + push(@ol, @on); } - push(@ol, @on); - undef @on; # Allow SHIFT -> SH if ($ins =~ /SHIFT/) { + my @on; foreach my $oi (@ol) { # Remove first capital K ($xins = $oi) =~ s/SHIFT/SH/; push(@on, $xins); } - } push(@ol, @on); - undef @on; + } # All instruction patterns except the first are ND for (my $i = 1; $i < scalar(@ol); $i++) {