[llvm] [X86][APX] Fix assembly printing for NF+ND shift-by-1 instructions (PR #181565)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 08:48:15 PST 2026


https://github.com/moleium updated https://github.com/llvm/llvm-project/pull/181565

>From ba936d698bf907eb317d6ad5ab7ea93a5bac5151 Mon Sep 17 00:00:00 2001
From: moleium <molenoch at protonmail.com>
Date: Wed, 18 Feb 2026 19:48:03 +0300
Subject: [PATCH] Clang with -mapxf -no-integrated-as generated shift-by-1
 NF+ND instructions without the explicit $1 immediate which causes binutils to
 reject the assembly with 'operand type mismatch'.

Added custom printer in X86ATTInstPrinter.cpp to emit the $1 immediate for
these instructions. Removed DisassembleOnly markers from *r1_NF_ND variants
in X86InstrShiftRotate.td.

Fixes #181553
---
 llvm/lib/Target/X86/X86InstrShiftRotate.td | 16 ++---
 llvm/lib/Target/X86/X86InstrUtils.td       | 18 +++++
 llvm/test/CodeGen/X86/apx/shr.ll           |  8 +--
 llvm/test/MC/Disassembler/X86/apx/rol.txt  |  8 +--
 llvm/test/MC/Disassembler/X86/apx/ror.txt  |  8 +--
 llvm/test/MC/Disassembler/X86/apx/sar.txt  |  8 +--
 llvm/test/MC/Disassembler/X86/apx/shl.txt  |  8 +--
 llvm/test/MC/Disassembler/X86/apx/shr.txt  |  8 +--
 llvm/test/MC/X86/apx/rol-att.s             | 12 ++--
 llvm/test/MC/X86/apx/rol-encopt.s          |  8 +--
 llvm/test/MC/X86/apx/ror-att.s             | 12 ++--
 llvm/test/MC/X86/apx/ror-encopt.s          |  8 +--
 llvm/test/MC/X86/apx/sar-att.s             | 12 ++--
 llvm/test/MC/X86/apx/sar-encopt.s          |  8 +--
 llvm/test/MC/X86/apx/shift-one-att.s       | 81 ++++++++++++++++++++++
 llvm/test/MC/X86/apx/shl-att.s             | 12 ++--
 llvm/test/MC/X86/apx/shl-encopt.s          |  8 +--
 llvm/test/MC/X86/apx/shr-att.s             | 12 ++--
 llvm/test/MC/X86/apx/shr-encopt.s          |  8 +--
 19 files changed, 181 insertions(+), 82 deletions(-)
 create mode 100644 llvm/test/MC/X86/apx/shift-one-att.s

diff --git a/llvm/lib/Target/X86/X86InstrShiftRotate.td b/llvm/lib/Target/X86/X86InstrShiftRotate.td
index 2a5488847e648..1a31abaeeccfb 100644
--- a/llvm/lib/Target/X86/X86InstrShiftRotate.td
+++ b/llvm/lib/Target/X86/X86InstrShiftRotate.td
@@ -70,10 +70,10 @@ multiclass ShiftRotate<string m, Format RegMRM, Format MemMRM, SDPatternOperator
       // GNU binutils distinguish them by adding an explicit $1 to asm string of 8r1_ND. But we haven't support
       // constant immediate in asm string for X86 in TD. So we add DisassembleOnly for 8r1_ND for the time being.
       let Predicates = [In64BitMode] in {
-        def 8r1_ND  : UnaryOpR_RF<0xD1, RegMRM, m, Xi8, null_frag, 1>, DisassembleOnly;
-        def 16r1_ND : UnaryOpR_RF<0xD1, RegMRM, m, Xi16, null_frag, 1>, PD;
-        def 32r1_ND : UnaryOpR_RF<0xD1, RegMRM, m, Xi32, null_frag, 1>;
-        def 64r1_ND : UnaryOpR_RF<0xD1, RegMRM, m, Xi64, null_frag, 1>;
+        def 8r1_ND  : UnaryOpR_RF_1<0xD1, RegMRM, m, Xi8, null_frag, 1>;
+        def 16r1_ND : UnaryOpR_RF_1<0xD1, RegMRM, m, Xi16, null_frag, 1>, PD;
+        def 32r1_ND : UnaryOpR_RF_1<0xD1, RegMRM, m, Xi32, null_frag, 1>;
+        def 64r1_ND : UnaryOpR_RF_1<0xD1, RegMRM, m, Xi64, null_frag, 1>;
 
         def 8r1_EVEX  : UnaryOpR_RF<0xD1, RegMRM, m, Xi8>, PL;
         def 16r1_EVEX : UnaryOpR_RF<0xD1, RegMRM, m, Xi16>, PL, PD;
@@ -181,10 +181,10 @@ multiclass ShiftRotate_NF<string m, Format RegMRM, Format MemMRM, SchedReadWrite
       def 32r1_NF : UnaryOpR_R<0xD1, RegMRM, m, Xi32>, NF;
       def 64r1_NF : UnaryOpR_R<0xD1, RegMRM, m, Xi64>, NF;
 
-      def 8r1_NF_ND  : UnaryOpR_R<0xD1, RegMRM, m, Xi8, null_frag, 1>, EVEX_NF, DisassembleOnly;
-      def 16r1_NF_ND : UnaryOpR_R<0xD1, RegMRM, m, Xi16, null_frag, 1>, EVEX_NF, PD;
-      def 32r1_NF_ND : UnaryOpR_R<0xD1, RegMRM, m, Xi32, null_frag, 1>, EVEX_NF;
-      def 64r1_NF_ND : UnaryOpR_R<0xD1, RegMRM, m, Xi64, null_frag, 1>, EVEX_NF;
+      def 8r1_NF_ND  : UnaryOpR_R_1<0xD1, RegMRM, m, Xi8, null_frag, 1>, EVEX_NF;
+      def 16r1_NF_ND : UnaryOpR_R_1<0xD1, RegMRM, m, Xi16, null_frag, 1>, EVEX_NF, PD;
+      def 32r1_NF_ND : UnaryOpR_R_1<0xD1, RegMRM, m, Xi32, null_frag, 1>, EVEX_NF;
+      def 64r1_NF_ND : UnaryOpR_R_1<0xD1, RegMRM, m, Xi64, null_frag, 1>, EVEX_NF;
     }
 
     let SchedRW = [mi, WriteRMW] in {
diff --git a/llvm/lib/Target/X86/X86InstrUtils.td b/llvm/lib/Target/X86/X86InstrUtils.td
index 6aae90b77fbad..07ddae3fdd847 100644
--- a/llvm/lib/Target/X86/X86InstrUtils.td
+++ b/llvm/lib/Target/X86/X86InstrUtils.td
@@ -1340,6 +1340,16 @@ class UnaryOpR_R<bits<8> o, Format f, string m, X86TypeInfo t,
   : UnaryOpR<o, f, m, !if(!eq(ndd, 0), unaryop_args, unaryop_ndd_args), t,
              (outs t.RegClass:$dst),
              [(set t.RegClass:$dst, (node t.RegClass:$src1))]>, NDD<ndd>;
+
+// UnaryOpR_R_1 - Instructions that read "reg" and write "reg" with explicit $1.
+class UnaryOpR_R_1<bits<8> o, Format f, string m, X86TypeInfo t,
+                  SDPatternOperator node = null_frag, bit ndd = 0>
+  : UnaryOpR<o, f, m, !if(!eq(ndd, 0), unaryop_args, "{$$1, $src1, $dst|$dst, $src1, 1}"), t,
+             (outs t.RegClass:$dst),
+             [(set t.RegClass:$dst, (node t.RegClass:$src1))]>, NDD<ndd>;
+
+
+
 // UnaryOpR_RF - Instructions that read "reg" and write "reg"/EFLAGS.
 class UnaryOpR_RF<bits<8> o, Format f, string m, X86TypeInfo t,
                   SDPatternOperator node = null_frag, bit ndd = 0>
@@ -1348,6 +1358,14 @@ class UnaryOpR_RF<bits<8> o, Format f, string m, X86TypeInfo t,
              [(set t.RegClass:$dst, (node t.RegClass:$src1))]>,
     DefEFLAGS, NDD<ndd>;
 
+// UnaryOpR_RF_1 - Instructions that read "reg" and write "reg"/EFLAGS with explicit $1.
+class UnaryOpR_RF_1<bits<8> o, Format f, string m, X86TypeInfo t,
+                  SDPatternOperator node = null_frag, bit ndd = 0>
+  : UnaryOpR<o, f, m, !if(!eq(ndd, 0), unaryop_args, "{$$1, $src1, $dst|$dst, $src1, 1}"), t,
+             (outs t.RegClass:$dst),
+             [(set t.RegClass:$dst, (node t.RegClass:$src1))]>,
+    DefEFLAGS, NDD<ndd>;
+
 // UnaryOpM - Instructions that read "[mem]".
 class UnaryOpM<bits<8> o, Format f, string m, string args, X86TypeInfo t,
                dag out, list<dag> p>
diff --git a/llvm/test/CodeGen/X86/apx/shr.ll b/llvm/test/CodeGen/X86/apx/shr.ll
index b82000bd950dc..acbd6a66408b9 100644
--- a/llvm/test/CodeGen/X86/apx/shr.ll
+++ b/llvm/test/CodeGen/X86/apx/shr.ll
@@ -303,7 +303,7 @@ define i8 @shr8r1(i8 noundef %a) {
 ;
 ; NF-LABEL: shr8r1:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    {nf} shrb %dil, %al # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xd0,0xef]
+; NF-NEXT:    {nf} shrb $1, %dil, %al # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xd0,0xef]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %shr = lshr i8 %a, 1
@@ -318,7 +318,7 @@ define i16 @shr16r1(i16 noundef %a) {
 ;
 ; NF-LABEL: shr16r1:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    {nf} shrw %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd1,0xef]
+; NF-NEXT:    {nf} shrw $1, %di, %ax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7d,0x1c,0xd1,0xef]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %shr = lshr i16 %a, 1
@@ -333,7 +333,7 @@ define i32 @shr32r1(i32 noundef %a) {
 ;
 ; NF-LABEL: shr32r1:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    {nf} shrl %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xd1,0xef]
+; NF-NEXT:    {nf} shrl $1, %edi, %eax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0x7c,0x1c,0xd1,0xef]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %shr = lshr i32 %a, 1
@@ -348,7 +348,7 @@ define i64 @shr64r1(i64 noundef %a) {
 ;
 ; NF-LABEL: shr64r1:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    {nf} shrq %rdi, %rax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0xfc,0x1c,0xd1,0xef]
+; NF-NEXT:    {nf} shrq $1, %rdi, %rax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0xfc,0x1c,0xd1,0xef]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %shr = lshr i64 %a, 1
diff --git a/llvm/test/MC/Disassembler/X86/apx/rol.txt b/llvm/test/MC/Disassembler/X86/apx/rol.txt
index bb713d1c88566..92298c36c49a9 100644
--- a/llvm/test/MC/Disassembler/X86/apx/rol.txt
+++ b/llvm/test/MC/Disassembler/X86/apx/rol.txt
@@ -141,7 +141,7 @@
 # INTEL: rol	bl, bl
 0x62,0xf4,0x64,0x18,0xd0,0xc3
 
