[llvm] r324863 - [X86] Change some compare patterns to use loadi8/loadi16/loadi32/loadi64 helper fragments.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 11 18:48:42 PST 2018
Author: ctopper
Date: Sun Feb 11 18:48:42 2018
New Revision: 324863
URL: http://llvm.org/viewvc/llvm-project?rev=324863&view=rev
Log:
[X86] Change some compare patterns to use loadi8/loadi16/loadi32/loadi64 helper fragments.
This enables CMP8mi to fold zextloadi8i1 which in all tests allows us to avoid creating a TEST8rr that peephole can't fold.
Modified:
llvm/trunk/lib/Target/X86/X86InstrArithmetic.td
llvm/trunk/test/CodeGen/X86/avx512-insert-extract.ll
llvm/trunk/test/CodeGen/X86/i386-shrink-wrapping.ll
llvm/trunk/test/CodeGen/X86/x86-shrink-wrapping.ll
Modified: llvm/trunk/lib/Target/X86/X86InstrArithmetic.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrArithmetic.td?rev=324863&r1=324862&r2=324863&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrArithmetic.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrArithmetic.td Sun Feb 11 18:48:42 2018
@@ -850,7 +850,8 @@ class BinOpMR_RMW_FF<bits<8> opcode, str
class BinOpMR_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
SDPatternOperator opnode>
: BinOpMR<opcode, mnemonic, typeinfo,
- [(set EFLAGS, (opnode (load addr:$dst), typeinfo.RegClass:$src))]>;
+ [(set EFLAGS, (opnode (typeinfo.LoadNode addr:$dst),
+ typeinfo.RegClass:$src))]>;
// BinOpMI - Instructions like "add [mem], imm".
class BinOpMI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
@@ -882,8 +883,8 @@ class BinOpMI_RMW_FF<bits<8> opcode, str
class BinOpMI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
SDPatternOperator opnode, Format f>
: BinOpMI<opcode, mnemonic, typeinfo, f,
- [(set EFLAGS, (opnode (typeinfo.VT (load addr:$dst)),
- typeinfo.ImmOperator:$src))]>;
+ [(set EFLAGS, (opnode (typeinfo.LoadNode addr:$dst),
+ typeinfo.ImmOperator:$src))]>;
// BinOpMI8 - Instructions like "add [mem], imm8".
class BinOpMI8<string mnemonic, X86TypeInfo typeinfo,
@@ -916,7 +917,7 @@ class BinOpMI8_RMW_FF<string mnemonic, X
class BinOpMI8_F<string mnemonic, X86TypeInfo typeinfo,
SDPatternOperator opnode, Format f>
: BinOpMI8<mnemonic, typeinfo, f,
- [(set EFLAGS, (opnode (load addr:$dst),
+ [(set EFLAGS, (opnode (typeinfo.LoadNode addr:$dst),
typeinfo.Imm8Operator:$src))]>;
// BinOpAI - Instructions like "add %eax, %eax, imm", that imp-def EFLAGS.
Modified: llvm/trunk/test/CodeGen/X86/avx512-insert-extract.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx512-insert-extract.ll?rev=324863&r1=324862&r2=324863&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx512-insert-extract.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx512-insert-extract.ll Sun Feb 11 18:48:42 2018
@@ -285,9 +285,8 @@ define i64 @test14(<8 x i64>%a, <8 x i64
define i16 @test15(i1 *%addr) {
; CHECK-LABEL: test15:
; CHECK: ## %bb.0:
-; CHECK-NEXT: movb (%rdi), %al
; CHECK-NEXT: xorl %ecx, %ecx
-; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: cmpb $0, (%rdi)
; CHECK-NEXT: movw $-1, %ax
; CHECK-NEXT: cmovew %cx, %ax
; CHECK-NEXT: retq
Modified: llvm/trunk/test/CodeGen/X86/i386-shrink-wrapping.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/i386-shrink-wrapping.ll?rev=324863&r1=324862&r2=324863&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/i386-shrink-wrapping.ll (original)
+++ llvm/trunk/test/CodeGen/X86/i386-shrink-wrapping.ll Sun Feb 11 18:48:42 2018
@@ -40,11 +40,12 @@ target triple = "i386-apple-macosx10.5"
; The for.end block is split to accomadate the different selects.
; We are interested in the one with the call, so skip until the branch.
; CHECK: [[FOREND_LABEL]]:
-; CHECK-NEXT: movb _d, [[D:%[a-z]+]]
-; [...]
-; CHECK: jne [[CALL_LABEL:LBB[0-9_]+]]
+; CHECK-NEXT: xorl
+; CHECK-NEXT: cmpb $0, _d
+; CHECK-NEXT: movl $0, %edx
+; CHECK-NEXT: jne [[CALL_LABEL:LBB[0-9_]+]]
;
-; CHECK: movb $6, [[D]]
+; CHECK: movb $6, %dl
;
; CHECK: [[CALL_LABEL]]
;
@@ -54,7 +55,7 @@ target triple = "i386-apple-macosx10.5"
; ENABLE-NEXT: leal -20(%esp), %esp
;
; CHECK-NEXT: L_e$non_lazy_ptr, [[E:%[a-z]+]]
-; CHECK-NEXT: movb [[D]], ([[E]])
+; CHECK-NEXT: movb %dl, ([[E]])
; CHECK-NEXT: movsbl ([[E]]), [[CONV:%[a-z]+]]
; CHECK-NEXT: movl $6, [[CONV:%[a-z]+]]
; The eflags is used in the next instruction.
Modified: llvm/trunk/test/CodeGen/X86/x86-shrink-wrapping.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-shrink-wrapping.ll?rev=324863&r1=324862&r2=324863&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/x86-shrink-wrapping.ll (original)
+++ llvm/trunk/test/CodeGen/X86/x86-shrink-wrapping.ll Sun Feb 11 18:48:42 2018
@@ -808,10 +808,9 @@ end:
; DISABLE-NEXT: subq $16, %rsp
;
; Load the value of b.
-; CHECK: movb _b(%rip), [[BOOL:%cl]]
; Create the zero value for the select assignment.
-; CHECK-NEXT: xorl [[CMOVE_VAL:%eax]], [[CMOVE_VAL]]
-; CHECK-NEXT: testb [[BOOL]], [[BOOL]]
+; CHECK: xorl [[CMOVE_VAL:%eax]], [[CMOVE_VAL]]
+; CHECK-NEXT: cmpb $0, _b(%rip)
; CHECK-NEXT: jne [[STOREC_LABEL:LBB[0-9_]+]]
;
; CHECK: movb $48, [[CMOVE_VAL:%al]]
More information about the llvm-commits
mailing list