[llvm] bc2b709 - [X86] Autogenerate complete checks and add encoding information. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 22:34:06 PDT 2020


Author: Craig Topper
Date: 2020-06-08T22:27:20-07:00
New Revision: bc2b70982be8f5250cd0082a7190f8b417bd4dfe

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

LOG: [X86] Autogenerate complete checks and add encoding information. NFC

I think we're using an inefficient CMP encoding for absolute
symbols that would fit in an 8-bit value. This is a pattern
priority issue in isel.

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/absolute-cmp.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/absolute-cmp.ll b/llvm/test/CodeGen/X86/absolute-cmp.ll
index 01e8a90177cc..ebf4a0b18f58 100644
--- a/llvm/test/CodeGen/X86/absolute-cmp.ll
+++ b/llvm/test/CodeGen/X86/absolute-cmp.ll
@@ -1,5 +1,6 @@
-; RUN: llc < %s | FileCheck %s
-; RUN: llc -relocation-model=pic < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NOPIC
+; RUN: llc -relocation-model=pic -show-mc-encoding < %s | FileCheck %s --check-prefixes=CHECK,PIC
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
@@ -10,7 +11,37 @@ target triple = "x86_64-unknown-linux-gnu"
 declare void @f()
 
 define void @foo8(i64 %val) {
-  ; CHECK: cmpq $cmp8 at ABS8, %rdi
+; NOPIC-LABEL: foo8:
+; NOPIC:       # %bb.0:
+; NOPIC-NEXT:    pushq %rax # encoding: [0x50]
+; NOPIC-NEXT:    .cfi_def_cfa_offset 16
+; NOPIC-NEXT:    cmpq $cmp8 at ABS8, %rdi # encoding: [0x48,0x81,0xff,A,A,A,A]
+; NOPIC-NEXT:    # fixup A - offset: 3, value: cmp8 at ABS8, kind: reloc_signed_4byte
+; NOPIC-NEXT:    ja .LBB0_2 # encoding: [0x77,A]
+; NOPIC-NEXT:    # fixup A - offset: 1, value: .LBB0_2-1, kind: FK_PCRel_1
+; NOPIC-NEXT:  # %bb.1: # %t
+; NOPIC-NEXT:    callq f # encoding: [0xe8,A,A,A,A]
+; NOPIC-NEXT:    # fixup A - offset: 1, value: f-4, kind: reloc_branch_4byte_pcrel
+; NOPIC-NEXT:  .LBB0_2: # %f
+; NOPIC-NEXT:    popq %rax # encoding: [0x58]
+; NOPIC-NEXT:    .cfi_def_cfa_offset 8
+; NOPIC-NEXT:    retq # encoding: [0xc3]
+;
+; PIC-LABEL: foo8:
+; PIC:       # %bb.0:
+; PIC-NEXT:    pushq %rax # encoding: [0x50]
+; PIC-NEXT:    .cfi_def_cfa_offset 16
+; PIC-NEXT:    cmpq $cmp8 at ABS8, %rdi # encoding: [0x48,0x81,0xff,A,A,A,A]
+; PIC-NEXT:    # fixup A - offset: 3, value: cmp8 at ABS8, kind: reloc_signed_4byte
+; PIC-NEXT:    ja .LBB0_2 # encoding: [0x77,A]
+; PIC-NEXT:    # fixup A - offset: 1, value: .LBB0_2-1, kind: FK_PCRel_1
+; PIC-NEXT:  # %bb.1: # %t
+; PIC-NEXT:    callq f at PLT # encoding: [0xe8,A,A,A,A]
+; PIC-NEXT:    # fixup A - offset: 1, value: f at PLT-4, kind: FK_PCRel_4
+; PIC-NEXT:  .LBB0_2: # %f
+; PIC-NEXT:    popq %rax # encoding: [0x58]
+; PIC-NEXT:    .cfi_def_cfa_offset 8
+; PIC-NEXT:    retq # encoding: [0xc3]
   %cmp = icmp ule i64 %val, ptrtoint (i8* @cmp8 to i64)
   br i1 %cmp, label %t, label %f
 
@@ -23,7 +54,37 @@ f:
 }
 
 define void @foo32(i64 %val) {
-  ; CHECK: cmpq $cmp32, %rdi
+; NOPIC-LABEL: foo32:
+; NOPIC:       # %bb.0:
+; NOPIC-NEXT:    pushq %rax # encoding: [0x50]
+; NOPIC-NEXT:    .cfi_def_cfa_offset 16
+; NOPIC-NEXT:    cmpq $cmp32, %rdi # encoding: [0x48,0x81,0xff,A,A,A,A]
+; NOPIC-NEXT:    # fixup A - offset: 3, value: cmp32, kind: reloc_signed_4byte
+; NOPIC-NEXT:    ja .LBB1_2 # encoding: [0x77,A]
+; NOPIC-NEXT:    # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
+; NOPIC-NEXT:  # %bb.1: # %t
+; NOPIC-NEXT:    callq f # encoding: [0xe8,A,A,A,A]
+; NOPIC-NEXT:    # fixup A - offset: 1, value: f-4, kind: reloc_branch_4byte_pcrel
+; NOPIC-NEXT:  .LBB1_2: # %f
+; NOPIC-NEXT:    popq %rax # encoding: [0x58]
+; NOPIC-NEXT:    .cfi_def_cfa_offset 8
+; NOPIC-NEXT:    retq # encoding: [0xc3]
+;
+; PIC-LABEL: foo32:
+; PIC:       # %bb.0:
+; PIC-NEXT:    pushq %rax # encoding: [0x50]
+; PIC-NEXT:    .cfi_def_cfa_offset 16
+; PIC-NEXT:    cmpq $cmp32, %rdi # encoding: [0x48,0x81,0xff,A,A,A,A]
+; PIC-NEXT:    # fixup A - offset: 3, value: cmp32, kind: reloc_signed_4byte
+; PIC-NEXT:    ja .LBB1_2 # encoding: [0x77,A]
+; PIC-NEXT:    # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
+; PIC-NEXT:  # %bb.1: # %t
+; PIC-NEXT:    callq f at PLT # encoding: [0xe8,A,A,A,A]
+; PIC-NEXT:    # fixup A - offset: 1, value: f at PLT-4, kind: FK_PCRel_4
+; PIC-NEXT:  .LBB1_2: # %f
+; PIC-NEXT:    popq %rax # encoding: [0x58]
+; PIC-NEXT:    .cfi_def_cfa_offset 8
+; PIC-NEXT:    retq # encoding: [0xc3]
   %cmp = icmp ule i64 %val, ptrtoint (i8* @cmp32 to i64)
   br i1 %cmp, label %t, label %f
 


        


More information about the llvm-commits mailing list