-# ATT:   {nf}	rolb	%bl, %bl
+# ATT:   {nf}	rolb	$1, %bl, %bl
 # INTEL: {nf}	rol	bl, bl
 0x62,0xf4,0x64,0x1c,0xd0,0xc3
 
@@ -285,7 +285,7 @@
 # INTEL: rol	dx, dx
 0x62,0xf4,0x6d,0x18,0xd1,0xc2
 
-# ATT:   {nf}	rolw	%dx, %dx
+# ATT:   {nf}	rolw	$1, %dx, %dx
 # INTEL: {nf}	rol	dx, dx
 0x62,0xf4,0x6d,0x1c,0xd1,0xc2
 
@@ -301,7 +301,7 @@
 # INTEL: rol	ecx, ecx
 0x62,0xf4,0x74,0x18,0xd1,0xc1
 
-# ATT:   {nf}	roll	%ecx, %ecx
+# ATT:   {nf}	roll	$1, %ecx, %ecx
 # INTEL: {nf}	rol	ecx, ecx
 0x62,0xf4,0x74,0x1c,0xd1,0xc1
 
@@ -317,7 +317,7 @@
 # INTEL: rol	r9, r9
 0x62,0xd4,0xb4,0x18,0xd1,0xc1
 
-# ATT:   {nf}	rolq	%r9, %r9
+# ATT:   {nf}	rolq	$1, %r9, %r9
 # INTEL: {nf}	rol	r9, r9
 0x62,0xd4,0xb4,0x1c,0xd1,0xc1
 
