[llvm-branch-commits] [llvm] ae24102 - [X86] Don't add implicit REP prefix to VIA PadLock xstore

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 21 17:09:59 PST 2021


Author: Jessica Clarke
Date: 2021-12-21T16:48:10-08:00
New Revision: ae24102617c9c86552807a598fe6521ca9c6d7ee

URL: https://github.com/llvm/llvm-project/commit/ae24102617c9c86552807a598fe6521ca9c6d7ee
DIFF: https://github.com/llvm/llvm-project/commit/ae24102617c9c86552807a598fe6521ca9c6d7ee.diff

LOG: [X86] Don't add implicit REP prefix to VIA PadLock xstore

Commit 8fa3e8fa1492 added an implicit REP prefix to all VIA PadLock
instructions, but GNU as doesn't add one to xstore, only all the others.
This resulted in a kernel panic regression in FreeBSD upon updating to
LLVM 11 (https://bugs.freebsd.org/259218) which includes the commit in
question. This partially reverts that commit.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D112355

(cherry picked from commit 2d8c18fbbdd1b07ab0d36ac49ef63f4d243afb8b)

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86InstrSystem.td
    llvm/test/MC/X86/padlock.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86InstrSystem.td b/llvm/lib/Target/X86/X86InstrSystem.td
index 48c27051a8723..355ddf26e3bb6 100644
--- a/llvm/lib/Target/X86/X86InstrSystem.td
+++ b/llvm/lib/Target/X86/X86InstrSystem.td
@@ -583,7 +583,7 @@ def XRSTORS64 : RI<0xC7, MRM3m, (outs), (ins opaquemem:$dst),
 //===----------------------------------------------------------------------===//
 // VIA PadLock crypto instructions
 let Defs = [RAX, RDI], Uses = [RDX, RDI], SchedRW = [WriteSystem] in
-  def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB, REP;
+  def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB;
 
 def : InstAlias<"xstorerng", (XSTORE)>;
 

diff  --git a/llvm/test/MC/X86/padlock.s b/llvm/test/MC/X86/padlock.s
index c79d346fa23ee..9f9b16294ea02 100644
--- a/llvm/test/MC/X86/padlock.s
+++ b/llvm/test/MC/X86/padlock.s
@@ -1,8 +1,11 @@
 // RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s
 
+/// Check xstore does not get an implicit REP prefix but all other PadLock
+/// instructions do.
+
 	xstore
 // CHECK: xstore
-// CHECK: encoding: [0xf3,0x0f,0xa7,0xc0]
+// CHECK: encoding: [0x0f,0xa7,0xc0]
 	xcryptecb
 // CHECK: xcryptecb
 // CHECK: encoding: [0xf3,0x0f,0xa7,0xc8]


        


More information about the llvm-branch-commits mailing list