2017-08-17 06:50:11 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+cmov | FileCheck %s --check-prefix=CMOV
|
|
|
|
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-cmov | FileCheck %s --check-prefix=NO_CMOV
|
|
|
|
|
2017-09-07 16:59:05 +08:00
|
|
|
define i16 @cmov_zpromotion_8_to_16(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_zpromotion_8_to_16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movb $117, %al
|
|
|
|
; CMOV-NEXT: jne .LBB0_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: movb $-19, %al
|
|
|
|
; CMOV-NEXT: .LBB0_2:
|
|
|
|
; CMOV-NEXT: movzbl %al, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; CMOV-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_zpromotion_8_to_16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movb $117, %al
|
|
|
|
; NO_CMOV-NEXT: jne .LBB0_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movb $-19, %al
|
|
|
|
; NO_CMOV-NEXT: .LBB0_2:
|
|
|
|
; NO_CMOV-NEXT: movzbl %al, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; NO_CMOV-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i8 117, i8 -19
|
|
|
|
%ret = zext i8 %t0 to i16
|
|
|
|
ret i16 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @cmov_zpromotion_8_to_32(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_zpromotion_8_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movb $126, %al
|
|
|
|
; CMOV-NEXT: jne .LBB1_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: movb $-1, %al
|
|
|
|
; CMOV-NEXT: .LBB1_2:
|
|
|
|
; CMOV-NEXT: movzbl %al, %eax
|
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_zpromotion_8_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movb $126, %al
|
|
|
|
; NO_CMOV-NEXT: jne .LBB1_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movb $-1, %al
|
|
|
|
; NO_CMOV-NEXT: .LBB1_2:
|
|
|
|
; NO_CMOV-NEXT: movzbl %al, %eax
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i8 12414, i8 -1
|
|
|
|
%ret = zext i8 %t0 to i32
|
|
|
|
ret i32 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @cmov_zpromotion_8_to_64(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_zpromotion_8_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movb $126, %al
|
|
|
|
; CMOV-NEXT: jne .LBB2_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: movb $-1, %al
|
|
|
|
; CMOV-NEXT: .LBB2_2:
|
|
|
|
; CMOV-NEXT: movzbl %al, %eax
|
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_zpromotion_8_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movb $126, %al
|
|
|
|
; NO_CMOV-NEXT: jne .LBB2_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movb $-1, %al
|
|
|
|
; NO_CMOV-NEXT: .LBB2_2:
|
|
|
|
; NO_CMOV-NEXT: movzbl %al, %eax
|
|
|
|
; NO_CMOV-NEXT: xorl %edx, %edx
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i8 12414, i8 -1
|
|
|
|
%ret = zext i8 %t0 to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
2017-08-17 06:50:11 +08:00
|
|
|
define i32 @cmov_zpromotion_16_to_32(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_zpromotion_16_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; CMOV-NEXT: movl $12414, %ecx # imm = 0x307E
|
|
|
|
; CMOV-NEXT: movl $65535, %eax # imm = 0xFFFF
|
|
|
|
; CMOV-NEXT: cmovnel %ecx, %eax
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_zpromotion_16_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $12414, %eax # imm = 0x307E
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: jne .LBB3_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $65535, %eax # imm = 0xFFFF
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: .LBB3_2:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i16 12414, i16 -1
|
|
|
|
%ret = zext i16 %t0 to i32
|
|
|
|
ret i32 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @cmov_zpromotion_16_to_64(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_zpromotion_16_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; CMOV-NEXT: movl $12414, %ecx # imm = 0x307E
|
|
|
|
; CMOV-NEXT: movl $65535, %eax # imm = 0xFFFF
|
2018-02-16 14:52:43 +08:00
|
|
|
; CMOV-NEXT: cmovnel %ecx, %eax
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_zpromotion_16_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $12414, %eax # imm = 0x307E
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: jne .LBB4_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $65535, %eax # imm = 0xFFFF
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: .LBB4_2:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: xorl %edx, %edx
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i16 12414, i16 -1
|
|
|
|
%ret = zext i16 %t0 to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
2017-09-07 16:59:05 +08:00
|
|
|
define i64 @cmov_zpromotion_32_to_64(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_zpromotion_32_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movl $12414, %ecx # imm = 0x307E
|
|
|
|
; CMOV-NEXT: movl $-1, %eax
|
|
|
|
; CMOV-NEXT: cmovnel %ecx, %eax
|
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_zpromotion_32_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movl $12414, %eax # imm = 0x307E
|
|
|
|
; NO_CMOV-NEXT: jne .LBB5_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movl $-1, %eax
|
|
|
|
; NO_CMOV-NEXT: .LBB5_2:
|
|
|
|
; NO_CMOV-NEXT: xorl %edx, %edx
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i32 12414, i32 -1
|
|
|
|
%ret = zext i32 %t0 to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @cmov_spromotion_8_to_16(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_spromotion_8_to_16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movb $117, %al
|
|
|
|
; CMOV-NEXT: jne .LBB6_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: movb $-19, %al
|
|
|
|
; CMOV-NEXT: .LBB6_2:
|
|
|
|
; CMOV-NEXT: movsbl %al, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; CMOV-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_spromotion_8_to_16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movb $117, %al
|
|
|
|
; NO_CMOV-NEXT: jne .LBB6_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movb $-19, %al
|
|
|
|
; NO_CMOV-NEXT: .LBB6_2:
|
|
|
|
; NO_CMOV-NEXT: movsbl %al, %eax
|
2018-02-01 06:04:26 +08:00
|
|
|
; NO_CMOV-NEXT: # kill: def $ax killed $ax killed $eax
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i8 117, i8 -19
|
|
|
|
%ret = sext i8 %t0 to i16
|
|
|
|
ret i16 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @cmov_spromotion_8_to_32(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_spromotion_8_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movb $126, %al
|
|
|
|
; CMOV-NEXT: jne .LBB7_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: movb $-1, %al
|
|
|
|
; CMOV-NEXT: .LBB7_2:
|
|
|
|
; CMOV-NEXT: movsbl %al, %eax
|
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_spromotion_8_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movb $126, %al
|
|
|
|
; NO_CMOV-NEXT: jne .LBB7_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movb $-1, %al
|
|
|
|
; NO_CMOV-NEXT: .LBB7_2:
|
|
|
|
; NO_CMOV-NEXT: movsbl %al, %eax
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i8 12414, i8 -1
|
|
|
|
%ret = sext i8 %t0 to i32
|
|
|
|
ret i32 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @cmov_spromotion_8_to_64(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_spromotion_8_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
|
|
|
; CMOV-NEXT: movb $126, %al
|
|
|
|
; CMOV-NEXT: jne .LBB8_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: movb $-1, %al
|
|
|
|
; CMOV-NEXT: .LBB8_2:
|
|
|
|
; CMOV-NEXT: movsbq %al, %rax
|
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_spromotion_8_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movb $126, %al
|
|
|
|
; NO_CMOV-NEXT: jne .LBB8_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movb $-1, %al
|
|
|
|
; NO_CMOV-NEXT: .LBB8_2:
|
|
|
|
; NO_CMOV-NEXT: movsbl %al, %eax
|
|
|
|
; NO_CMOV-NEXT: movl %eax, %edx
|
|
|
|
; NO_CMOV-NEXT: sarl $31, %edx
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i8 12414, i8 -1
|
|
|
|
%ret = sext i8 %t0 to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
2017-08-17 06:50:11 +08:00
|
|
|
define i32 @cmov_spromotion_16_to_32(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_spromotion_16_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; CMOV-NEXT: movl $12414, %ecx # imm = 0x307E
|
|
|
|
; CMOV-NEXT: movl $-1, %eax
|
|
|
|
; CMOV-NEXT: cmovnel %ecx, %eax
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_spromotion_16_to_32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $12414, %eax # imm = 0x307E
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: jne .LBB9_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $-1, %eax
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: .LBB9_2:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i16 12414, i16 -1
|
|
|
|
%ret = sext i16 %t0 to i32
|
|
|
|
ret i32 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @cmov_spromotion_16_to_64(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_spromotion_16_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; CMOV-NEXT: movl $12414, %ecx # imm = 0x307E
|
|
|
|
; CMOV-NEXT: movq $-1, %rax
|
|
|
|
; CMOV-NEXT: cmovneq %rcx, %rax
|
2017-08-17 06:50:11 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_spromotion_16_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $12414, %eax # imm = 0x307E
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: jne .LBB10_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments
Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:
before (20 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ax
mov $0xffff,%cx
cmovne %ax,%cx
movzwl %cx,%eax
retq
after (18 bytes)
<foo>:
test $0x1,%dil
mov $0x307e,%ecx
mov $0xffff,%eax
cmovne %ecx,%eax
retq
Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36711
llvm-svn: 313982
2017-09-22 21:21:39 +08:00
|
|
|
; NO_CMOV-NEXT: movl $-1, %eax
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: .LBB10_2:
|
2017-08-17 06:50:11 +08:00
|
|
|
; NO_CMOV-NEXT: movl %eax, %edx
|
|
|
|
; NO_CMOV-NEXT: sarl $31, %edx
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i16 12414, i16 -1
|
|
|
|
%ret = sext i16 %t0 to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
2017-09-07 16:59:05 +08:00
|
|
|
define i64 @cmov_spromotion_32_to_64(i1 %c) {
|
|
|
|
; CMOV-LABEL: cmov_spromotion_32_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: testb $1, %dil
|
2018-02-16 15:16:15 +08:00
|
|
|
; CMOV-NEXT: movl $12414, %ecx # imm = 0x307E
|
|
|
|
; CMOV-NEXT: movq $-1, %rax
|
|
|
|
; CMOV-NEXT: cmovneq %rcx, %rax
|
2017-09-07 16:59:05 +08:00
|
|
|
; CMOV-NEXT: retq
|
|
|
|
;
|
|
|
|
; NO_CMOV-LABEL: cmov_spromotion_32_to_64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV: # %bb.0:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
|
|
|
|
; NO_CMOV-NEXT: movl $12414, %eax # imm = 0x307E
|
|
|
|
; NO_CMOV-NEXT: jne .LBB11_2
|
2017-12-05 01:18:51 +08:00
|
|
|
; NO_CMOV-NEXT: # %bb.1:
|
2017-09-07 16:59:05 +08:00
|
|
|
; NO_CMOV-NEXT: movl $-1, %eax
|
|
|
|
; NO_CMOV-NEXT: .LBB11_2:
|
|
|
|
; NO_CMOV-NEXT: movl %eax, %edx
|
|
|
|
; NO_CMOV-NEXT: sarl $31, %edx
|
|
|
|
; NO_CMOV-NEXT: retl
|
|
|
|
%t0 = select i1 %c, i32 12414, i32 -1
|
|
|
|
%ret = sext i32 %t0 to i64
|
|
|
|
ret i64 %ret
|
|
|
|
}
|