diff --git a/llvm/test/MC/Disassembler/X86/apx/ror.txt b/llvm/test/MC/Disassembler/X86/apx/ror.txt
index 484a3e143fdac..2a954f82d48a2 100644
--- a/llvm/test/MC/Disassembler/X86/apx/ror.txt
+++ b/llvm/test/MC/Disassembler/X86/apx/ror.txt
@@ -141,7 +141,7 @@
 # INTEL: ror	bl, bl
 0x62,0xf4,0x64,0x18,0xd0,0xcb
 
-# ATT:   {nf}	rorb	%bl, %bl
+# ATT:   {nf}	rorb	$1, %bl, %bl
 # INTEL: {nf}	ror	bl, bl
 0x62,0xf4,0x64,0x1c,0xd0,0xcb
 
@@ -285,7 +285,7 @@
 # INTEL: ror	dx, dx
 0x62,0xf4,0x6d,0x18,0xd1,0xca
 
-# ATT:   {nf}	rorw	%dx, %dx
+# ATT:   {nf}	rorw	$1, %dx, %dx
 # INTEL: {nf}	ror	dx, dx
 0x62,0xf4,0x6d,0x1c,0xd1,0xca
 
@@ -301,7 +301,7 @@
 # INTEL: ror	ecx, ecx
 0x62,0xf4,0x74,0x18,0xd1,0xc9
 
-# ATT:   {nf}	rorl	%ecx, %ecx
+# ATT:   {nf}	rorl	$1, %ecx, %ecx
 # INTEL: {nf}	ror	ecx, ecx
 0x62,0xf4,0x74,0x1c,0xd1,0xc9
 
@@ -317,7 +317,7 @@
 # INTEL: ror	r9, r9
 0x62,0xd4,0xb4,0x18,0xd1,0xc9
 
-# ATT:   {nf}	rorq	%r9, %r9
+# ATT:   {nf}	rorq	$1, %r9, %r9
 # INTEL: {nf}	ror	r9, r9
 0x62,0xd4,0xb4,0x1c,0xd1,0xc9
 
diff --git a/llvm/test/MC/Disassembler/X86/apx/sar.txt b/llvm/test/MC/Disassembler/X86/apx/sar.txt
index b5e41ee956ccd..fca8b2ccec3ce 100644
--- a/llvm/test/MC/Disassembler/X86/apx/sar.txt
+++ b/llvm/test/MC/Disassembler/X86/apx/sar.txt
@@ -141,7 +141,7 @@
 # INTEL: sar	bl, bl
 0x62,0xf4,0x64,0x18,0xd0,0xfb
 
-# ATT:   {nf}	sarb	%bl, %bl
+# ATT:   {nf}	sarb	$1, %bl, %bl
 # INTEL: {nf}	sar	bl, bl
 0x62,0xf4,0x64,0x1c,0xd0,0xfb
 
@@ -285,7 +285,7 @@
 # INTEL: sar	dx, dx
 0x62,0xf4,0x6d,0x18,0xd1,0xfa
 
