Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[X86][MC] Support encoding optimization & assembler relaxation about immediate operands for APX instructions #78545

Merged
merged 3 commits into from
Jan 30, 2024

Conversation

XinWang10
Copy link
Contributor

@XinWang10 XinWang10 commented Jan 18, 2024

Encoding optimization:

mi/mi32 -> mi8
ri/ri32 -> ri8

if the immediate operand is 8-bit wide.

Assembler relaxation:

mi8 -> mi/mi32
ri8 -> ri/ri32

If the immediate operand is a symbol expression and it's value is unknown.

@KanRobert
Copy link
Contributor

Wait... I think this should be landed after all NDD instructions are supported.

Comment on lines 72 to 77
ENTRY(ADC16mi_ND, ADC16mi8_ND)
ENTRY(ADC16ri_ND, ADC16ri8_ND)
ENTRY(ADC32mi_ND, ADC32mi8_ND)
ENTRY(ADC32ri_ND, ADC32ri8_ND)
ENTRY(ADC64mi32_ND, ADC64mi8_ND)
ENTRY(ADC64ri32_ND, ADC64ri8_ND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to support for shift/rotate instructions too.

@KanRobert
Copy link
Contributor

I remember we have separate tests for encoding optimization for APX.

@XinWang10
Copy link
Contributor Author

I remember we have separate tests for encoding optimization for APX.

Seems yes, I forgot that :(, then --show-mc-encoding is not that necessary.

@KanRobert
Copy link
Contributor

I remember we have separate tests for encoding optimization for APX.

Seems yes, I forgot that :(, then --show-mc-encoding is not that necessary.

We can keep it for NDD2NonDD compress

@KanRobert KanRobert changed the title [X86] Support immediate encoding optimization for ndd instructions [X86] Support encoding optimization & assembler relaxation about immediate operands for APX instructions Jan 26, 2024
@KanRobert KanRobert changed the title [X86] Support encoding optimization & assembler relaxation about immediate operands for APX instructions [X86][MC] Support encoding optimization & assembler relaxation about immediate operands for APX instructions Jan 26, 2024
@XinWang10 XinWang10 marked this pull request as ready for review January 29, 2024 03:22
@llvmbot llvmbot added backend:X86 mc Machine (object) code labels Jan 29, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 29, 2024

@llvm/pr-subscribers-mc

@llvm/pr-subscribers-backend-x86

Author: None (XinWang10)

Changes

Encoding optimization:

mi/mi32 -> mi8
ri/ri32 -> ri8

if the immediate operand is 8-bit wide.

Assembler relaxation:

mi8 -> mi/mi32
ri8 -> ri/ri32

If the immediate operand is a symbol expression and it's value is unknown.


Patch is 91.14 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/78545.diff

28 Files Affected:

  • (modified) llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.cpp (+31-8)
  • (modified) llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimizationForImmediate.def (+65-48)
  • (modified) llvm/test/CodeGen/X86/apx/adc.ll (+9-9)
  • (modified) llvm/test/CodeGen/X86/apx/add.ll (+8-8)
  • (modified) llvm/test/CodeGen/X86/apx/and.ll (+7-7)
  • (modified) llvm/test/CodeGen/X86/apx/or.ll (+8-8)
  • (modified) llvm/test/CodeGen/X86/apx/rol.ll (+8-8)
  • (modified) llvm/test/CodeGen/X86/apx/sar.ll (+6-6)
  • (modified) llvm/test/CodeGen/X86/apx/sbb.ll (+12-12)
  • (modified) llvm/test/CodeGen/X86/apx/shift-eflags.ll (+3-3)
  • (modified) llvm/test/CodeGen/X86/apx/shr.ll (+6-6)
  • (modified) llvm/test/CodeGen/X86/apx/sub.ll (+8-8)
  • (modified) llvm/test/CodeGen/X86/apx/xor.ll (+10-10)
  • (added) llvm/test/MC/X86/apx/adc-reloc.s (+22)
  • (added) llvm/test/MC/X86/apx/add-reloc.s (+38)
  • (added) llvm/test/MC/X86/apx/and-reloc.s (+38)
  • (added) llvm/test/MC/X86/apx/imul-reloc.s (+18)
  • (added) llvm/test/MC/X86/apx/or-reloc.s (+38)
  • (added) llvm/test/MC/X86/apx/rcl-encopt.s (+51)
  • (added) llvm/test/MC/X86/apx/rcr-encopt.s (+50)
  • (added) llvm/test/MC/X86/apx/rol-encopt.s (+98)
  • (added) llvm/test/MC/X86/apx/ror-encopt.s (+98)
  • (added) llvm/test/MC/X86/apx/sar-encopt.s (+98)
  • (added) llvm/test/MC/X86/apx/sbb-reloc.s (+22)
  • (added) llvm/test/MC/X86/apx/shl-encopt.s (+98)
  • (added) llvm/test/MC/X86/apx/shr-encopt.s (+98)
  • (added) llvm/test/MC/X86/apx/sub-reloc.s (+38)
  • (added) llvm/test/MC/X86/apx/xor-reloc.s (+38)
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.cpp
index 03eeef96b502e0d..134206466c542fe 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.cpp
@@ -106,6 +106,12 @@ bool X86::optimizeShiftRotateWithImmediateOne(MCInst &MI) {
 #define TO_IMM1(FROM)                                                          \
   case X86::FROM##i:                                                           \
     NewOpc = X86::FROM##1;                                                     \
+    break;                                                                     \
+  case X86::FROM##i_EVEX:                                                      \
+    NewOpc = X86::FROM##1_EVEX;                                                \
+    break;                                                                     \
+  case X86::FROM##i_ND:                                                        \
+    NewOpc = X86::FROM##1_ND;                                                  \
     break;
   switch (MI.getOpcode()) {
   default:
@@ -118,6 +124,31 @@ bool X86::optimizeShiftRotateWithImmediateOne(MCInst &MI) {
     TO_IMM1(RCL16r)
     TO_IMM1(RCL32r)
     TO_IMM1(RCL64r)
+    TO_IMM1(RCR8m)
+    TO_IMM1(RCR16m)
+    TO_IMM1(RCR32m)
+    TO_IMM1(RCR64m)
+    TO_IMM1(RCL8m)
+    TO_IMM1(RCL16m)
+    TO_IMM1(RCL32m)
+    TO_IMM1(RCL64m)
+#undef TO_IMM1
+#define TO_IMM1(FROM)                                                          \
+  case X86::FROM##i:                                                           \
+    NewOpc = X86::FROM##1;                                                     \
+    break;                                                                     \
+  case X86::FROM##i_EVEX:                                                      \
+    NewOpc = X86::FROM##1_EVEX;                                                \
+    break;                                                                     \
+  case X86::FROM##i_NF:                                                        \
+    NewOpc = X86::FROM##1_NF;                                                  \
+    break;                                                                     \
+  case X86::FROM##i_ND:                                                        \
+    NewOpc = X86::FROM##1_ND;                                                  \
+    break;                                                                     \
+  case X86::FROM##i_NF_ND:                                                     \
+    NewOpc = X86::FROM##1_NF_ND;                                               \
+    break;
     TO_IMM1(ROR8r)
     TO_IMM1(ROR16r)
     TO_IMM1(ROR32r)
@@ -138,14 +169,6 @@ bool X86::optimizeShiftRotateWithImmediateOne(MCInst &MI) {
     TO_IMM1(SHL16r)
     TO_IMM1(SHL32r)
     TO_IMM1(SHL64r)
-    TO_IMM1(RCR8m)
-    TO_IMM1(RCR16m)
-    TO_IMM1(RCR32m)
-    TO_IMM1(RCR64m)
-    TO_IMM1(RCL8m)
-    TO_IMM1(RCL16m)
-    TO_IMM1(RCL32m)
-    TO_IMM1(RCL64m)
     TO_IMM1(ROR8m)
     TO_IMM1(ROR16m)
     TO_IMM1(ROR32m)
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimizationForImmediate.def b/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimizationForImmediate.def
index e475e55260ed36a..27b6a654e6eb7fa 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimizationForImmediate.def
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimizationForImmediate.def
@@ -12,61 +12,78 @@
 #ifndef ENTRY
 #define ENTRY(LONG, SHORT)
 #endif
-ENTRY(ADC16mi, ADC16mi8)
-ENTRY(ADC16ri, ADC16ri8)
-ENTRY(ADC32mi, ADC32mi8)
-ENTRY(ADC32ri, ADC32ri8)
-ENTRY(ADC64mi32, ADC64mi8)
-ENTRY(ADC64ri32, ADC64ri8)
-ENTRY(SBB16mi, SBB16mi8)
-ENTRY(SBB16ri, SBB16ri8)
-ENTRY(SBB32mi, SBB32mi8)
-ENTRY(SBB32ri, SBB32ri8)
-ENTRY(SBB64mi32, SBB64mi8)
-ENTRY(SBB64ri32, SBB64ri8)
-ENTRY(ADD16mi, ADD16mi8)
-ENTRY(ADD16ri, ADD16ri8)
-ENTRY(ADD32mi, ADD32mi8)
-ENTRY(ADD32ri, ADD32ri8)
-ENTRY(ADD64mi32, ADD64mi8)
-ENTRY(ADD64ri32, ADD64ri8)
-ENTRY(AND16mi, AND16mi8)
-ENTRY(AND16ri, AND16ri8)
-ENTRY(AND32mi, AND32mi8)
-ENTRY(AND32ri, AND32ri8)
-ENTRY(AND64mi32, AND64mi8)
-ENTRY(AND64ri32, AND64ri8)
-ENTRY(OR16mi, OR16mi8)
-ENTRY(OR16ri, OR16ri8)
-ENTRY(OR32mi, OR32mi8)
-ENTRY(OR32ri, OR32ri8)
-ENTRY(OR64mi32, OR64mi8)
-ENTRY(OR64ri32, OR64ri8)
-ENTRY(SUB16mi, SUB16mi8)
-ENTRY(SUB16ri, SUB16ri8)
-ENTRY(SUB32mi, SUB32mi8)
-ENTRY(SUB32ri, SUB32ri8)
-ENTRY(SUB64mi32, SUB64mi8)
-ENTRY(SUB64ri32, SUB64ri8)
-ENTRY(XOR16mi, XOR16mi8)
-ENTRY(XOR16ri, XOR16ri8)
-ENTRY(XOR32mi, XOR32mi8)
-ENTRY(XOR32ri, XOR32ri8)
-ENTRY(XOR64mi32, XOR64mi8)
-ENTRY(XOR64ri32, XOR64ri8)
 ENTRY(CMP16mi, CMP16mi8)
 ENTRY(CMP16ri, CMP16ri8)
 ENTRY(CMP32mi, CMP32mi8)
 ENTRY(CMP32ri, CMP32ri8)
 ENTRY(CMP64mi32, CMP64mi8)
 ENTRY(CMP64ri32, CMP64ri8)
-ENTRY(IMUL16rmi, IMUL16rmi8)
-ENTRY(IMUL16rri, IMUL16rri8)
-ENTRY(IMUL32rmi, IMUL32rmi8)
-ENTRY(IMUL32rri, IMUL32rri8)
-ENTRY(IMUL64rmi32, IMUL64rmi8)
-ENTRY(IMUL64rri32, IMUL64rri8)
 ENTRY(PUSH16i, PUSH16i8)
 ENTRY(PUSH32i, PUSH32i8)
 ENTRY(PUSH64i32, PUSH64i8)
+#define ENTRYS(LONG, SHORT)                                                    \
+  ENTRY(LONG, SHORT)                                                           \
+  ENTRY(LONG##_EVEX, SHORT##_EVEX)                                             \
+  ENTRY(LONG##_NF, SHORT##_NF)                                                 \
+  ENTRY(LONG##_ND, SHORT##_ND)                                                 \
+  ENTRY(LONG##_NF_ND, SHORT##_NF_ND)
+ENTRYS(ADD16mi, ADD16mi8)
+ENTRYS(ADD16ri, ADD16ri8)
+ENTRYS(ADD32mi, ADD32mi8)
+ENTRYS(ADD32ri, ADD32ri8)
+ENTRYS(ADD64mi32, ADD64mi8)
+ENTRYS(ADD64ri32, ADD64ri8)
+ENTRYS(AND16mi, AND16mi8)
+ENTRYS(AND16ri, AND16ri8)
+ENTRYS(AND32mi, AND32mi8)
+ENTRYS(AND32ri, AND32ri8)
+ENTRYS(AND64mi32, AND64mi8)
+ENTRYS(AND64ri32, AND64ri8)
+ENTRYS(OR16mi, OR16mi8)
+ENTRYS(OR16ri, OR16ri8)
+ENTRYS(OR32mi, OR32mi8)
+ENTRYS(OR32ri, OR32ri8)
+ENTRYS(OR64mi32, OR64mi8)
+ENTRYS(OR64ri32, OR64ri8)
+ENTRYS(SUB16mi, SUB16mi8)
+ENTRYS(SUB16ri, SUB16ri8)
+ENTRYS(SUB32mi, SUB32mi8)
+ENTRYS(SUB32ri, SUB32ri8)
+ENTRYS(SUB64mi32, SUB64mi8)
+ENTRYS(SUB64ri32, SUB64ri8)
+ENTRYS(XOR16mi, XOR16mi8)
+ENTRYS(XOR16ri, XOR16ri8)
+ENTRYS(XOR32mi, XOR32mi8)
+ENTRYS(XOR32ri, XOR32ri8)
+ENTRYS(XOR64mi32, XOR64mi8)
+ENTRYS(XOR64ri32, XOR64ri8)
+#undef ENTRYS
+#define ENTRYS(LONG, SHORT)                                                    \
+  ENTRY(LONG, SHORT)                                                           \
+  ENTRY(LONG##_EVEX, SHORT##_EVEX)                                             \
+  ENTRY(LONG##_NF, SHORT##_NF)
+ENTRYS(IMUL16rmi, IMUL16rmi8)
+ENTRYS(IMUL16rri, IMUL16rri8)
+ENTRYS(IMUL32rmi, IMUL32rmi8)
+ENTRYS(IMUL32rri, IMUL32rri8)
+ENTRYS(IMUL64rmi32, IMUL64rmi8)
+ENTRYS(IMUL64rri32, IMUL64rri8)
+#undef ENTRYS
+#define ENTRYS(LONG, SHORT)                                                    \
+  ENTRY(LONG, SHORT)                                                           \
+  ENTRY(LONG##_EVEX, SHORT##_EVEX)                                             \
+  ENTRY(LONG##_ND, SHORT##_ND)
+ENTRYS(ADC16mi, ADC16mi8)
+ENTRYS(ADC16ri, ADC16ri8)
+ENTRYS(ADC32mi, ADC32mi8)
+ENTRYS(ADC32ri, ADC32ri8)
+ENTRYS(ADC64mi32, ADC64mi8)
+ENTRYS(ADC64ri32, ADC64ri8)
+ENTRYS(SBB16mi, SBB16mi8)
+ENTRYS(SBB16ri, SBB16ri8)
+ENTRYS(SBB32mi, SBB32mi8)
+ENTRYS(SBB32ri, SBB32ri8)
+ENTRYS(SBB64mi32, SBB64mi8)
+ENTRYS(SBB64ri32, SBB64ri8)
+#undef ENTRYS
 #undef ENTRY
diff --git a/llvm/test/CodeGen/X86/apx/adc.ll b/llvm/test/CodeGen/X86/apx/adc.ll
index 342d64e6bca009c..621784f86bdedbd 100644
--- a/llvm/test/CodeGen/X86/apx/adc.ll
+++ b/llvm/test/CodeGen/X86/apx/adc.ll
@@ -113,7 +113,7 @@ define i16 @adc16ri8(i16 %a, i16 %x, i16 %y) nounwind {
 ; CHECK-LABEL: adc16ri8:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT:    adcw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xd7,0x00,0x00]
+; CHECK-NEXT:    adcw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xd7,0x00]
 ; CHECK-NEXT:    addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
 ; CHECK-NEXT:    retq # encoding: [0xc3]
@@ -128,7 +128,7 @@ define i32 @adc32ri8(i32 %a, i32 %x, i32 %y) nounwind {
 ; CHECK-LABEL: adc32ri8:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpl %esi, %edx # encoding: [0x39,0xf2]
-; CHECK-NEXT:    adcl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xd7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    adcl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xd7,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
   %s = add i32 %a, 123
   %k = icmp ugt i32 %x, %y
@@ -141,7 +141,7 @@ define i64 @adc64ri8(i64 %a, i64 %x, i64 %y) nounwind {
 ; CHECK-LABEL: adc64ri8:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpq %rsi, %rdx # encoding: [0x48,0x39,0xf2]
-; CHECK-NEXT:    adcq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xd7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    adcq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xd7,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
   %s = add i64 %a, 123
   %k = icmp ugt i64 %x, %y
@@ -167,7 +167,7 @@ define i16 @adc16ri(i16 %a, i16 %x, i16 %y) nounwind {
 ; CHECK-LABEL: adc16ri:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT:    adcw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0xd7,0x00,0x00]
+; CHECK-NEXT:    adcw $0, %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0xd7,0x00]
 ; CHECK-NEXT:    addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
 ; CHECK-NEXT:    # imm = 0x4D2
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
@@ -267,7 +267,7 @@ define i16 @adc16mi8(ptr %ptr, i16 %x, i16 %y) nounwind {
 ; CHECK-LABEL: adc16mi8:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT:    adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x17,0x00,0x00]
+; CHECK-NEXT:    adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x00]
 ; CHECK-NEXT:    addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
 ; CHECK-NEXT:    retq # encoding: [0xc3]
@@ -283,7 +283,7 @@ define i32 @adc32mi8(ptr %ptr, i32 %x, i32 %y) nounwind {
 ; CHECK-LABEL: adc32mi8:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpl %esi, %edx # encoding: [0x39,0xf2]
-; CHECK-NEXT:    adcl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x17,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    adcl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x17,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
   %a = load i32, ptr %ptr
   %s = add i32 %a, 123
@@ -297,7 +297,7 @@ define i64 @adc64mi8(ptr %ptr, i64 %x, i64 %y) nounwind {
 ; CHECK-LABEL: adc64mi8:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpq %rsi, %rdx # encoding: [0x48,0x39,0xf2]
-; CHECK-NEXT:    adcq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x17,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    adcq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x17,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
   %a = load i64, ptr %ptr
   %s = add i64 %a, 123
@@ -325,7 +325,7 @@ define i16 @adc16mi(ptr %ptr, i16 %x, i16 %y) nounwind {
 ; CHECK-LABEL: adc16mi:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT:    adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x17,0x00,0x00]
+; CHECK-NEXT:    adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x00]
 ; CHECK-NEXT:    addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
 ; CHECK-NEXT:    # imm = 0x4D2
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
@@ -447,7 +447,7 @@ define void @adc16mi_legacy(ptr %ptr, i16 %x, i16 %y) nounwind {
 ; CHECK-LABEL: adc16mi_legacy:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; CHECK-NEXT:    adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x17,0x00,0x00]
+; CHECK-NEXT:    adcw $0, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x17,0x00]
 ; CHECK-NEXT:    addl $1234, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xd2,0x04,0x00,0x00]
 ; CHECK-NEXT:    # imm = 0x4D2
 ; CHECK-NEXT:    movw %ax, (%rdi) # encoding: [0x66,0x89,0x07]
diff --git a/llvm/test/CodeGen/X86/apx/add.ll b/llvm/test/CodeGen/X86/apx/add.ll
index a42f872b93e16fa..cdb29a70770e4b4 100644
--- a/llvm/test/CodeGen/X86/apx/add.ll
+++ b/llvm/test/CodeGen/X86/apx/add.ll
@@ -89,7 +89,7 @@ entry:
 define i16 @add16ri8(i16 noundef %a) {
 ; CHECK-LABEL: add16ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xc7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xc7,0x7b]
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
@@ -100,7 +100,7 @@ entry:
 define i32 @add32ri8(i32 noundef %a) {
 ; CHECK-LABEL: add32ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xc7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xc7,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
     %add = add i32 %a, 123
@@ -110,7 +110,7 @@ entry:
 define i64 @add64ri8(i64 noundef %a) {
 ; CHECK-LABEL: add64ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xc7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xc7,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
     %add = add i64 %a, 123
@@ -221,7 +221,7 @@ entry:
 define i32 @add32mi8(ptr %a) {
 ; CHECK-LABEL: add32mi8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x07,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x07,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
   %t= load i32, ptr %a
@@ -232,7 +232,7 @@ entry:
 define i64 @add64mi8(ptr %a) {
 ; CHECK-LABEL: add64mi8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x07,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x07,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
   %t= load i64, ptr %a
@@ -405,7 +405,7 @@ entry:
 define i16 @addflag16ri8(i16 noundef %a) {
 ; CHECK-LABEL: addflag16ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addw $123, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x81,0xc7,0x7b,0x00]
+; CHECK-NEXT:    addw $123, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x83,0xc7,0x7b]
 ; CHECK-NEXT:    movl $65535, %eax # encoding: [0xb8,0xff,0xff,0x00,0x00]
 ; CHECK-NEXT:    # imm = 0xFFFF
 ; CHECK-NEXT:    cmovael %ecx, %eax # encoding: [0x0f,0x43,0xc1]
@@ -419,7 +419,7 @@ entry:
 define i32 @addflag32ri8(i32 noundef %a) {
 ; CHECK-LABEL: addflag32ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addl $123, %edi, %ecx # encoding: [0x62,0xf4,0x74,0x18,0x81,0xc7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addl $123, %edi, %ecx # encoding: [0x62,0xf4,0x74,0x18,0x83,0xc7,0x7b]
 ; CHECK-NEXT:    movl $-1, %eax # encoding: [0xb8,0xff,0xff,0xff,0xff]
 ; CHECK-NEXT:    cmovael %ecx, %eax # encoding: [0x0f,0x43,0xc1]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
@@ -431,7 +431,7 @@ entry:
 define i64 @addflag64ri8(i64 noundef %a) {
 ; CHECK-LABEL: addflag64ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    addq $123, %rdi, %rcx # encoding: [0x62,0xf4,0xf4,0x18,0x81,0xc7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    addq $123, %rdi, %rcx # encoding: [0x62,0xf4,0xf4,0x18,0x83,0xc7,0x7b]
 ; CHECK-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
 ; CHECK-NEXT:    cmovaeq %rcx, %rax # encoding: [0x48,0x0f,0x43,0xc1]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
diff --git a/llvm/test/CodeGen/X86/apx/and.ll b/llvm/test/CodeGen/X86/apx/and.ll
index b7c1a851c07d634..af8f4119ac054d3 100644
--- a/llvm/test/CodeGen/X86/apx/and.ll
+++ b/llvm/test/CodeGen/X86/apx/and.ll
@@ -90,7 +90,7 @@ entry:
 define i16 @and16ri8(i16 noundef %a) {
 ; CHECK-LABEL: and16ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xe7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xe7,0x7b]
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
@@ -101,7 +101,7 @@ entry:
 define i32 @and32ri8(i32 noundef %a) {
 ; CHECK-LABEL: and32ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xe7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xe7,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
     %and = and i32 %a, 123
@@ -111,7 +111,7 @@ entry:
 define i64 @and64ri8(i64 noundef %a) {
 ; CHECK-LABEL: and64ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xe7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    andl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xe7,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
     %and = and i64 %a, 123
@@ -222,7 +222,7 @@ entry:
 define i32 @and32mi8(ptr %a) {
 ; CHECK-LABEL: and32mi8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    andl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x27,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    andl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x27,0x7b]
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
   %t= load i32, ptr %a
@@ -482,7 +482,7 @@ define i1 @andflag64ri(i64 %a) {
 define i1 @andflag16ri8(i16 %a) {
 ; CHECK-LABEL: andflag16ri8:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    andw $-124, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x81,0xe7,0x84,0xff]
+; CHECK-NEXT:    andw $-124, %di, %cx # encoding: [0x62,0xf4,0x75,0x18,0x83,0xe7,0x84]
 ; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; CHECK-NEXT:    movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
 ; CHECK-NEXT:    # fixup A - offset: 3, value: d64-4, kind: reloc_riprel_4byte
@@ -497,7 +497,7 @@ define i1 @andflag16ri8(i16 %a) {
 define i1 @andflag32ri8(i32 %a) {
 ; CHECK-LABEL: andflag32ri8:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    andl $123, %edi, %ecx # encoding: [0x62,0xf4,0x74,0x18,0x81,0xe7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    andl $123, %edi, %ecx # encoding: [0x62,0xf4,0x74,0x18,0x83,0xe7,0x7b]
 ; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; CHECK-NEXT:    movl %ecx, d64(%rip) # encoding: [0x89,0x0d,A,A,A,A]
 ; CHECK-NEXT:    # fixup A - offset: 2, value: d64-4, kind: reloc_riprel_4byte
@@ -511,7 +511,7 @@ define i1 @andflag32ri8(i32 %a) {
 define i1 @andflag64ri8(i64 %a) {
 ; CHECK-LABEL: andflag64ri8:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    andq $123, %rdi, %rcx # encoding: [0x62,0xf4,0xf4,0x18,0x81,0xe7,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    andq $123, %rdi, %rcx # encoding: [0x62,0xf4,0xf4,0x18,0x83,0xe7,0x7b]
 ; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; CHECK-NEXT:    movq %rcx, d64(%rip) # encoding: [0x48,0x89,0x0d,A,A,A,A]
 ; CHECK-NEXT:    # fixup A - offset: 3, value: d64-4, kind: reloc_riprel_4byte
diff --git a/llvm/test/CodeGen/X86/apx/or.ll b/llvm/test/CodeGen/X86/apx/or.ll
index 1219e74074a96dd..3d024e962400fad 100644
--- a/llvm/test/CodeGen/X86/apx/or.ll
+++ b/llvm/test/CodeGen/X86/apx/or.ll
@@ -90,7 +90,7 @@ entry:
 define i16 @or16ri8(i16 noundef %a) {
 ; CHECK-LABEL: or16ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    orl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xcf,0x7b,0x00,0x00,0x00]
+; CHECK-NEXT:    orl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0xcf,0x7b]
 ; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
 ; CHECK-NEXT:    retq # encoding: [0xc3]
 entry:
@@ -101,7 +101,7 @@ entry:
 define i32 @or32ri8(i32 noundef %a) {
 ; CHECK-LABEL: or32ri8:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    orl $123, %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0xcf,0x7b...
[truncated]

Copy link
Contributor

@KanRobert KanRobert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XinWang10 XinWang10 merged commit 5910e34 into llvm:main Jan 30, 2024
7 of 8 checks passed
@XinWang10
Copy link
Contributor Author

Thanks

@jayfoad
Copy link
Contributor

jayfoad commented Jan 30, 2024

This is causing:

FAIL: LLVM :: CodeGen/X86/popcnt.ll (1 of 1)
******************** TEST 'LLVM :: CodeGen/X86/popcnt.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/jayfoad2/llvm-release/bin/llc < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll -mtriple=i686-unknown | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefixes=X86,X86-NOSSE
+ /home/jayfoad2/llvm-release/bin/llc -mtriple=i686-unknown
+ /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefixes=X86,X86-NOSSE
RUN: at line 3: /home/jayfoad2/llvm-release/bin/llc < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll -mtriple=x86_64-unknown | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X64
+ /home/jayfoad2/llvm-release/bin/llc -mtriple=x86_64-unknown
+ /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X64
RUN: at line 4: /home/jayfoad2/llvm-release/bin/llc < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll -mtriple=i686-unknown -mattr=+popcnt | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X86-POPCNT
+ /home/jayfoad2/llvm-release/bin/llc -mtriple=i686-unknown -mattr=+popcnt
+ /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X86-POPCNT
RUN: at line 5: /home/jayfoad2/llvm-release/bin/llc < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll -mtriple=x86_64-unknown -mattr=+popcnt | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X64-POPCNT
+ /home/jayfoad2/llvm-release/bin/llc -mtriple=x86_64-unknown -mattr=+popcnt
+ /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X64-POPCNT
RUN: at line 6: /home/jayfoad2/llvm-release/bin/llc < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll -mtriple=x86_64-unknown -mattr=+ndd | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X64-NDD
+ /home/jayfoad2/llvm-release/bin/llc -mtriple=x86_64-unknown -mattr=+ndd
+ /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll --check-prefix=X64-NDD
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:62:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrb $1, %dil, %al
                ^
<stdin>:7:9: note: scanning from here
# %bb.0:
        ^
<stdin>:8:2: note: possible intended match here
 shrb %dil, %al
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:139:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrl $1, %edi, %eax
                ^
<stdin>:26:9: note: scanning from here
# %bb.0:
        ^
<stdin>:27:2: note: possible intended match here
 shrl %edi, %eax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:210:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrl $1, %edi, %eax
                ^
<stdin>:49:9: note: scanning from here
# %bb.0:
        ^
<stdin>:50:2: note: possible intended match here
 shrl %edi, %eax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:304:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rdi, %rax
                ^
<stdin>:70:9: note: scanning from here
# %bb.0:
        ^
<stdin>:71:2: note: possible intended match here
 shrq %rdi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:518:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rsi, %rax
                ^
<stdin>:95:9: note: scanning from here
# %bb.0:
        ^
<stdin>:96:2: note: possible intended match here
 shrq %rsi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:712:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rdi, %rax
                ^
<stdin>:134:9: note: scanning from here
# %bb.0:
        ^
<stdin>:135:2: note: possible intended match here
 shrq %rdi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:787:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrl $1, %edi, %eax
                ^
<stdin>:158:9: note: scanning from here
# %bb.0:
        ^
<stdin>:159:2: note: possible intended match here
 shrl %edi, %eax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:891:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rdi, %rax
                ^
<stdin>:179:9: note: scanning from here
# %bb.0:
        ^
<stdin>:180:2: note: possible intended match here
 shrq %rdi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:1114:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rsi, %rax
                ^
<stdin>:203:9: note: scanning from here
# %bb.0:
        ^
<stdin>:204:2: note: possible intended match here
 shrq %rsi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:1285:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrl $1, %edi, %eax
                ^
<stdin>:243:9: note: scanning from here
# %bb.0:
        ^
<stdin>:244:2: note: possible intended match here
 shrl %edi, %eax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:1379:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rdi, %rax
                ^
<stdin>:264:9: note: scanning from here
# %bb.0:
        ^
<stdin>:265:2: note: possible intended match here
 shrq %rdi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:1595:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrq $1, %rsi, %rax
                ^
<stdin>:289:9: note: scanning from here
# %bb.0:
        ^
<stdin>:290:2: note: possible intended match here
 shrq %rsi, %rax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:1767:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrl $1, %edi, %eax
                ^
<stdin>:330:9: note: scanning from here
# %bb.0:
        ^
<stdin>:331:2: note: possible intended match here
 shrl %edi, %eax
 ^
/home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll:1842:17: error: X64-NDD-NEXT: expected string not found in input
; X64-NDD-NEXT: shrl $1, %edi, %eax
                ^
<stdin>:353:9: note: scanning from here
# %bb.0:
        ^
<stdin>:354:2: note: possible intended match here
 shrl %edi, %eax
 ^

Input file: <stdin>
Check file: /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/X86/popcnt.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
             1:  .text 
             2:  .file "<stdin>" 
             3:  .globl cnt8 # -- Begin function cnt8 
             4:  .p2align 4, 0x90 
             5:  .type cnt8,@function 
             6: cnt8: # @cnt8 
             7: # %bb.0: 
next:62'0               X error: no match found
             8:  shrb %dil, %al 
next:62'0       ~~~~~~~~~~~~~~~~
next:62'1        ?               possible intended match
             9:  andb $85, %al 
next:62'0       ~~~~~~~~~~~~~~~
            10:  subb %al, %dil, %al 
next:62'0       ~~~~~~~~~~~~~~~~~~~~~
            11:  andb $51, %al, %cl 
next:62'0       ~~~~~~~~~~~~~~~~~~~~
            12:  shrb $2, %al 
next:62'0       ~~~~~~~~~~~~~~
            13:  andb $51, %al 
next:62'0       ~~~~~~~~~~~~~~~
             .
             .
             .
            21:  # -- End function 
next:62'0       ~~~~~~~~~~~~~~~~~~~
            22:  .globl cnt16 # -- Begin function cnt16 
next:62'0       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            23:  .p2align 4, 0x90 
next:62'0       ~~~~~~~~~~~~~~~~~~
            24:  .type cnt16,@function 
next:62'0       ~~~~~~~~~~~~~~~~~~~~~~~
            25: cnt16: # @cnt16 
next:62'0       ~~~~~~
            26: # %bb.0: 
next:139'0              X error: no match found
            27:  shrl %edi, %eax 
next:139'0      ~~~~~~~~~~~~~~~~~
next:139'1       ?                possible intended match
            28:  andl $21845, %eax # imm = 0x5555 
next:139'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            29:  subl %eax, %edi, %eax 
next:139'0      ~~~~~~~~~~~~~~~~~~~~~~~
            30:  andl $13107, %eax, %ecx # imm = 0x3333 
next:139'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            31:  shrl $2, %eax 
next:139'0      ~~~~~~~~~~~~~~~
            32:  andl $13107, %eax # imm = 0x3333 
next:139'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
            44:  # -- End function 
next:139'0      ~~~~~~~~~~~~~~~~~~~
            45:  .globl cnt32 # -- Begin function cnt32 
next:139'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            46:  .p2align 4, 0x90 
next:139'0      ~~~~~~~~~~~~~~~~~~
            47:  .type cnt32,@function 
next:139'0      ~~~~~~~~~~~~~~~~~~~~~~~
            48: cnt32: # @cnt32 
next:139'0      ~~~~~~
            49: # %bb.0: 
next:210'0              X error: no match found
            50:  shrl %edi, %eax 
next:210'0      ~~~~~~~~~~~~~~~~~
next:210'1       ?                possible intended match
            51:  andl $1431655765, %eax # imm = 0x55555555 
next:210'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            52:  subl %eax, %edi, %eax 
next:210'0      ~~~~~~~~~~~~~~~~~~~~~~~
            53:  andl $858993459, %eax, %ecx # imm = 0x33333333 
next:210'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            54:  shrl $2, %eax 
next:210'0      ~~~~~~~~~~~~~~~
            55:  andl $858993459, %eax # imm = 0x33333333 
next:210'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
            65:  # -- End function 
next:210'0      ~~~~~~~~~~~~~~~~~~~
            66:  .globl cnt64 # -- Begin function cnt64 
next:210'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            67:  .p2align 4, 0x90 
next:210'0      ~~~~~~~~~~~~~~~~~~
            68:  .type cnt64,@function 
next:210'0      ~~~~~~~~~~~~~~~~~~~~~~~
            69: cnt64: # @cnt64 
next:210'0      ~~~~~~
            70: # %bb.0: 
next:304'0              X error: no match found
            71:  shrq %rdi, %rax 
next:304'0      ~~~~~~~~~~~~~~~~~
next:304'1       ?                possible intended match
            72:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:304'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            73:  andq %rcx, %rax 
next:304'0      ~~~~~~~~~~~~~~~~~
            74:  subq %rax, %rdi, %rax 
next:304'0      ~~~~~~~~~~~~~~~~~~~~~~~
            75:  movabsq $3689348814741910323, %rcx # imm = 0x3333333333333333 
next:304'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            76:  andq %rcx, %rax, %rdx 
next:304'0      ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
            90:  # -- End function 
next:304'0      ~~~~~~~~~~~~~~~~~~~
            91:  .globl cnt128 # -- Begin function cnt128 
next:304'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            92:  .p2align 4, 0x90 
next:304'0      ~~~~~~~~~~~~~~~~~~
            93:  .type cnt128,@function 
next:304'0      ~~~~~~~~~~~~~~~~~~~~~~~~
            94: cnt128: # @cnt128 
next:304'0      ~~~~~~~
            95: # %bb.0: 
next:518'0              X error: no match found
            96:  shrq %rsi, %rax 
next:518'0      ~~~~~~~~~~~~~~~~~
next:518'1       ?                possible intended match
            97:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            98:  andq %rcx, %rax 
next:518'0      ~~~~~~~~~~~~~~~~~
            99:  subq %rax, %rsi, %rax 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~~
           100:  movabsq $3689348814741910323, %rdx # imm = 0x3333333333333333 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           101:  andq %rdx, %rax, %rsi 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           129:  # -- End function 
next:518'0      ~~~~~~~~~~~~~~~~~~~
           130:  .globl cnt64_noimplicitfloat # -- Begin function cnt64_noimplicitfloat 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           131:  .p2align 4, 0x90 
next:518'0      ~~~~~~~~~~~~~~~~~~
           132:  .type cnt64_noimplicitfloat,@function 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           133: cnt64_noimplicitfloat: # @cnt64_noimplicitfloat 
next:518'0      ~~~~~~~~~~~~~~~~~~~~~~
           134: # %bb.0: 
next:712'0              X error: no match found
           135:  shrq %rdi, %rax 
next:712'0      ~~~~~~~~~~~~~~~~~
next:712'1       ?                possible intended match
           136:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           137:  andq %rcx, %rax 
next:712'0      ~~~~~~~~~~~~~~~~~
           138:  subq %rax, %rdi, %rax 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~
           139:  movabsq $3689348814741910323, %rcx # imm = 0x3333333333333333 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           140:  andq %rcx, %rax, %rdx 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           153:  .size cnt64_noimplicitfloat, .Lfunc_end5-cnt64_noimplicitfloat 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           154:  # -- End function 
next:712'0      ~~~~~~~~~~~~~~~~~~~
           155:  .globl cnt32_optsize # -- Begin function cnt32_optsize 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           156:  .type cnt32_optsize,@function 
next:712'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           157: cnt32_optsize: # @cnt32_optsize 
next:712'0      ~~~~~~~~~~~~~~
           158: # %bb.0: 
next:787'0              X error: no match found
           159:  shrl %edi, %eax 
next:787'0      ~~~~~~~~~~~~~~~~~
next:787'1       ?                possible intended match
           160:  andl $1431655765, %eax # imm = 0x55555555 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           161:  subl %eax, %edi, %eax 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~
           162:  movl $858993459, %ecx # imm = 0x33333333 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           163:  andl %ecx, %eax, %edx 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~
           164:  shrl $2, %eax 
next:787'0      ~~~~~~~~~~~~~~~
             .
             .
             .
           174:  .size cnt32_optsize, .Lfunc_end6-cnt32_optsize 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           175:  # -- End function 
next:787'0      ~~~~~~~~~~~~~~~~~~~
           176:  .globl cnt64_optsize # -- Begin function cnt64_optsize 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           177:  .type cnt64_optsize,@function 
next:787'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           178: cnt64_optsize: # @cnt64_optsize 
next:787'0      ~~~~~~~~~~~~~~
           179: # %bb.0: 
next:891'0              X error: no match found
           180:  shrq %rdi, %rax 
next:891'0      ~~~~~~~~~~~~~~~~~
next:891'1       ?                possible intended match
           181:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           182:  andq %rcx, %rax 
next:891'0      ~~~~~~~~~~~~~~~~~
           183:  subq %rax, %rdi, %rax 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~
           184:  movabsq $3689348814741910323, %rcx # imm = 0x3333333333333333 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           185:  andq %rcx, %rax, %rdx 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           198:  .size cnt64_optsize, .Lfunc_end7-cnt64_optsize 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           199:  # -- End function 
next:891'0      ~~~~~~~~~~~~~~~~~~~
           200:  .globl cnt128_optsize # -- Begin function cnt128_optsize 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           201:  .type cnt128_optsize,@function 
next:891'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           202: cnt128_optsize: # @cnt128_optsize 
next:891'0      ~~~~~~~~~~~~~~~
           203: # %bb.0: 
next:1114'0             X error: no match found
           204:  shrq %rsi, %rax 
next:1114'0     ~~~~~~~~~~~~~~~~~
next:1114'1      ?                possible intended match
           205:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           206:  andq %rcx, %rax 
next:1114'0     ~~~~~~~~~~~~~~~~~
           207:  subq %rax, %rsi, %rax 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~
           208:  movabsq $3689348814741910323, %rdx # imm = 0x3333333333333333 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           209:  andq %rdx, %rax, %rsi 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           238:  .section .text.unlikely.,"ax",@progbits 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           239:  .globl cnt32_pgso # -- Begin function cnt32_pgso 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           240:  .p2align 4, 0x90 
next:1114'0     ~~~~~~~~~~~~~~~~~~
           241:  .type cnt32_pgso,@function 
next:1114'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           242: cnt32_pgso: # @cnt32_pgso 
next:1114'0     ~~~~~~~~~~~
           243: # %bb.0: 
next:1285'0             X error: no match found
           244:  shrl %edi, %eax 
next:1285'0     ~~~~~~~~~~~~~~~~~
next:1285'1      ?                possible intended match
           245:  andl $1431655765, %eax # imm = 0x55555555 
next:1285'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           246:  subl %eax, %edi, %eax 
next:1285'0     ~~~~~~~~~~~~~~~~~~~~~~~
           247:  andl $858993459, %eax, %ecx # imm = 0x33333333 
next:1285'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           248:  shrl $2, %eax 
next:1285'0     ~~~~~~~~~~~~~~~
           249:  andl $858993459, %eax # imm = 0x33333333 
next:1285'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           259:  # -- End function 
next:1285'0     ~~~~~~~~~~~~~~~~~~~
           260:  .globl cnt64_pgso # -- Begin function cnt64_pgso 
next:1285'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           261:  .p2align 4, 0x90 
next:1285'0     ~~~~~~~~~~~~~~~~~~
           262:  .type cnt64_pgso,@function 
next:1285'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           263: cnt64_pgso: # @cnt64_pgso 
next:1285'0     ~~~~~~~~~~~
           264: # %bb.0: 
next:1379'0             X error: no match found
           265:  shrq %rdi, %rax 
next:1379'0     ~~~~~~~~~~~~~~~~~
next:1379'1      ?                possible intended match
           266:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:1379'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           267:  andq %rcx, %rax 
next:1379'0     ~~~~~~~~~~~~~~~~~
           268:  subq %rax, %rdi, %rax 
next:1379'0     ~~~~~~~~~~~~~~~~~~~~~~~
           269:  movabsq $3689348814741910323, %rcx # imm = 0x3333333333333333 
next:1379'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           270:  andq %rcx, %rax, %rdx 
next:1379'0     ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           284:  # -- End function 
next:1379'0     ~~~~~~~~~~~~~~~~~~~
           285:  .globl cnt128_pgso # -- Begin function cnt128_pgso 
next:1379'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           286:  .p2align 4, 0x90 
next:1379'0     ~~~~~~~~~~~~~~~~~~
           287:  .type cnt128_pgso,@function 
next:1379'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           288: cnt128_pgso: # @cnt128_pgso 
next:1379'0     ~~~~~~~~~~~~
           289: # %bb.0: 
next:1595'0             X error: no match found
           290:  shrq %rsi, %rax 
next:1595'0     ~~~~~~~~~~~~~~~~~
next:1595'1      ?                possible intended match
           291:  movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555 
next:1595'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           292:  andq %rcx, %rax 
next:1595'0     ~~~~~~~~~~~~~~~~~
           293:  subq %rax, %rsi, %rax 
next:1595'0     ~~~~~~~~~~~~~~~~~~~~~~~
           294:  movabsq $3689348814741910323, %rdx # imm = 0x3333333333333333 
next:1595'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           295:  andq %rdx, %rax, %rsi 
next:1595'0     ~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           325:  .globl popcount_zext_i32 # -- Begin function popcount_zext_i32 
next:1595'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           326:  .p2align 4, 0x90 
next:1595'0     ~~~~~~~~~~~~~~~~~~
           327:  .type popcount_zext_i32,@function 
next:1595'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           328: popcount_zext_i32: # @popcount_zext_i32 
next:1595'0     ~~~~~~~~~~~~~~~~~~
           329:  .cfi_startproc 
           330: # %bb.0: 
next:1767'0             X error: no match found
           331:  shrl %edi, %eax 
next:1767'0     ~~~~~~~~~~~~~~~~~
next:1767'1      ?                possible intended match
           332:  andl $21845, %eax # imm = 0x5555 
next:1767'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           333:  subl %eax, %edi, %eax 
next:1767'0     ~~~~~~~~~~~~~~~~~~~~~~~
           334:  andl $858993459, %eax, %ecx # imm = 0x33333333 
next:1767'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           335:  shrl $2, %eax 
next:1767'0     ~~~~~~~~~~~~~~~
           336:  andl $858993459, %eax # imm = 0x33333333 
next:1767'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
           348:  .globl popcount_i16_zext # -- Begin function popcount_i16_zext 
next:1767'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           349:  .p2align 4, 0x90 
next:1767'0     ~~~~~~~~~~~~~~~~~~
           350:  .type popcount_i16_zext,@function 
next:1767'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           351: popcount_i16_zext: # @popcount_i16_zext 
next:1767'0     ~~~~~~~~~~~~~~~~~~
           352:  .cfi_startproc 
           353: # %bb.0: 
next:1842'0             X error: no match found
           354:  shrl %edi, %eax 
next:1842'0     ~~~~~~~~~~~~~~~~~
next:1842'1      ?                possible intended match
           355:  andl $21845, %eax # imm = 0x5555 
next:1842'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           356:  subl %eax, %edi, %eax 
next:1842'0     ~~~~~~~~~~~~~~~~~~~~~~~
           357:  andl $13107, %eax, %ecx # imm = 0x3333 
next:1842'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           358:  shrl $2, %eax 
next:1842'0     ~~~~~~~~~~~~~~~
           359:  andl $13107, %eax # imm = 0x3333 
next:1842'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
>>>>>>

--

********************
********************
Failed Tests (1):
  LLVM :: CodeGen/X86/popcnt.ll

@KanRobert
Copy link
Contributor

I think @XinWang10 forgot to update it.

@KanRobert
Copy link
Contributor

@jayfoad Fixed by e5054fb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants