[X86MacroFusion][NFC] Add more tests.

In preparation for D59688.

llvm-svn: 357381
This commit is contained in:
Clement Courbet 2019-04-01 13:18:34 +00:00
parent 7af32444b9
commit d9f6ee1c3c
1 changed files with 198 additions and 105 deletions

View File

@ -1,32 +1,57 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,-branchfusion | FileCheck %s --check-prefix=NOFUSION
; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,+branchfusion | FileCheck %s --check-prefix=BRANCHFUSION --check-prefix=BRANCHFUSIONONLY
; RUN: llc < %s -mtriple=x86_64-- -mattr=+macrofusion,-branchfusion | FileCheck %s --check-prefix=BRANCHFUSION --check-prefix=MACROFUSION
; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,-branchfusion -post-RA-scheduler=0 | FileCheck %s --check-prefix=NOFUSION_NOPOSTRA
; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,+branchfusion -post-RA-scheduler=0 | FileCheck %s --check-prefix=BRANCHFUSION_NOPOSTRA --check-prefix=BRANCHFUSIONONLY_NOPOSTRA
; RUN: llc < %s -mtriple=x86_64-- -mattr=+macrofusion,-branchfusion -post-RA-scheduler=0 | FileCheck %s --check-prefix=BRANCHFUSION_NOPOSTRA --check-prefix=MACROFUSION_NOPOSTRA
; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,-branchfusion -post-RA-scheduler=1 | FileCheck %s --check-prefix=NOFUSION_POSTRA
; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,+branchfusion -post-RA-scheduler=1 | FileCheck %s --check-prefix=BRANCHFUSION_POSTRA --check-prefix=BRANCHFUSIONONLY_POSTRA
; RUN: llc < %s -mtriple=x86_64-- -mattr=+macrofusion,-branchfusion -post-RA-scheduler=1 | FileCheck %s --check-prefix=BRANCHFUSION_POSTRA --check-prefix=MACROFUSION_POSTRA
; testb should be scheduled right before je to enable macro-fusion.
define i32 @macrofuse_test_je(i32 %flags, i8* %p) nounwind {
; NOFUSION-LABEL: macrofuse_test_je:
; NOFUSION: # %bb.0: # %entry
; NOFUSION-NEXT: xorl %eax, %eax
; NOFUSION-NEXT: testl $512, %edi # imm = 0x200
; NOFUSION-NEXT: movb $1, (%rsi)
; NOFUSION-NEXT: je .LBB0_2
; NOFUSION-NEXT: # %bb.1: # %if.then
; NOFUSION-NEXT: movl $1, %eax
; NOFUSION-NEXT: .LBB0_2: # %if.end
; NOFUSION-NEXT: retq
; NOFUSION_NOPOSTRA-LABEL: macrofuse_test_je:
; NOFUSION_NOPOSTRA: # %bb.0: # %entry
; NOFUSION_NOPOSTRA-NEXT: xorl %eax, %eax
; NOFUSION_NOPOSTRA-NEXT: testl $512, %edi # imm = 0x200
; NOFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_NOPOSTRA-NEXT: je .LBB0_2
; NOFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
; NOFUSION_NOPOSTRA-NEXT: movl $1, %eax
; NOFUSION_NOPOSTRA-NEXT: .LBB0_2: # %if.end
; NOFUSION_NOPOSTRA-NEXT: retq
;
; BRANCHFUSION-LABEL: macrofuse_test_je:
; BRANCHFUSION: # %bb.0: # %entry
; BRANCHFUSION-NEXT: xorl %eax, %eax
; BRANCHFUSION-NEXT: movb $1, (%rsi)
; BRANCHFUSION-NEXT: testl $512, %edi # imm = 0x200
; BRANCHFUSION-NEXT: je .LBB0_2
; BRANCHFUSION-NEXT: # %bb.1: # %if.then
; BRANCHFUSION-NEXT: movl $1, %eax
; BRANCHFUSION-NEXT: .LBB0_2: # %if.end
; BRANCHFUSION-NEXT: retq
; BRANCHFUSION_NOPOSTRA-LABEL: macrofuse_test_je:
; BRANCHFUSION_NOPOSTRA: # %bb.0: # %entry
; BRANCHFUSION_NOPOSTRA-NEXT: xorl %eax, %eax
; BRANCHFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSION_NOPOSTRA-NEXT: testl $512, %edi # imm = 0x200
; BRANCHFUSION_NOPOSTRA-NEXT: je .LBB0_2
; BRANCHFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
; BRANCHFUSION_NOPOSTRA-NEXT: movl $1, %eax
; BRANCHFUSION_NOPOSTRA-NEXT: .LBB0_2: # %if.end
; BRANCHFUSION_NOPOSTRA-NEXT: retq
;
; NOFUSION_POSTRA-LABEL: macrofuse_test_je:
; NOFUSION_POSTRA: # %bb.0: # %entry
; NOFUSION_POSTRA-NEXT: xorl %eax, %eax
; NOFUSION_POSTRA-NEXT: testl $512, %edi # imm = 0x200
; NOFUSION_POSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_POSTRA-NEXT: je .LBB0_2
; NOFUSION_POSTRA-NEXT: # %bb.1: # %if.then
; NOFUSION_POSTRA-NEXT: movl $1, %eax
; NOFUSION_POSTRA-NEXT: .LBB0_2: # %if.end
; NOFUSION_POSTRA-NEXT: retq
;
; BRANCHFUSION_POSTRA-LABEL: macrofuse_test_je:
; BRANCHFUSION_POSTRA: # %bb.0: # %entry
; BRANCHFUSION_POSTRA-NEXT: xorl %eax, %eax
; BRANCHFUSION_POSTRA-NEXT: testl $512, %edi # imm = 0x200
; BRANCHFUSION_POSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSION_POSTRA-NEXT: je .LBB0_2
; BRANCHFUSION_POSTRA-NEXT: # %bb.1: # %if.then
; BRANCHFUSION_POSTRA-NEXT: movl $1, %eax
; BRANCHFUSION_POSTRA-NEXT: .LBB0_2: # %if.end
; BRANCHFUSION_POSTRA-NEXT: retq
entry:
%and = and i32 %flags, 512
%tobool = icmp eq i32 %and, 0
@ -42,29 +67,53 @@ if.end:
}
define i32 @macrofuse_cmp_je(i32 %flags, i8* %p) nounwind {
; NOFUSION-LABEL: macrofuse_cmp_je:
; NOFUSION: # %bb.0: # %entry
; NOFUSION-NEXT: cmpl $512, %edi # imm = 0x200
; NOFUSION-NEXT: movb $1, (%rsi)
; NOFUSION-NEXT: je .LBB1_1
; NOFUSION-NEXT: # %bb.2: # %if.then
; NOFUSION-NEXT: movl $1, %eax
; NOFUSION-NEXT: retq
; NOFUSION-NEXT: .LBB1_1:
; NOFUSION-NEXT: xorl %eax, %eax
; NOFUSION-NEXT: retq
; NOFUSION_NOPOSTRA-LABEL: macrofuse_cmp_je:
; NOFUSION_NOPOSTRA: # %bb.0: # %entry
; NOFUSION_NOPOSTRA-NEXT: cmpl $512, %edi # imm = 0x200
; NOFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_NOPOSTRA-NEXT: je .LBB1_1
; NOFUSION_NOPOSTRA-NEXT: # %bb.2: # %if.then
; NOFUSION_NOPOSTRA-NEXT: movl $1, %eax
; NOFUSION_NOPOSTRA-NEXT: retq
; NOFUSION_NOPOSTRA-NEXT: .LBB1_1:
; NOFUSION_NOPOSTRA-NEXT: xorl %eax, %eax
; NOFUSION_NOPOSTRA-NEXT: retq
;
; BRANCHFUSION-LABEL: macrofuse_cmp_je:
; BRANCHFUSION: # %bb.0: # %entry
; BRANCHFUSION-NEXT: movb $1, (%rsi)
; BRANCHFUSION-NEXT: cmpl $512, %edi # imm = 0x200
; BRANCHFUSION-NEXT: je .LBB1_1
; BRANCHFUSION-NEXT: # %bb.2: # %if.then
; BRANCHFUSION-NEXT: movl $1, %eax
; BRANCHFUSION-NEXT: retq
; BRANCHFUSION-NEXT: .LBB1_1:
; BRANCHFUSION-NEXT: xorl %eax, %eax
; BRANCHFUSION-NEXT: retq
; BRANCHFUSION_NOPOSTRA-LABEL: macrofuse_cmp_je:
; BRANCHFUSION_NOPOSTRA: # %bb.0: # %entry
; BRANCHFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSION_NOPOSTRA-NEXT: cmpl $512, %edi # imm = 0x200
; BRANCHFUSION_NOPOSTRA-NEXT: je .LBB1_1
; BRANCHFUSION_NOPOSTRA-NEXT: # %bb.2: # %if.then
; BRANCHFUSION_NOPOSTRA-NEXT: movl $1, %eax
; BRANCHFUSION_NOPOSTRA-NEXT: retq
; BRANCHFUSION_NOPOSTRA-NEXT: .LBB1_1:
; BRANCHFUSION_NOPOSTRA-NEXT: xorl %eax, %eax
; BRANCHFUSION_NOPOSTRA-NEXT: retq
;
; NOFUSION_POSTRA-LABEL: macrofuse_cmp_je:
; NOFUSION_POSTRA: # %bb.0: # %entry
; NOFUSION_POSTRA-NEXT: cmpl $512, %edi # imm = 0x200
; NOFUSION_POSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_POSTRA-NEXT: je .LBB1_1
; NOFUSION_POSTRA-NEXT: # %bb.2: # %if.then
; NOFUSION_POSTRA-NEXT: movl $1, %eax
; NOFUSION_POSTRA-NEXT: retq
; NOFUSION_POSTRA-NEXT: .LBB1_1:
; NOFUSION_POSTRA-NEXT: xorl %eax, %eax
; NOFUSION_POSTRA-NEXT: retq
;
; BRANCHFUSION_POSTRA-LABEL: macrofuse_cmp_je:
; BRANCHFUSION_POSTRA: # %bb.0: # %entry
; BRANCHFUSION_POSTRA-NEXT: cmpl $512, %edi # imm = 0x200
; BRANCHFUSION_POSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSION_POSTRA-NEXT: je .LBB1_1
; BRANCHFUSION_POSTRA-NEXT: # %bb.2: # %if.then
; BRANCHFUSION_POSTRA-NEXT: movl $1, %eax
; BRANCHFUSION_POSTRA-NEXT: retq
; BRANCHFUSION_POSTRA-NEXT: .LBB1_1:
; BRANCHFUSION_POSTRA-NEXT: xorl %eax, %eax
; BRANCHFUSION_POSTRA-NEXT: retq
entry:
%sub = sub i32 %flags, 512
%tobool = icmp eq i32 %sub, 0
@ -80,38 +129,60 @@ if.end:
}
define i32 @macrofuse_alu_je(i32 %flags, i8* %p) nounwind {
; NOFUSION-LABEL: macrofuse_alu_je:
; NOFUSION: # %bb.0: # %entry
; NOFUSION-NEXT: movl %edi, %eax
; NOFUSION-NEXT: addl $-512, %eax # imm = 0xFE00
; NOFUSION-NEXT: movb $1, (%rsi)
; NOFUSION-NEXT: je .LBB2_2
; NOFUSION-NEXT: # %bb.1: # %if.then
; NOFUSION-NEXT: movl $1, %eax
; NOFUSION-NEXT: .LBB2_2: # %if.end
; NOFUSION-NEXT: retq
; NOFUSION_NOPOSTRA-LABEL: macrofuse_alu_je:
; NOFUSION_NOPOSTRA: # %bb.0: # %entry
; NOFUSION_NOPOSTRA-NEXT: movl %edi, %eax
; NOFUSION_NOPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
; NOFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_NOPOSTRA-NEXT: je .LBB2_2
; NOFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
; NOFUSION_NOPOSTRA-NEXT: movl $1, %eax
; NOFUSION_NOPOSTRA-NEXT: .LBB2_2: # %if.end
; NOFUSION_NOPOSTRA-NEXT: retq
;
; BRANCHFUSIONONLY-LABEL: macrofuse_alu_je:
; BRANCHFUSIONONLY: # %bb.0: # %entry
; BRANCHFUSIONONLY-NEXT: movl %edi, %eax
; BRANCHFUSIONONLY-NEXT: addl $-512, %eax # imm = 0xFE00
; BRANCHFUSIONONLY-NEXT: movb $1, (%rsi)
; BRANCHFUSIONONLY-NEXT: je .LBB2_2
; BRANCHFUSIONONLY-NEXT: # %bb.1: # %if.then
; BRANCHFUSIONONLY-NEXT: movl $1, %eax
; BRANCHFUSIONONLY-NEXT: .LBB2_2: # %if.end
; BRANCHFUSIONONLY-NEXT: retq
; BRANCHFUSIONONLY_NOPOSTRA-LABEL: macrofuse_alu_je:
; BRANCHFUSIONONLY_NOPOSTRA: # %bb.0: # %entry
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl %edi, %eax
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: je .LBB2_2
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: # %bb.1: # %if.then
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl $1, %eax
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: .LBB2_2: # %if.end
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: retq
;
; MACROFUSION-LABEL: macrofuse_alu_je:
; MACROFUSION: # %bb.0: # %entry
; MACROFUSION-NEXT: movl %edi, %eax
; MACROFUSION-NEXT: movb $1, (%rsi)
; MACROFUSION-NEXT: addl $-512, %eax # imm = 0xFE00
; MACROFUSION-NEXT: je .LBB2_2
; MACROFUSION-NEXT: # %bb.1: # %if.then
; MACROFUSION-NEXT: movl $1, %eax
; MACROFUSION-NEXT: .LBB2_2: # %if.end
; MACROFUSION-NEXT: retq
; MACROFUSION_NOPOSTRA-LABEL: macrofuse_alu_je:
; MACROFUSION_NOPOSTRA: # %bb.0: # %entry
; MACROFUSION_NOPOSTRA-NEXT: movl %edi, %eax
; MACROFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; MACROFUSION_NOPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
; MACROFUSION_NOPOSTRA-NEXT: je .LBB2_2
; MACROFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
; MACROFUSION_NOPOSTRA-NEXT: movl $1, %eax
; MACROFUSION_NOPOSTRA-NEXT: .LBB2_2: # %if.end
; MACROFUSION_NOPOSTRA-NEXT: retq
;
; NOFUSION_POSTRA-LABEL: macrofuse_alu_je:
; NOFUSION_POSTRA: # %bb.0: # %entry
; NOFUSION_POSTRA-NEXT: movl %edi, %eax
; NOFUSION_POSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_POSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
; NOFUSION_POSTRA-NEXT: je .LBB2_2
; NOFUSION_POSTRA-NEXT: # %bb.1: # %if.then
; NOFUSION_POSTRA-NEXT: movl $1, %eax
; NOFUSION_POSTRA-NEXT: .LBB2_2: # %if.end
; NOFUSION_POSTRA-NEXT: retq
;
; BRANCHFUSION_POSTRA-LABEL: macrofuse_alu_je:
; BRANCHFUSION_POSTRA: # %bb.0: # %entry
; BRANCHFUSION_POSTRA-NEXT: movl %edi, %eax
; BRANCHFUSION_POSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSION_POSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
; BRANCHFUSION_POSTRA-NEXT: je .LBB2_2
; BRANCHFUSION_POSTRA-NEXT: # %bb.1: # %if.then
; BRANCHFUSION_POSTRA-NEXT: movl $1, %eax
; BRANCHFUSION_POSTRA-NEXT: .LBB2_2: # %if.end
; BRANCHFUSION_POSTRA-NEXT: retq
entry:
%sub = sub i32 %flags, 512
%tobool = icmp eq i32 %sub, 0
@ -127,38 +198,60 @@ if.end:
}
define i32 @macrofuse_dec_je(i32 %flags, i8* %p) nounwind {
; NOFUSION-LABEL: macrofuse_dec_je:
; NOFUSION: # %bb.0: # %entry
; NOFUSION-NEXT: movl %edi, %eax
; NOFUSION-NEXT: decl %eax
; NOFUSION-NEXT: movb $1, (%rsi)
; NOFUSION-NEXT: je .LBB3_2
; NOFUSION-NEXT: # %bb.1: # %if.then
; NOFUSION-NEXT: movl $1, %eax
; NOFUSION-NEXT: .LBB3_2: # %if.end
; NOFUSION-NEXT: retq
; NOFUSION_NOPOSTRA-LABEL: macrofuse_dec_je:
; NOFUSION_NOPOSTRA: # %bb.0: # %entry
; NOFUSION_NOPOSTRA-NEXT: movl %edi, %eax
; NOFUSION_NOPOSTRA-NEXT: decl %eax
; NOFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_NOPOSTRA-NEXT: je .LBB3_2
; NOFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
; NOFUSION_NOPOSTRA-NEXT: movl $1, %eax
; NOFUSION_NOPOSTRA-NEXT: .LBB3_2: # %if.end
; NOFUSION_NOPOSTRA-NEXT: retq
;
; BRANCHFUSIONONLY-LABEL: macrofuse_dec_je:
; BRANCHFUSIONONLY: # %bb.0: # %entry
; BRANCHFUSIONONLY-NEXT: movl %edi, %eax
; BRANCHFUSIONONLY-NEXT: decl %eax
; BRANCHFUSIONONLY-NEXT: movb $1, (%rsi)
; BRANCHFUSIONONLY-NEXT: je .LBB3_2
; BRANCHFUSIONONLY-NEXT: # %bb.1: # %if.then
; BRANCHFUSIONONLY-NEXT: movl $1, %eax
; BRANCHFUSIONONLY-NEXT: .LBB3_2: # %if.end
; BRANCHFUSIONONLY-NEXT: retq
; BRANCHFUSIONONLY_NOPOSTRA-LABEL: macrofuse_dec_je:
; BRANCHFUSIONONLY_NOPOSTRA: # %bb.0: # %entry
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl %edi, %eax
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: decl %eax
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: je .LBB3_2
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: # %bb.1: # %if.then
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl $1, %eax
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: .LBB3_2: # %if.end
; BRANCHFUSIONONLY_NOPOSTRA-NEXT: retq
;
; MACROFUSION-LABEL: macrofuse_dec_je:
; MACROFUSION: # %bb.0: # %entry
; MACROFUSION-NEXT: movl %edi, %eax
; MACROFUSION-NEXT: movb $1, (%rsi)
; MACROFUSION-NEXT: decl %eax
; MACROFUSION-NEXT: je .LBB3_2
; MACROFUSION-NEXT: # %bb.1: # %if.then
; MACROFUSION-NEXT: movl $1, %eax
; MACROFUSION-NEXT: .LBB3_2: # %if.end
; MACROFUSION-NEXT: retq
; MACROFUSION_NOPOSTRA-LABEL: macrofuse_dec_je:
; MACROFUSION_NOPOSTRA: # %bb.0: # %entry
; MACROFUSION_NOPOSTRA-NEXT: movl %edi, %eax
; MACROFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
; MACROFUSION_NOPOSTRA-NEXT: decl %eax
; MACROFUSION_NOPOSTRA-NEXT: je .LBB3_2
; MACROFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
; MACROFUSION_NOPOSTRA-NEXT: movl $1, %eax
; MACROFUSION_NOPOSTRA-NEXT: .LBB3_2: # %if.end
; MACROFUSION_NOPOSTRA-NEXT: retq
;
; NOFUSION_POSTRA-LABEL: macrofuse_dec_je:
; NOFUSION_POSTRA: # %bb.0: # %entry
; NOFUSION_POSTRA-NEXT: movl %edi, %eax
; NOFUSION_POSTRA-NEXT: movb $1, (%rsi)
; NOFUSION_POSTRA-NEXT: decl %eax
; NOFUSION_POSTRA-NEXT: je .LBB3_2
; NOFUSION_POSTRA-NEXT: # %bb.1: # %if.then
; NOFUSION_POSTRA-NEXT: movl $1, %eax
; NOFUSION_POSTRA-NEXT: .LBB3_2: # %if.end
; NOFUSION_POSTRA-NEXT: retq
;
; BRANCHFUSION_POSTRA-LABEL: macrofuse_dec_je:
; BRANCHFUSION_POSTRA: # %bb.0: # %entry
; BRANCHFUSION_POSTRA-NEXT: movl %edi, %eax
; BRANCHFUSION_POSTRA-NEXT: movb $1, (%rsi)
; BRANCHFUSION_POSTRA-NEXT: decl %eax
; BRANCHFUSION_POSTRA-NEXT: je .LBB3_2
; BRANCHFUSION_POSTRA-NEXT: # %bb.1: # %if.then
; BRANCHFUSION_POSTRA-NEXT: movl $1, %eax
; BRANCHFUSION_POSTRA-NEXT: .LBB3_2: # %if.end
; BRANCHFUSION_POSTRA-NEXT: retq
entry:
%sub = sub i32 %flags, 1
%tobool = icmp eq i32 %sub, 0