-# ATT:   {nf}	sarw	%dx, %dx
+# ATT:   {nf}	sarw	$1, %dx, %dx
 # INTEL: {nf}	sar	dx, dx
 0x62,0xf4,0x6d,0x1c,0xd1,0xfa
 
@@ -301,7 +301,7 @@
 # INTEL: sar	ecx, ecx
 0x62,0xf4,0x74,0x18,0xd1,0xf9
 
-# ATT:   {nf}	sarl	%ecx, %ecx
+# ATT:   {nf}	sarl	$1, %ecx, %ecx
 # INTEL: {nf}	sar	ecx, ecx
 0x62,0xf4,0x74,0x1c,0xd1,0xf9
 
@@ -317,7 +317,7 @@
 # INTEL: sar	r9, r9
 0x62,0xd4,0xb4,0x18,0xd1,0xf9
 
-# ATT:   {nf}	sarq	%r9, %r9
+# ATT:   {nf}	sarq	$1, %r9, %r9
 # INTEL: {nf}	sar	r9, r9
 0x62,0xd4,0xb4,0x1c,0xd1,0xf9
 
diff --git a/llvm/test/MC/Disassembler/X86/apx/shl.txt b/llvm/test/MC/Disassembler/X86/apx/shl.txt
index 6f0b1b9a2af2e..3f2bb99526361 100644
--- a/llvm/test/MC/Disassembler/X86/apx/shl.txt
+++ b/llvm/test/MC/Disassembler/X86/apx/shl.txt
@@ -141,7 +141,7 @@
 # INTEL: shl	bl, bl
 0x62,0xf4,0x64,0x18,0xd0,0xe3
 
-# ATT:   {nf}	shlb	%bl, %bl
+# ATT:   {nf}	shlb	$1, %bl, %bl
 # INTEL: {nf}	shl	bl, bl
 0x62,0xf4,0x64,0x1c,0xd0,0xe3
 
@@ -285,7 +285,7 @@
 # INTEL: shl	dx, dx
 0x62,0xf4,0x6d,0x18,0xd1,0xe2
 
-# ATT:   {nf}	shlw	%dx, %dx
+# ATT:   {nf}	shlw	$1, %dx, %dx
 # INTEL: {nf}	shl	dx, dx
 0x62,0xf4,0x6d,0x1c,0xd1,0xe2
 
@@ -301,7 +301,7 @@
 # INTEL: shl	ecx, ecx
 0x62,0xf4,0x74,0x18,0xd1,0xe1
 
-# ATT:   {nf}	shll	%ecx, %ecx
+# ATT:   {nf}	shll	$1, %ecx, %ecx
 # INTEL: {nf}	shl	ecx, ecx
 0x62,0xf4,0x74,0x1c,0xd1,0xe1
 
@@ -317,7 +317,7 @@
 # INTEL: shl	r9, r9
 0x62,0xd4,0xb4,0x18,0xd1,0xe1
 
-# ATT:   {nf}	shlq	%r9, %r9
+# ATT:   {nf}	shlq	$1, %r9, %r9
 # INTEL: {nf}	shl	r9, r9
 0x62,0xd4,0xb4,0x1c,0xd1,0xe1
 
diff --git a/llvm/test/MC/Disassembler/X86/apx/shr.txt b/llvm/test/MC/Disassembler/X86/apx/shr.txt
index 1e7e1732b56fb..2ac2e32d46466 100644
--- a/llvm/test/MC/Disassembler/X86/apx/shr.txt
+++ b/llvm/test/MC/Disassembler/X86/apx/shr.txt
@@ -141,7 +141,7 @@
 # INTEL: shr	bl, bl
 0x62,0xf4,0x64,0x18,0xd0,0xeb
 
-# ATT:   {nf}	shrb	%bl, %bl
+# ATT:   {nf}	shrb	$1, %bl, %bl
 # INTEL: {nf}	shr	bl, bl
 0x62,0xf4,0x64,0x1c,0xd0,0xeb
 
@@ -285,7 +285,7 @@
 # INTEL: shr	dx, dx
 0x62,0xf4,0x6d,0x18,0xd1,0xea
 
-# ATT:   {nf}	shrw	%dx, %dx
+# ATT:   {nf}	shrw	$1, %dx, %dx
 # INTEL: {nf}	shr	dx, dx
 0x62,0xf4,0x6d,0x1c,0xd1,0xea
 
@@ -301,7 +301,7 @@
 # INTEL: shr	ecx, ecx
 0x62,0xf4,0x74,0x18,0xd1,0xe9
 
-# ATT:   {nf}	shrl	%ecx, %ecx
+# ATT:   {nf}	shrl	$1, %ecx, %ecx
 # INTEL: {nf}	shr	ecx, ecx
 0x62,0xf4,0x74,0x1c,0xd1,0xe9
 
@@ -317,7 +317,7 @@
 # INTEL: shr	r9, r9
 0x62,0xd4,0xb4,0x18,0xd1,0xe9
 
-# ATT:   {nf}	shrq	%r9, %r9
+# ATT:   {nf}	shrq	$1, %r9, %r9
 # INTEL: {nf}	shr	r9, r9
 0x62,0xd4,0xb4,0x1c,0xd1,0xe9
 
diff --git a/llvm/test/MC/X86/apx/rol-att.s b/llvm/test/MC/X86/apx/rol-att.s
index 30c1c3a9ffe4c..494d86e61053d 100644
--- a/llvm/test/MC/X86/apx/rol-att.s
+++ b/llvm/test/MC/X86/apx/rol-att.s
@@ -210,9 +210,9 @@
 # CHECK: rolw	%dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x18,0xd1,0xc2]
          rolw	%dx, %dx
-# CHECK: {nf}	rolw	%dx, %dx
+# CHECK: {nf}	rolw	$1, %dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xc2]
-         {nf}	rolw	%dx, %dx
+         {nf}	rolw	$1, %dx, %dx
 # CHECK: {evex}	roll	%ecx
 # CHECK: encoding: [0x62,0xf4,0x7c,0x08,0xd1,0xc1]
          {evex}	roll	%ecx
@@ -222,9 +222,9 @@
 # CHECK: roll	%ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x18,0xd1,0xc1]
          roll	%ecx, %ecx
-# CHECK: {nf}	roll	%ecx, %ecx
+# CHECK: {nf}	roll	$1, %ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x1c,0xd1,0xc1]
-         {nf}	roll	%ecx, %ecx
+         {nf}	roll	$1, %ecx, %ecx
 # CHECK: {evex}	rolq	%r9
 # CHECK: encoding: [0x62,0xd4,0xfc,0x08,0xd1,0xc1]
          {evex}	rolq	%r9
@@ -234,9 +234,9 @@
 # CHECK: rolq	%r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x18,0xd1,0xc1]
          rolq	%r9, %r9
-# CHECK: {nf}	rolq	%r9, %r9
+# CHECK: {nf}	rolq	$1, %r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x1c,0xd1,0xc1]
-         {nf}	rolq	%r9, %r9
+         {nf}	rolq	$1, %r9, %r9
 # CHECK: {evex}	rolb	291(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x7c,0x08,0xd0,0x84,0x80,0x23,0x01,0x00,0x00]
          {evex}	rolb	291(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/rol-encopt.s b/llvm/test/MC/X86/apx/rol-encopt.s
index d154779d1f626..b4e94c125eb6c 100644
--- a/llvm/test/MC/X86/apx/rol-encopt.s
+++ b/llvm/test/MC/X86/apx/rol-encopt.s
@@ -36,16 +36,16 @@
 # CHECK: rolq	%rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x18,0xd1,0xc0]
          rolq	$1, %rax, %rbx
-# CHECK: {nf}	rolb	%al, %bl
+# CHECK: {nf}	rolb	$1, %al, %bl
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd0,0xc0]
          {nf}	rolb	$1, %al, %bl
-# CHECK: {nf}	rolw	%ax, %bx
+# CHECK: {nf}	rolw	$1, %ax, %bx
 # CHECK: encoding: [0x62,0xf4,0x65,0x1c,0xd1,0xc0]
          {nf}	rolw	$1, %ax, %bx
-# CHECK: {nf}	roll	%eax, %ebx
+# CHECK: {nf}	roll	$1, %eax, %ebx
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd1,0xc0]
          {nf}	roll	$1, %eax, %ebx
-# CHECK: {nf}	rolq	%rax, %rbx
+# CHECK: {nf}	rolq	$1, %rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x1c,0xd1,0xc0]
          {nf}	rolq	$1, %rax, %rbx
 # CHECK: {evex}	rolb	123(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/ror-att.s b/llvm/test/MC/X86/apx/ror-att.s
index aa877f20e4e5d..70338ad7d20e1 100644
--- a/llvm/test/MC/X86/apx/ror-att.s
+++ b/llvm/test/MC/X86/apx/ror-att.s
@@ -210,9 +210,9 @@
 # CHECK: rorw	%dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x18,0xd1,0xca]
          rorw	%dx, %dx
-# CHECK: {nf}	rorw	%dx, %dx
+# CHECK: {nf}	rorw	$1, %dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xca]
-         {nf}	rorw	%dx, %dx
+         {nf}	rorw	$1, %dx, %dx
 # CHECK: {evex}	rorl	%ecx
 # CHECK: encoding: [0x62,0xf4,0x7c,0x08,0xd1,0xc9]
          {evex}	rorl	%ecx
@@ -222,9 +222,9 @@
 # CHECK: rorl	%ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x18,0xd1,0xc9]
          rorl	%ecx, %ecx
-# CHECK: {nf}	rorl	%ecx, %ecx
+# CHECK: {nf}	rorl	$1, %ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x1c,0xd1,0xc9]
-         {nf}	rorl	%ecx, %ecx
+         {nf}	rorl	$1, %ecx, %ecx
 # CHECK: {evex}	rorq	%r9
 # CHECK: encoding: [0x62,0xd4,0xfc,0x08,0xd1,0xc9]
          {evex}	rorq	%r9
@@ -234,9 +234,9 @@
 # CHECK: rorq	%r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x18,0xd1,0xc9]
          rorq	%r9, %r9
-# CHECK: {nf}	rorq	%r9, %r9
+# CHECK: {nf}	rorq	$1, %r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x1c,0xd1,0xc9]
-         {nf}	rorq	%r9, %r9
+         {nf}	rorq	$1, %r9, %r9
 # CHECK: {evex}	rorb	291(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x7c,0x08,0xd0,0x8c,0x80,0x23,0x01,0x00,0x00]
          {evex}	rorb	291(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/ror-encopt.s b/llvm/test/MC/X86/apx/ror-encopt.s
index f1033a60f7d5c..c86bd99a66f65 100644
--- a/llvm/test/MC/X86/apx/ror-encopt.s
+++ b/llvm/test/MC/X86/apx/ror-encopt.s
@@ -36,16 +36,16 @@
 # CHECK: rorq	%rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x18,0xd1,0xc8]
          rorq	$1, %rax, %rbx
-# CHECK: {nf}	rorb	%al, %bl
+# CHECK: {nf}	rorb	$1, %al, %bl
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd0,0xc8]
          {nf}	rorb	$1, %al, %bl
-# CHECK: {nf}	rorw	%ax, %bx
+# CHECK: {nf}	rorw	$1, %ax, %bx
 # CHECK: encoding: [0x62,0xf4,0x65,0x1c,0xd1,0xc8]
          {nf}	rorw	$1, %ax, %bx
-# CHECK: {nf}	rorl	%eax, %ebx
+# CHECK: {nf}	rorl	$1, %eax, %ebx
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd1,0xc8]
          {nf}	rorl	$1, %eax, %ebx
-# CHECK: {nf}	rorq	%rax, %rbx
+# CHECK: {nf}	rorq	$1, %rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x1c,0xd1,0xc8]
          {nf}	rorq	$1, %rax, %rbx
 # CHECK: {evex}	rorb	123(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/sar-att.s b/llvm/test/MC/X86/apx/sar-att.s
index 9ab96f277bc70..eb80497b7291c 100644
--- a/llvm/test/MC/X86/apx/sar-att.s
+++ b/llvm/test/MC/X86/apx/sar-att.s
@@ -210,9 +210,9 @@
 # CHECK: sarw	%dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x18,0xd1,0xfa]
          sarw	%dx, %dx
-# CHECK: {nf}	sarw	%dx, %dx
+# CHECK: {nf}	sarw	$1, %dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xfa]
-         {nf}	sarw	%dx, %dx
+         {nf}	sarw	$1, %dx, %dx
 # CHECK: {evex}	sarl	%ecx
 # CHECK: encoding: [0x62,0xf4,0x7c,0x08,0xd1,0xf9]
          {evex}	sarl	%ecx
@@ -222,9 +222,9 @@
 # CHECK: sarl	%ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x18,0xd1,0xf9]
          sarl	%ecx, %ecx
-# CHECK: {nf}	sarl	%ecx, %ecx
+# CHECK: {nf}	sarl	$1, %ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x1c,0xd1,0xf9]
-         {nf}	sarl	%ecx, %ecx
+         {nf}	sarl	$1, %ecx, %ecx
 # CHECK: {evex}	sarq	%r9
 # CHECK: encoding: [0x62,0xd4,0xfc,0x08,0xd1,0xf9]
          {evex}	sarq	%r9
@@ -234,9 +234,9 @@
 # CHECK: sarq	%r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x18,0xd1,0xf9]
          sarq	%r9, %r9
-# CHECK: {nf}	sarq	%r9, %r9
+# CHECK: {nf}	sarq	$1, %r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x1c,0xd1,0xf9]
-         {nf}	sarq	%r9, %r9
+         {nf}	sarq	$1, %r9, %r9
 # CHECK: {evex}	sarb	291(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x7c,0x08,0xd0,0xbc,0x80,0x23,0x01,0x00,0x00]
          {evex}	sarb	291(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/sar-encopt.s b/llvm/test/MC/X86/apx/sar-encopt.s
index 1399536bf1f7c..a85a17ff706ee 100644
--- a/llvm/test/MC/X86/apx/sar-encopt.s
+++ b/llvm/test/MC/X86/apx/sar-encopt.s
@@ -36,16 +36,16 @@
 # CHECK: sarq	%rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x18,0xd1,0xf8]
          sarq	$1, %rax, %rbx
-# CHECK: {nf}	sarb	%al, %bl
+# CHECK: {nf}	sarb	$1, %al, %bl
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd0,0xf8]
          {nf}	sarb	$1, %al, %bl
-# CHECK: {nf}	sarw	%ax, %bx
+# CHECK: {nf}	sarw	$1, %ax, %bx
 # CHECK: encoding: [0x62,0xf4,0x65,0x1c,0xd1,0xf8]
          {nf}	sarw	$1, %ax, %bx
-# CHECK: {nf}	sarl	%eax, %ebx
+# CHECK: {nf}	sarl	$1, %eax, %ebx
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd1,0xf8]
          {nf}	sarl	$1, %eax, %ebx
-# CHECK: {nf}	sarq	%rax, %rbx
+# CHECK: {nf}	sarq	$1, %rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x1c,0xd1,0xf8]
          {nf}	sarq	$1, %rax, %rbx
 # CHECK: {evex}	sarb	123(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/shift-one-att.s b/llvm/test/MC/X86/apx/shift-one-att.s
new file mode 100644
index 0000000000000..ee5f3b0b7720e
--- /dev/null
+++ b/llvm/test/MC/X86/apx/shift-one-att.s
@@ -0,0 +1,81 @@
+# RUN: llvm-mc -triple x86_64 -show-encoding %s | FileCheck %s
+
+# CHECK: {nf} shlb $1, %cl, %dl
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd0,0xe1]
+{nf} shlb $1, %cl, %dl
+
+# CHECK: {nf} shlw $1, %cx, %dx
+# CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xe1]
+{nf} shlw $1, %cx, %dx
+
+# CHECK: {nf} shll $1, %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd1,0xe1]
+{nf} shll $1, %ecx, %edx
+
+# CHECK: {nf} shlq $1, %rcx, %rdx
+# CHECK: encoding: [0x62,0xf4,0xec,0x1c,0xd1,0xe1]
+{nf} shlq $1, %rcx, %rdx
+
+# CHECK: {nf} shrb $1, %cl, %dl
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd0,0xe9]
+{nf} shrb $1, %cl, %dl
+
+# CHECK: {nf} shrw $1, %cx, %dx
+# CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xe9]
+{nf} shrw $1, %cx, %dx
+
+# CHECK: {nf} shrl $1, %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd1,0xe9]
+{nf} shrl $1, %ecx, %edx
+
+# CHECK: {nf} shrq $1, %rcx, %rdx
+# CHECK: encoding: [0x62,0xf4,0xec,0x1c,0xd1,0xe9]
+{nf} shrq $1, %rcx, %rdx
+
+# CHECK: {nf} sarb $1, %cl, %dl
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd0,0xf9]
+{nf} sarb $1, %cl, %dl
+
+# CHECK: {nf} sarw $1, %cx, %dx
+# CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xf9]
+{nf} sarw $1, %cx, %dx
+
+# CHECK: {nf} sarl $1, %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd1,0xf9]
+{nf} sarl $1, %ecx, %edx
+
+# CHECK: {nf} sarq $1, %rcx, %rdx
+# CHECK: encoding: [0x62,0xf4,0xec,0x1c,0xd1,0xf9]
+{nf} sarq $1, %rcx, %rdx
+
+# CHECK: {nf} rolb $1, %cl, %dl
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd0,0xc1]
+{nf} rolb $1, %cl, %dl
+
+# CHECK: {nf} rolw $1, %cx, %dx
+# CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xc1]
+{nf} rolw $1, %cx, %dx
+
+# CHECK: {nf} roll $1, %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd1,0xc1]
+{nf} roll $1, %ecx, %edx
+
+# CHECK: {nf} rolq $1, %rcx, %rdx
+# CHECK: encoding: [0x62,0xf4,0xec,0x1c,0xd1,0xc1]
+{nf} rolq $1, %rcx, %rdx
+
+# CHECK: {nf} rorb $1, %cl, %dl
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd0,0xc9]
+{nf} rorb $1, %cl, %dl
+
+# CHECK: {nf} rorw $1, %cx, %dx
+# CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xc9]
+{nf} rorw $1, %cx, %dx
+
+# CHECK: {nf} rorl $1, %ecx, %edx
+# CHECK: encoding: [0x62,0xf4,0x6c,0x1c,0xd1,0xc9]
+{nf} rorl $1, %ecx, %edx
+
+# CHECK: {nf} rorq $1, %rcx, %rdx
+# CHECK: encoding: [0x62,0xf4,0xec,0x1c,0xd1,0xc9]
+{nf} rorq $1, %rcx, %rdx
diff --git a/llvm/test/MC/X86/apx/shl-att.s b/llvm/test/MC/X86/apx/shl-att.s
index d86f6cf05a7db..a523c0767ac3b 100644
--- a/llvm/test/MC/X86/apx/shl-att.s
+++ b/llvm/test/MC/X86/apx/shl-att.s
@@ -210,9 +210,9 @@
 # CHECK: shlw	%dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x18,0xd1,0xe2]
          shlw	%dx, %dx
-# CHECK: {nf}	shlw	%dx, %dx
+# CHECK: {nf}	shlw	$1, %dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xe2]
-         {nf}	shlw	%dx, %dx
+         {nf}	shlw	$1, %dx, %dx
 # CHECK: {evex}	shll	%ecx
 # CHECK: encoding: [0x62,0xf4,0x7c,0x08,0xd1,0xe1]
          {evex}	shll	%ecx
@@ -222,9 +222,9 @@
 # CHECK: shll	%ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x18,0xd1,0xe1]
          shll	%ecx, %ecx
-# CHECK: {nf}	shll	%ecx, %ecx
+# CHECK: {nf}	shll	$1, %ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x1c,0xd1,0xe1]
-         {nf}	shll	%ecx, %ecx
+         {nf}	shll	$1, %ecx, %ecx
 # CHECK: {evex}	shlq	%r9
 # CHECK: encoding: [0x62,0xd4,0xfc,0x08,0xd1,0xe1]
          {evex}	shlq	%r9
@@ -234,9 +234,9 @@
 # CHECK: shlq	%r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x18,0xd1,0xe1]
          shlq	%r9, %r9
-# CHECK: {nf}	shlq	%r9, %r9
+# CHECK: {nf}	shlq	$1, %r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x1c,0xd1,0xe1]
-         {nf}	shlq	%r9, %r9
+         {nf}	shlq	$1, %r9, %r9
 # CHECK: {evex}	shlb	291(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x7c,0x08,0xd0,0xa4,0x80,0x23,0x01,0x00,0x00]
          {evex}	shlb	291(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/shl-encopt.s b/llvm/test/MC/X86/apx/shl-encopt.s
index 0feeddc140064..5225c867a970d 100644
--- a/llvm/test/MC/X86/apx/shl-encopt.s
+++ b/llvm/test/MC/X86/apx/shl-encopt.s
@@ -36,16 +36,16 @@
 # CHECK: shlq	%rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x18,0xd1,0xe0]
          shlq	$1, %rax, %rbx
-# CHECK: {nf}	shlb	%al, %bl
+# CHECK: {nf}	shlb	$1, %al, %bl
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd0,0xe0]
          {nf}	shlb	$1, %al, %bl
-# CHECK: {nf}	shlw	%ax, %bx
+# CHECK: {nf}	shlw	$1, %ax, %bx
 # CHECK: encoding: [0x62,0xf4,0x65,0x1c,0xd1,0xe0]
          {nf}	shlw	$1, %ax, %bx
-# CHECK: {nf}	shll	%eax, %ebx
+# CHECK: {nf}	shll	$1, %eax, %ebx
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd1,0xe0]
          {nf}	shll	$1, %eax, %ebx
-# CHECK: {nf}	shlq	%rax, %rbx
+# CHECK: {nf}	shlq	$1, %rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x1c,0xd1,0xe0]
          {nf}	shlq	$1, %rax, %rbx
 # CHECK: {evex}	shlb	123(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/shr-att.s b/llvm/test/MC/X86/apx/shr-att.s
index 86656c325de2a..934536422d199 100644
--- a/llvm/test/MC/X86/apx/shr-att.s
+++ b/llvm/test/MC/X86/apx/shr-att.s
@@ -210,9 +210,9 @@
 # CHECK: shrw	%dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x18,0xd1,0xea]
          shrw	%dx, %dx
-# CHECK: {nf}	shrw	%dx, %dx
+# CHECK: {nf}	shrw	$1, %dx, %dx
 # CHECK: encoding: [0x62,0xf4,0x6d,0x1c,0xd1,0xea]
-         {nf}	shrw	%dx, %dx
+         {nf}	shrw	$1, %dx, %dx
 # CHECK: {evex}	shrl	%ecx
 # CHECK: encoding: [0x62,0xf4,0x7c,0x08,0xd1,0xe9]
          {evex}	shrl	%ecx
@@ -222,9 +222,9 @@
 # CHECK: shrl	%ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x18,0xd1,0xe9]
          shrl	%ecx, %ecx
-# CHECK: {nf}	shrl	%ecx, %ecx
+# CHECK: {nf}	shrl	$1, %ecx, %ecx
 # CHECK: encoding: [0x62,0xf4,0x74,0x1c,0xd1,0xe9]
-         {nf}	shrl	%ecx, %ecx
+         {nf}	shrl	$1, %ecx, %ecx
 # CHECK: {evex}	shrq	%r9
 # CHECK: encoding: [0x62,0xd4,0xfc,0x08,0xd1,0xe9]
          {evex}	shrq	%r9
@@ -234,9 +234,9 @@
 # CHECK: shrq	%r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x18,0xd1,0xe9]
          shrq	%r9, %r9
-# CHECK: {nf}	shrq	%r9, %r9
+# CHECK: {nf}	shrq	$1, %r9, %r9
 # CHECK: encoding: [0x62,0xd4,0xb4,0x1c,0xd1,0xe9]
-         {nf}	shrq	%r9, %r9
+         {nf}	shrq	$1, %r9, %r9
 # CHECK: {evex}	shrb	291(%r8,%rax,4)
 # CHECK: encoding: [0x62,0xd4,0x7c,0x08,0xd0,0xac,0x80,0x23,0x01,0x00,0x00]
          {evex}	shrb	291(%r8,%rax,4)
diff --git a/llvm/test/MC/X86/apx/shr-encopt.s b/llvm/test/MC/X86/apx/shr-encopt.s
index 97b6b70086573..b8ec4c18b685c 100644
--- a/llvm/test/MC/X86/apx/shr-encopt.s
+++ b/llvm/test/MC/X86/apx/shr-encopt.s
@@ -36,16 +36,16 @@
 # CHECK: shrq	%rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x18,0xd1,0xe8]
          shrq	$1, %rax, %rbx
-# CHECK: {nf}	shrb	%al, %bl
+# CHECK: {nf}	shrb	$1, %al, %bl
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd0,0xe8]
          {nf}	shrb	$1, %al, %bl
-# CHECK: {nf}	shrw	%ax, %bx
+# CHECK: {nf}	shrw	$1, %ax, %bx
 # CHECK: encoding: [0x62,0xf4,0x65,0x1c,0xd1,0xe8]
          {nf}	shrw	$1, %ax, %bx
-# CHECK: {nf}	shrl	%eax, %ebx
+# CHECK: {nf}	shrl	$1, %eax, %ebx
 # CHECK: encoding: [0x62,0xf4,0x64,0x1c,0xd1,0xe8]
          {nf}	shrl	$1, %eax, %ebx
-# CHECK: {nf}	shrq	%rax, %rbx
+# CHECK: {nf}	shrq	$1, %rax, %rbx
 # CHECK: encoding: [0x62,0xf4,0xe4,0x1c,0xd1,0xe8]
          {nf}	shrq	$1, %rax, %rbx
 # CHECK: {evex}	shrb	123(%r8,%rax,4)



More information about the llvm-commits mailing list