9 changes: 3 additions & 6 deletions llvm/test/CodeGen/X86/avx-vinsertf128.ll
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ define <8 x i32> @DAGCombineB(<8 x i32> %v1, <8 x i32> %v2) nounwind readonly {
define <4 x double> @insert_undef_pd(<4 x double> %a0, <2 x double> %a1) {
; CHECK-LABEL: insert_undef_pd:
; CHECK: # %bb.0:
; CHECK-NEXT: # kill: def $xmm1 killed $xmm1 def $ymm1
; CHECK-NEXT: vmovaps %ymm1, %ymm0
; CHECK-NEXT: vmovaps %xmm1, %xmm0
; CHECK-NEXT: retq
%res = call <4 x double> @llvm.x86.avx.vinsertf128.pd.256(<4 x double> undef, <2 x double> %a1, i8 0)
ret <4 x double> %res
Expand All @@ -86,8 +85,7 @@ declare <4 x double> @llvm.x86.avx.vinsertf128.pd.256(<4 x double>, <2 x double>
define <8 x float> @insert_undef_ps(<8 x float> %a0, <4 x float> %a1) {
; CHECK-LABEL: insert_undef_ps:
; CHECK: # %bb.0:
; CHECK-NEXT: # kill: def $xmm1 killed $xmm1 def $ymm1
; CHECK-NEXT: vmovaps %ymm1, %ymm0
; CHECK-NEXT: vmovaps %xmm1, %xmm0
; CHECK-NEXT: retq
%res = call <8 x float> @llvm.x86.avx.vinsertf128.ps.256(<8 x float> undef, <4 x float> %a1, i8 0)
ret <8 x float> %res
Expand All @@ -97,8 +95,7 @@ declare <8 x float> @llvm.x86.avx.vinsertf128.ps.256(<8 x float>, <4 x float>, i
define <8 x i32> @insert_undef_si(<8 x i32> %a0, <4 x i32> %a1) {
; CHECK-LABEL: insert_undef_si:
; CHECK: # %bb.0:
; CHECK-NEXT: # kill: def $xmm1 killed $xmm1 def $ymm1
; CHECK-NEXT: vmovaps %ymm1, %ymm0
; CHECK-NEXT: vmovaps %xmm1, %xmm0
; CHECK-NEXT: retq
%res = call <8 x i32> @llvm.x86.avx.vinsertf128.si.256(<8 x i32> undef, <4 x i32> %a1, i8 0)
ret <8 x i32> %res
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/avx512-arith.ll
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,9 @@ define <8 x double> @test_broadcast_vaddpd(<8 x double> %i, double* %j) nounwind
define <8 x double> @test_mask_broadcast_vaddpd(<8 x double> %dst, <8 x double> %i,
; CHECK-LABEL: test_mask_broadcast_vaddpd:
; CHECK: # %bb.0:
; CHECK-NEXT: vptestmq %zmm2, %zmm2, %k1
; CHECK-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm1 {%k1}
; CHECK-NEXT: vmovapd %zmm1, %zmm0
; CHECK-NEXT: vptestmq %zmm2, %zmm2, %k1
; CHECK-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm0 {%k1}
; CHECK-NEXT: retq
double* %j, <8 x i64> %mask1) nounwind {
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/avx512-calling-conv.ll
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ define i1 @test9(double %a, double %b) {
define i32 @test10(i32 %a, i32 %b, i1 %cond) {
; ALL_X64-LABEL: test10:
; ALL_X64: ## %bb.0:
; ALL_X64-NEXT: testb $1, %dl
; ALL_X64-NEXT: cmovel %esi, %edi
; ALL_X64-NEXT: movl %edi, %eax
; ALL_X64-NEXT: testb $1, %dl
; ALL_X64-NEXT: cmovel %esi, %eax
; ALL_X64-NEXT: retq
;
; KNL_X32-LABEL: test10:
Expand Down
32 changes: 16 additions & 16 deletions llvm/test/CodeGen/X86/avx512-insert-extract.ll
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,21 @@ define <16 x i32> @test11(<16 x i32>%a, <16 x i32>%b) {
define i64 @test12(<16 x i64>%a, <16 x i64>%b, i64 %a1, i64 %b1) {
; KNL-LABEL: test12:
; KNL: ## %bb.0:
; KNL-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
; KNL-NEXT: kmovw %k0, %eax
; KNL-NEXT: testb $1, %al
; KNL-NEXT: cmoveq %rsi, %rdi
; KNL-NEXT: movq %rdi, %rax
; KNL-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
; KNL-NEXT: kmovw %k0, %ecx
; KNL-NEXT: testb $1, %cl
; KNL-NEXT: cmoveq %rsi, %rax
; KNL-NEXT: vzeroupper
; KNL-NEXT: retq
;
; SKX-LABEL: test12:
; SKX: ## %bb.0:
; SKX-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
; SKX-NEXT: kmovd %k0, %eax
; SKX-NEXT: testb $1, %al
; SKX-NEXT: cmoveq %rsi, %rdi
; SKX-NEXT: movq %rdi, %rax
; SKX-NEXT: vpcmpgtq %zmm0, %zmm2, %k0
; SKX-NEXT: kmovd %k0, %ecx
; SKX-NEXT: testb $1, %cl
; SKX-NEXT: cmoveq %rsi, %rax
; SKX-NEXT: vzeroupper
; SKX-NEXT: retq
%cmpvector_func.i = icmp slt <16 x i64> %a, %b
Expand Down Expand Up @@ -257,23 +257,23 @@ define i16 @test13(i32 %a, i32 %b) {
define i64 @test14(<8 x i64>%a, <8 x i64>%b, i64 %a1, i64 %b1) {
; KNL-LABEL: test14:
; KNL: ## %bb.0:
; KNL-NEXT: movq %rdi, %rax
; KNL-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
; KNL-NEXT: kshiftrw $4, %k0, %k0
; KNL-NEXT: kmovw %k0, %eax
; KNL-NEXT: testb $1, %al
; KNL-NEXT: cmoveq %rsi, %rdi
; KNL-NEXT: movq %rdi, %rax
; KNL-NEXT: kmovw %k0, %ecx
; KNL-NEXT: testb $1, %cl
; KNL-NEXT: cmoveq %rsi, %rax
; KNL-NEXT: vzeroupper
; KNL-NEXT: retq
;
; SKX-LABEL: test14:
; SKX: ## %bb.0:
; SKX-NEXT: movq %rdi, %rax
; SKX-NEXT: vpcmpgtq %zmm0, %zmm1, %k0
; SKX-NEXT: kshiftrw $4, %k0, %k0
; SKX-NEXT: kmovd %k0, %eax
; SKX-NEXT: testb $1, %al
; SKX-NEXT: cmoveq %rsi, %rdi
; SKX-NEXT: movq %rdi, %rax
; SKX-NEXT: kmovd %k0, %ecx
; SKX-NEXT: testb $1, %cl
; SKX-NEXT: cmoveq %rsi, %rax
; SKX-NEXT: vzeroupper
; SKX-NEXT: retq
%cmpvector_func.i = icmp slt <8 x i64> %a, %b
Expand Down
28 changes: 17 additions & 11 deletions llvm/test/CodeGen/X86/avx512-intrinsics-upgrade.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5853,9 +5853,10 @@ define i16 @test_kand(i16 %a0, i16 %a1) {
;
; X64-LABEL: test_kand:
; X64: ## %bb.0:
; X64-NEXT: andl %esi, %edi ## encoding: [0x21,0xf7]
; X64-NEXT: andl $8, %edi ## encoding: [0x83,0xe7,0x08]
; X64-NEXT: movl %edi, %eax ## encoding: [0x89,0xf8]
; X64-NEXT: andl %esi, %eax ## encoding: [0x21,0xf0]
; X64-NEXT: andl $8, %eax ## encoding: [0x83,0xe0,0x08]
; X64-NEXT: ## kill: def $ax killed $ax killed $eax
; X64-NEXT: retq ## encoding: [0xc3]
%t1 = call i16 @llvm.x86.avx512.kand.w(i16 %a0, i16 8)
%t2 = call i16 @llvm.x86.avx512.kand.w(i16 %t1, i16 %a1)
Expand All @@ -5875,9 +5876,10 @@ define i16 @test_kandn(i16 %a0, i16 %a1) {
;
; X64-LABEL: test_kandn:
; X64: ## %bb.0:
; X64-NEXT: orl $-9, %edi ## encoding: [0x83,0xcf,0xf7]
; X64-NEXT: andl %esi, %edi ## encoding: [0x21,0xf7]
; X64-NEXT: movl %edi, %eax ## encoding: [0x89,0xf8]
; X64-NEXT: orl $-9, %eax ## encoding: [0x83,0xc8,0xf7]
; X64-NEXT: andl %esi, %eax ## encoding: [0x21,0xf0]
; X64-NEXT: ## kill: def $ax killed $ax killed $eax
; X64-NEXT: retq ## encoding: [0xc3]
%t1 = call i16 @llvm.x86.avx512.kandn.w(i16 %a0, i16 8)
%t2 = call i16 @llvm.x86.avx512.kandn.w(i16 %t1, i16 %a1)
Expand All @@ -5895,8 +5897,9 @@ define i16 @test_knot(i16 %a0) {
;
; X64-LABEL: test_knot:
; X64: ## %bb.0:
; X64-NEXT: notl %edi ## encoding: [0xf7,0xd7]
; X64-NEXT: movl %edi, %eax ## encoding: [0x89,0xf8]
; X64-NEXT: notl %eax ## encoding: [0xf7,0xd0]
; X64-NEXT: ## kill: def $ax killed $ax killed $eax
; X64-NEXT: retq ## encoding: [0xc3]
%res = call i16 @llvm.x86.avx512.knot.w(i16 %a0)
ret i16 %res
Expand All @@ -5914,9 +5917,10 @@ define i16 @test_kor(i16 %a0, i16 %a1) {
;
; X64-LABEL: test_kor:
; X64: ## %bb.0:
; X64-NEXT: orl %esi, %edi ## encoding: [0x09,0xf7]
; X64-NEXT: orl $8, %edi ## encoding: [0x83,0xcf,0x08]
; X64-NEXT: movl %edi, %eax ## encoding: [0x89,0xf8]
; X64-NEXT: orl %esi, %eax ## encoding: [0x09,0xf0]
; X64-NEXT: orl $8, %eax ## encoding: [0x83,0xc8,0x08]
; X64-NEXT: ## kill: def $ax killed $ax killed $eax
; X64-NEXT: retq ## encoding: [0xc3]
%t1 = call i16 @llvm.x86.avx512.kor.w(i16 %a0, i16 8)
%t2 = call i16 @llvm.x86.avx512.kor.w(i16 %t1, i16 %a1)
Expand All @@ -5937,9 +5941,10 @@ define i16 @test_kxnor(i16 %a0, i16 %a1) {
;
; X64-LABEL: test_kxnor:
; X64: ## %bb.0:
; X64-NEXT: xorl %esi, %edi ## encoding: [0x31,0xf7]
; X64-NEXT: xorl $8, %edi ## encoding: [0x83,0xf7,0x08]
; X64-NEXT: movl %edi, %eax ## encoding: [0x89,0xf8]
; X64-NEXT: xorl %esi, %eax ## encoding: [0x31,0xf0]
; X64-NEXT: xorl $8, %eax ## encoding: [0x83,0xf0,0x08]
; X64-NEXT: ## kill: def $ax killed $ax killed $eax
; X64-NEXT: retq ## encoding: [0xc3]
%t1 = call i16 @llvm.x86.avx512.kxnor.w(i16 %a0, i16 8)
%t2 = call i16 @llvm.x86.avx512.kxnor.w(i16 %t1, i16 %a1)
Expand All @@ -5958,9 +5963,10 @@ define i16 @test_kxor(i16 %a0, i16 %a1) {
;
; X64-LABEL: test_kxor:
; X64: ## %bb.0:
; X64-NEXT: xorl %esi, %edi ## encoding: [0x31,0xf7]
; X64-NEXT: xorl $8, %edi ## encoding: [0x83,0xf7,0x08]
; X64-NEXT: movl %edi, %eax ## encoding: [0x89,0xf8]
; X64-NEXT: xorl %esi, %eax ## encoding: [0x31,0xf0]
; X64-NEXT: xorl $8, %eax ## encoding: [0x83,0xf0,0x08]
; X64-NEXT: ## kill: def $ax killed $ax killed $eax
; X64-NEXT: retq ## encoding: [0xc3]
%t1 = call i16 @llvm.x86.avx512.kxor.w(i16 %a0, i16 8)
%t2 = call i16 @llvm.x86.avx512.kxor.w(i16 %t1, i16 %a1)
Expand Down
15 changes: 9 additions & 6 deletions llvm/test/CodeGen/X86/avx512-mask-op.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
define i16 @mask16(i16 %x) {
; CHECK-LABEL: mask16:
; CHECK: ## %bb.0:
; CHECK-NEXT: notl %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: notl %eax
; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq
;
; X86-LABEL: mask16:
Expand Down Expand Up @@ -47,8 +48,9 @@ define i32 @mask16_zext(i16 %x) {
define i8 @mask8(i8 %x) {
; CHECK-LABEL: mask8:
; CHECK: ## %bb.0:
; CHECK-NEXT: notb %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: notb %al
; CHECK-NEXT: ## kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
;
; X86-LABEL: mask8:
Expand Down Expand Up @@ -149,10 +151,11 @@ define i16 @mand16(i16 %x, i16 %y) {
; CHECK-LABEL: mand16:
; CHECK: ## %bb.0:
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: xorl %esi, %eax
; CHECK-NEXT: andl %esi, %edi
; CHECK-NEXT: orl %eax, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: movl %edi, %ecx
; CHECK-NEXT: xorl %esi, %ecx
; CHECK-NEXT: andl %esi, %eax
; CHECK-NEXT: orl %ecx, %eax
; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq
;
; X86-LABEL: mand16:
Expand Down
45 changes: 22 additions & 23 deletions llvm/test/CodeGen/X86/avx512-regcall-NoMask.ll
Original file line number Diff line number Diff line change
Expand Up @@ -924,47 +924,46 @@ define x86_regcallcc i32 @testi32_inp(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a
; X32-NEXT: pushl %ebx
; X32-NEXT: subl $20, %esp
; X32-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
; X32-NEXT: movl %edi, %esi
; X32-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
; X32-NEXT: movl %edx, %ebx
; X32-NEXT: movl %edx, (%esp) # 4-byte Spill
; X32-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
; X32-NEXT: movl %eax, %edx
; X32-NEXT: movl %eax, %ebx
; X32-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
; X32-NEXT: subl %ecx, %edx
; X32-NEXT: movl {{[0-9]+}}(%esp), %edi
; X32-NEXT: movl %edi, %ebp
; X32-NEXT: subl {{[0-9]+}}(%esp), %ebp
; X32-NEXT: imull %ebp, %edx
; X32-NEXT: subl %esi, %ebx
; X32-NEXT: subl %ecx, %ebx
; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
; X32-NEXT: movl %esi, %ecx
; X32-NEXT: movl %esi, %ebp
; X32-NEXT: subl {{[0-9]+}}(%esp), %ebp
; X32-NEXT: imull %ebp, %ebx
; X32-NEXT: movl %edx, %ebp
; X32-NEXT: subl %edi, %ebp
; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
; X32-NEXT: movl %edx, %ecx
; X32-NEXT: subl {{[0-9]+}}(%esp), %ecx
; X32-NEXT: imull %ebx, %ecx
; X32-NEXT: addl %ecx, %edx
; X32-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
; X32-NEXT: movl %ebx, %ebp
; X32-NEXT: imull %ebp, %ecx
; X32-NEXT: addl %ecx, %ebx
; X32-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
; X32-NEXT: movl %edi, %ebp
; X32-NEXT: subl {{[0-9]+}}(%esp), %ebp
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X32-NEXT: movl %ecx, %eax
; X32-NEXT: subl {{[0-9]+}}(%esp), %eax
; X32-NEXT: imull %ebp, %eax
; X32-NEXT: addl %eax, %edx
; X32-NEXT: addl %eax, %ebx
; X32-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
; X32-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
; X32-NEXT: movl (%esp), %ebp # 4-byte Reload
; X32-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Folded Reload
; X32-NEXT: addl {{[0-9]+}}(%esp), %ebx
; X32-NEXT: addl {{[0-9]+}}(%esp), %edi
; X32-NEXT: imull %eax, %edi
; X32-NEXT: addl {{[0-9]+}}(%esp), %esi
; X32-NEXT: imull %ebp, %esi
; X32-NEXT: addl %edi, %esi
; X32-NEXT: imull %eax, %esi
; X32-NEXT: addl {{[0-9]+}}(%esp), %edx
; X32-NEXT: imull %ebp, %edx
; X32-NEXT: addl %esi, %edx
; X32-NEXT: addl {{[0-9]+}}(%esp), %ecx
; X32-NEXT: imull %ebx, %ecx
; X32-NEXT: addl %esi, %ecx
; X32-NEXT: addl %ecx, %edx
; X32-NEXT: movl %edx, %eax
; X32-NEXT: imull %edi, %ecx
; X32-NEXT: addl %edx, %ecx
; X32-NEXT: addl %ecx, %ebx
; X32-NEXT: movl %ebx, %eax
; X32-NEXT: addl $20, %esp
; X32-NEXT: popl %ebx
; X32-NEXT: popl %ebp
Expand Down
38 changes: 22 additions & 16 deletions llvm/test/CodeGen/X86/avx512-schedule.ll
Original file line number Diff line number Diff line change
Expand Up @@ -947,16 +947,16 @@ define <8 x double> @test_broadcast_vaddpd(<8 x double> %i, double* %j) nounwind
define <8 x double> @test_mask_broadcast_vaddpd(<8 x double> %dst, <8 x double> %i, double* %j, <8 x i64> %mask1) nounwind {
; GENERIC-LABEL: test_mask_broadcast_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm1 {%k1} # sched: [10:1.00]
; GENERIC-NEXT: vmovapd %zmm1, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm0 {%k1} # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_broadcast_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm1 {%k1} # sched: [11:0.50]
; SKX-NEXT: vmovapd %zmm1, %zmm0 # sched: [1:0.33]
; SKX-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm0 {%k1} # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%tmp = load double, double* %j
Expand Down Expand Up @@ -6669,14 +6669,16 @@ define <8 x double> @mov_test47(i8 * %addr, <8 x double> %mask1) {
define i16 @mask16(i16 %x) {
; GENERIC-LABEL: mask16:
; GENERIC: # %bb.0:
; GENERIC-NEXT: notl %edi # sched: [1:0.33]
; GENERIC-NEXT: movl %edi, %eax # sched: [1:0.33]
; GENERIC-NEXT: notl %eax # sched: [1:0.33]
; GENERIC-NEXT: # kill: def $ax killed $ax killed $eax
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mask16:
; SKX: # %bb.0:
; SKX-NEXT: notl %edi # sched: [1:0.25]
; SKX-NEXT: movl %edi, %eax # sched: [1:0.25]
; SKX-NEXT: notl %eax # sched: [1:0.25]
; SKX-NEXT: # kill: def $ax killed $ax killed $eax
; SKX-NEXT: retq # sched: [7:1.00]
%m0 = bitcast i16 %x to <16 x i1>
%m1 = xor <16 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
Expand Down Expand Up @@ -6706,14 +6708,16 @@ define i32 @mask16_zext(i16 %x) {
define i8 @mask8(i8 %x) {
; GENERIC-LABEL: mask8:
; GENERIC: # %bb.0:
; GENERIC-NEXT: notb %dil # sched: [1:0.33]
; GENERIC-NEXT: movl %edi, %eax # sched: [1:0.33]
; GENERIC-NEXT: notb %al # sched: [1:0.33]
; GENERIC-NEXT: # kill: def $al killed $al killed $eax
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mask8:
; SKX: # %bb.0:
; SKX-NEXT: notb %dil # sched: [1:0.25]
; SKX-NEXT: movl %edi, %eax # sched: [1:0.25]
; SKX-NEXT: notb %al # sched: [1:0.25]
; SKX-NEXT: # kill: def $al killed $al killed $eax
; SKX-NEXT: retq # sched: [7:1.00]
%m0 = bitcast i8 %x to <8 x i1>
%m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
Expand Down Expand Up @@ -6788,19 +6792,21 @@ define i16 @mand16(i16 %x, i16 %y) {
; GENERIC-LABEL: mand16:
; GENERIC: # %bb.0:
; GENERIC-NEXT: movl %edi, %eax # sched: [1:0.33]
; GENERIC-NEXT: xorl %esi, %eax # sched: [1:0.33]
; GENERIC-NEXT: andl %esi, %edi # sched: [1:0.33]
; GENERIC-NEXT: orl %eax, %edi # sched: [1:0.33]
; GENERIC-NEXT: movl %edi, %eax # sched: [1:0.33]
; GENERIC-NEXT: movl %edi, %ecx # sched: [1:0.33]
; GENERIC-NEXT: xorl %esi, %ecx # sched: [1:0.33]
; GENERIC-NEXT: andl %esi, %eax # sched: [1:0.33]
; GENERIC-NEXT: orl %ecx, %eax # sched: [1:0.33]
; GENERIC-NEXT: # kill: def $ax killed $ax killed $eax
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mand16:
; SKX: # %bb.0:
; SKX-NEXT: movl %edi, %eax # sched: [1:0.25]
; SKX-NEXT: xorl %esi, %eax # sched: [1:0.25]
; SKX-NEXT: andl %esi, %edi # sched: [1:0.25]
; SKX-NEXT: orl %eax, %edi # sched: [1:0.25]
; SKX-NEXT: movl %edi, %eax # sched: [1:0.25]
; SKX-NEXT: movl %edi, %ecx # sched: [1:0.25]
; SKX-NEXT: xorl %esi, %ecx # sched: [1:0.25]
; SKX-NEXT: andl %esi, %eax # sched: [1:0.25]
; SKX-NEXT: orl %ecx, %eax # sched: [1:0.25]
; SKX-NEXT: # kill: def $ax killed $ax killed $eax
; SKX-NEXT: retq # sched: [7:1.00]
%ma = bitcast i16 %x to <16 x i1>
%mb = bitcast i16 %y to <16 x i1>
Expand Down
6 changes: 4 additions & 2 deletions llvm/test/CodeGen/X86/avx512-select.ll
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ define i8 @select05(i8 %a.0, i8 %m) {
;
; X64-LABEL: select05:
; X64: # %bb.0:
; X64-NEXT: orl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: orl %esi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%mask = bitcast i8 %m to <8 x i1>
%a = bitcast i8 %a.0 to <8 x i1>
Expand Down Expand Up @@ -185,8 +186,9 @@ define i8 @select06(i8 %a.0, i8 %m) {
;
; X64-LABEL: select06:
; X64: # %bb.0:
; X64-NEXT: andl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andl %esi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%mask = bitcast i8 %m to <8 x i1>
%a = bitcast i8 %a.0 to <8 x i1>
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/CodeGen/X86/avx512bw-mask-op.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
define i32 @mask32(i32 %x) {
; CHECK-LABEL: mask32:
; CHECK: ## %bb.0:
; CHECK-NEXT: notl %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: notl %eax
; CHECK-NEXT: retq
%m0 = bitcast i32 %x to <32 x i1>
%m1 = xor <32 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1,
Expand All @@ -19,8 +19,8 @@ define i32 @mask32(i32 %x) {
define i64 @mask64(i64 %x) {
; CHECK-LABEL: mask64:
; CHECK: ## %bb.0:
; CHECK-NEXT: notq %rdi
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: notq %rax
; CHECK-NEXT: retq
%m0 = bitcast i64 %x to <64 x i1>
%m1 = xor <64 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1,
Expand Down Expand Up @@ -79,10 +79,10 @@ define i32 @mand32(i32 %x, i32 %y) {
; CHECK-LABEL: mand32:
; CHECK: ## %bb.0:
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl %esi, %eax
; CHECK-NEXT: xorl %esi, %edi
; CHECK-NEXT: orl %eax, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: movl %edi, %ecx
; CHECK-NEXT: andl %esi, %ecx
; CHECK-NEXT: xorl %esi, %eax
; CHECK-NEXT: orl %ecx, %eax
; CHECK-NEXT: retq
%ma = bitcast i32 %x to <32 x i1>
%mb = bitcast i32 %y to <32 x i1>
Expand Down Expand Up @@ -116,10 +116,10 @@ define i64 @mand64(i64 %x, i64 %y) {
; CHECK-LABEL: mand64:
; CHECK: ## %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: andq %rsi, %rax
; CHECK-NEXT: xorq %rsi, %rdi
; CHECK-NEXT: orq %rax, %rdi
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: movq %rdi, %rcx
; CHECK-NEXT: andq %rsi, %rcx
; CHECK-NEXT: xorq %rsi, %rax
; CHECK-NEXT: orq %rcx, %rax
; CHECK-NEXT: retq
%ma = bitcast i64 %x to <64 x i1>
%mb = bitcast i64 %y to <64 x i1>
Expand Down
12 changes: 7 additions & 5 deletions llvm/test/CodeGen/X86/avx512dq-mask-op.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
define i8 @mask8(i8 %x) {
; CHECK-LABEL: mask8:
; CHECK: ## %bb.0:
; CHECK-NEXT: notb %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: notb %al
; CHECK-NEXT: ## kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%m0 = bitcast i8 %x to <8 x i1>
%m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
Expand All @@ -32,10 +33,11 @@ define i8 @mand8(i8 %x, i8 %y) {
; CHECK-LABEL: mand8:
; CHECK: ## %bb.0:
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: xorl %esi, %eax
; CHECK-NEXT: andl %esi, %edi
; CHECK-NEXT: orl %eax, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: movl %edi, %ecx
; CHECK-NEXT: xorl %esi, %ecx
; CHECK-NEXT: andl %esi, %eax
; CHECK-NEXT: orl %ecx, %eax
; CHECK-NEXT: ## kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%ma = bitcast i8 %x to <8 x i1>
%mb = bitcast i8 %y to <8 x i1>
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/X86/avx512vl-arith.ll
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ define <4 x double> @test_broadcast2_vaddpd_256(<4 x double> %i, double* %j) nou
define <4 x double> @test_mask_broadcast_vaddpd_256(<4 x double> %dst, <4 x double> %i, double* %j, <4 x i64> %mask1) nounwind {
; CHECK-LABEL: test_mask_broadcast_vaddpd_256:
; CHECK: ## %bb.0:
; CHECK-NEXT: vptestmq %ymm2, %ymm2, %k1 ## encoding: [0x62,0xf2,0xed,0x28,0x27,0xca]
; CHECK-NEXT: vaddpd (%rdi){1to4}, %ymm1, %ymm1 {%k1} ## encoding: [0x62,0xf1,0xf5,0x39,0x58,0x0f]
; CHECK-NEXT: vmovapd %ymm1, %ymm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfd,0x28,0xc1]
; CHECK-NEXT: vptestmq %ymm2, %ymm2, %k1 ## encoding: [0x62,0xf2,0xed,0x28,0x27,0xca]
; CHECK-NEXT: vaddpd (%rdi){1to4}, %ymm1, %ymm0 {%k1} ## encoding: [0x62,0xf1,0xf5,0x39,0x58,0x07]
; CHECK-NEXT: retq ## encoding: [0xc3]
%mask = icmp ne <4 x i64> %mask1, zeroinitializer
%tmp = load double, double* %j
Expand Down Expand Up @@ -835,9 +835,9 @@ define <2 x double> @test_broadcast2_vaddpd_128(<2 x double> %i, double* %j) nou
define <2 x double> @test_mask_broadcast_vaddpd_128(<2 x double> %dst, <2 x double> %i, double* %j, <2 x i64> %mask1) nounwind {
; CHECK-LABEL: test_mask_broadcast_vaddpd_128:
; CHECK: ## %bb.0:
; CHECK-NEXT: vptestmq %xmm2, %xmm2, %k1 ## encoding: [0x62,0xf2,0xed,0x08,0x27,0xca]
; CHECK-NEXT: vaddpd (%rdi){1to2}, %xmm1, %xmm1 {%k1} ## encoding: [0x62,0xf1,0xf5,0x19,0x58,0x0f]
; CHECK-NEXT: vmovapd %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x28,0xc1]
; CHECK-NEXT: vptestmq %xmm2, %xmm2, %k1 ## encoding: [0x62,0xf2,0xed,0x08,0x27,0xca]
; CHECK-NEXT: vaddpd (%rdi){1to2}, %xmm1, %xmm0 {%k1} ## encoding: [0x62,0xf1,0xf5,0x19,0x58,0x07]
; CHECK-NEXT: retq ## encoding: [0xc3]
%mask = icmp ne <2 x i64> %mask1, zeroinitializer
%tmp = load double, double* %j
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/CodeGen/X86/bigstructret.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
define fastcc %0 @ReturnBigStruct() nounwind readnone {
; X86-LABEL: ReturnBigStruct:
; X86: # %bb.0: # %entry
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: movl $24601, 12(%ecx) # imm = 0x6019
; X86-NEXT: movl $48, 8(%ecx)
; X86-NEXT: movl $24, 4(%ecx)
; X86-NEXT: movl $12, (%ecx)
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: retl
;
; X64-LABEL: ReturnBigStruct:
; X64: # %bb.0: # %entry
; X64-NEXT: movabsq $105660490448944, %rax # imm = 0x601900000030
; X64-NEXT: movq %rax, 8(%rdi)
; X64-NEXT: movabsq $103079215116, %rax # imm = 0x180000000C
; X64-NEXT: movq %rax, (%rdi)
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: movabsq $105660490448944, %rcx # imm = 0x601900000030
; X64-NEXT: movq %rcx, 8(%rdi)
; X64-NEXT: movabsq $103079215116, %rcx # imm = 0x180000000C
; X64-NEXT: movq %rcx, (%rdi)
; X64-NEXT: retq
entry:
%0 = insertvalue %0 zeroinitializer, i32 12, 0
Expand All @@ -35,18 +35,18 @@ entry:
define fastcc %1 @ReturnBigStruct2() nounwind readnone {
; X86-LABEL: ReturnBigStruct2:
; X86: # %bb.0: # %entry
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: movl $48, 4(%ecx)
; X86-NEXT: movb $1, 2(%ecx)
; X86-NEXT: movw $256, (%ecx) # imm = 0x100
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: retl
;
; X64-LABEL: ReturnBigStruct2:
; X64: # %bb.0: # %entry
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: movl $48, 4(%rdi)
; X64-NEXT: movb $1, 2(%rdi)
; X64-NEXT: movw $256, (%rdi) # imm = 0x100
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: retq
entry:
%0 = insertvalue %1 zeroinitializer, i1 false, 0
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/bitcast-i256.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
define i256 @foo(<8 x i32> %a) {
; FAST-LABEL: foo:
; FAST: # %bb.0:
; FAST-NEXT: vmovups %ymm0, (%rdi)
; FAST-NEXT: movq %rdi, %rax
; FAST-NEXT: vmovups %ymm0, (%rdi)
; FAST-NEXT: vzeroupper
; FAST-NEXT: retq
;
; SLOW-LABEL: foo:
; SLOW: # %bb.0:
; SLOW-NEXT: movq %rdi, %rax
; SLOW-NEXT: vextractf128 $1, %ymm0, 16(%rdi)
; SLOW-NEXT: vmovups %xmm0, (%rdi)
; SLOW-NEXT: movq %rdi, %rax
; SLOW-NEXT: vzeroupper
; SLOW-NEXT: retq
%r = bitcast <8 x i32> %a to i256
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/CodeGen/X86/bitcast-int-to-vector-bool.ll
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ define <16 x i1> @bitcast_i16_16i1(i16 zeroext %a0) {
define <32 x i1> @bitcast_i32_32i1(i32 %a0) {
; SSE2-SSSE3-LABEL: bitcast_i32_32i1:
; SSE2-SSSE3: # %bb.0:
; SSE2-SSSE3-NEXT: movl %esi, (%rdi)
; SSE2-SSSE3-NEXT: movq %rdi, %rax
; SSE2-SSSE3-NEXT: movl %esi, (%rdi)
; SSE2-SSSE3-NEXT: retq
;
; AVX1-LABEL: bitcast_i32_32i1:
Expand Down Expand Up @@ -250,14 +250,14 @@ define <32 x i1> @bitcast_i32_32i1(i32 %a0) {
define <64 x i1> @bitcast_i64_64i1(i64 %a0) {
; SSE2-SSSE3-LABEL: bitcast_i64_64i1:
; SSE2-SSSE3: # %bb.0:
; SSE2-SSSE3-NEXT: movq %rsi, (%rdi)
; SSE2-SSSE3-NEXT: movq %rdi, %rax
; SSE2-SSSE3-NEXT: movq %rsi, (%rdi)
; SSE2-SSSE3-NEXT: retq
;
; AVX12-LABEL: bitcast_i64_64i1:
; AVX12: # %bb.0:
; AVX12-NEXT: movq %rsi, (%rdi)
; AVX12-NEXT: movq %rdi, %rax
; AVX12-NEXT: movq %rsi, (%rdi)
; AVX12-NEXT: retq
;
; AVX512-LABEL: bitcast_i64_64i1:
Expand Down
57 changes: 30 additions & 27 deletions llvm/test/CodeGen/X86/bitreverse.ll
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,21 @@ define i8 @test_bitreverse_i8(i8 %a) {
;
; X64-LABEL: test_bitreverse_i8:
; X64: # %bb.0:
; X64-NEXT: rolb $4, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $51, %al
; X64-NEXT: shlb $2, %al
; X64-NEXT: andb $-52, %dil
; X64-NEXT: shrb $2, %dil
; X64-NEXT: orb %al, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $85, %al
; X64-NEXT: addb %al, %al
; X64-NEXT: andb $-86, %dil
; X64-NEXT: shrb %dil
; X64-NEXT: orb %al, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: rolb $4, %al
; X64-NEXT: movl %eax, %ecx
; X64-NEXT: andb $51, %cl
; X64-NEXT: shlb $2, %cl
; X64-NEXT: andb $-52, %al
; X64-NEXT: shrb $2, %al
; X64-NEXT: orb %cl, %al
; X64-NEXT: movl %eax, %ecx
; X64-NEXT: andb $85, %cl
; X64-NEXT: addb %cl, %cl
; X64-NEXT: andb $-86, %al
; X64-NEXT: shrb %al
; X64-NEXT: orb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%b = call i8 @llvm.bitreverse.i8(i8 %a)
ret i8 %b
Expand Down Expand Up @@ -384,21 +385,22 @@ define i4 @test_bitreverse_i4(i4 %a) {
;
; X64-LABEL: test_bitreverse_i4:
; X64: # %bb.0:
; X64-NEXT: rolb $4, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $51, %al
; X64-NEXT: shlb $2, %al
; X64-NEXT: andb $-52, %dil
; X64-NEXT: shrb $2, %dil
; X64-NEXT: orb %al, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $80, %al
; X64-NEXT: addb %al, %al
; X64-NEXT: andb $-96, %dil
; X64-NEXT: shrb %dil
; X64-NEXT: orb %al, %dil
; X64-NEXT: shrb $4, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: rolb $4, %al
; X64-NEXT: movl %eax, %ecx
; X64-NEXT: andb $51, %cl
; X64-NEXT: shlb $2, %cl
; X64-NEXT: andb $-52, %al
; X64-NEXT: shrb $2, %al
; X64-NEXT: orb %cl, %al
; X64-NEXT: movl %eax, %ecx
; X64-NEXT: andb $80, %cl
; X64-NEXT: addb %cl, %cl
; X64-NEXT: andb $-96, %al
; X64-NEXT: shrb %al
; X64-NEXT: orb %cl, %al
; X64-NEXT: shrb $4, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%b = call i4 @llvm.bitreverse.i4(i4 %a)
ret i4 %b
Expand Down Expand Up @@ -474,6 +476,7 @@ define i8 @identity_i8(i8 %a) {
; X64-LABEL: identity_i8:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%b = call i8 @llvm.bitreverse.i8(i8 %a)
%c = call i8 @llvm.bitreverse.i8(i8 %b)
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel-x86_64.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
define i64 @test__andn_u64(i64 %a0, i64 %a1) {
; X64-LABEL: test__andn_u64:
; X64: # %bb.0:
; X64-NEXT: xorq $-1, %rdi
; X64-NEXT: andq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: xorq $-1, %rax
; X64-NEXT: andq %rsi, %rax
; X64-NEXT: retq
%xor = xor i64 %a0, -1
%res = and i64 %xor, %a1
Expand Down Expand Up @@ -84,9 +84,9 @@ define i64 @test__tzcnt_u64(i64 %a0) {
define i64 @test_andn_u64(i64 %a0, i64 %a1) {
; X64-LABEL: test_andn_u64:
; X64: # %bb.0:
; X64-NEXT: xorq $-1, %rdi
; X64-NEXT: andq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: xorq $-1, %rax
; X64-NEXT: andq %rsi, %rax
; X64-NEXT: retq
%xor = xor i64 %a0, -1
%res = and i64 %xor, %a1
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/X86/bmi-intrinsics-fast-isel.ll
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ define i32 @test__andn_u32(i32 %a0, i32 %a1) {
;
; X64-LABEL: test__andn_u32:
; X64: # %bb.0:
; X64-NEXT: xorl $-1, %edi
; X64-NEXT: andl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: xorl $-1, %eax
; X64-NEXT: andl %esi, %eax
; X64-NEXT: retq
%xor = xor i32 %a0, -1
%res = and i32 %xor, %a1
Expand Down Expand Up @@ -199,9 +199,9 @@ define i32 @test_andn_u32(i32 %a0, i32 %a1) {
;
; X64-LABEL: test_andn_u32:
; X64: # %bb.0:
; X64-NEXT: xorl $-1, %edi
; X64-NEXT: andl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: xorl $-1, %eax
; X64-NEXT: andl %esi, %eax
; X64-NEXT: retq
%xor = xor i32 %a0, -1
%res = and i32 %xor, %a1
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/bmi.ll
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ define i32 @non_bextr32(i32 %x) {
;
; X64-LABEL: non_bextr32:
; X64: # %bb.0: # %entry
; X64-NEXT: shrl $2, %edi
; X64-NEXT: andl $111, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shrl $2, %eax
; X64-NEXT: andl $111, %eax
; X64-NEXT: retq
entry:
%shr = lshr i32 %x, 2
Expand Down
28 changes: 14 additions & 14 deletions llvm/test/CodeGen/X86/bmi2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ define i32 @mulx32(i32 %x, i32 %y, i32* %p) {
;
; X64-LABEL: mulx32:
; X64: # %bb.0:
; X64-NEXT: # kill: def $esi killed $esi def $rsi
; X64-NEXT: movl %esi, %eax
; X64-NEXT: # kill: def $edi killed $edi def $rdi
; X64-NEXT: addl %edi, %edi
; X64-NEXT: addl %esi, %esi
; X64-NEXT: imulq %rdi, %rsi
; X64-NEXT: movq %rsi, %rax
; X64-NEXT: shrq $32, %rax
; X64-NEXT: movl %eax, (%rdx)
; X64-NEXT: movl %esi, %eax
; X64-NEXT: addl %eax, %eax
; X64-NEXT: imulq %rdi, %rax
; X64-NEXT: movq %rax, %rcx
; X64-NEXT: shrq $32, %rcx
; X64-NEXT: movl %ecx, (%rdx)
; X64-NEXT: # kill: def $eax killed $eax killed $rax
; X64-NEXT: retq
%x1 = add i32 %x, %x
%y1 = add i32 %y, %y
Expand All @@ -165,14 +165,14 @@ define i32 @mulx32_load(i32 %x, i32* %y, i32* %p) {
;
; X64-LABEL: mulx32_load:
; X64: # %bb.0:
; X64-NEXT: # kill: def $edi killed $edi def $rdi
; X64-NEXT: addl %edi, %edi
; X64-NEXT: movl (%rsi), %eax
; X64-NEXT: imulq %rax, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: shrq $32, %rax
; X64-NEXT: movl %eax, (%rdx)
; X64-NEXT: movl %edi, %eax
; X64-NEXT: addl %eax, %eax
; X64-NEXT: movl (%rsi), %ecx
; X64-NEXT: imulq %rcx, %rax
; X64-NEXT: movq %rax, %rcx
; X64-NEXT: shrq $32, %rcx
; X64-NEXT: movl %ecx, (%rdx)
; X64-NEXT: # kill: def $eax killed $eax killed $rax
; X64-NEXT: retq
%x1 = add i32 %x, %x
%y1 = load i32, i32* %y
Expand Down
33 changes: 19 additions & 14 deletions llvm/test/CodeGen/X86/bool-math.ll
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ define i32 @sub_zext_cmp_mask_wider_result(i8 %x) {
define i8 @sub_zext_cmp_mask_narrower_result(i32 %x) {
; CHECK-LABEL: sub_zext_cmp_mask_narrower_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andl $1, %edi
; CHECK-NEXT: orb $46, %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl $1, %eax
; CHECK-NEXT: orb $46, %al
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
Expand All @@ -46,9 +47,10 @@ define i8 @sub_zext_cmp_mask_narrower_result(i32 %x) {
define i8 @add_zext_cmp_mask_same_size_result(i8 %x) {
; CHECK-LABEL: add_zext_cmp_mask_same_size_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andb $1, %dil
; CHECK-NEXT: xorb $27, %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andb $1, %al
; CHECK-NEXT: xorb $27, %al
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
Expand All @@ -60,9 +62,9 @@ define i8 @add_zext_cmp_mask_same_size_result(i8 %x) {
define i32 @add_zext_cmp_mask_wider_result(i8 %x) {
; CHECK-LABEL: add_zext_cmp_mask_wider_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andl $1, %edi
; CHECK-NEXT: xorl $27, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl $1, %eax
; CHECK-NEXT: xorl $27, %eax
; CHECK-NEXT: retq
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
Expand All @@ -74,9 +76,10 @@ define i32 @add_zext_cmp_mask_wider_result(i8 %x) {
define i8 @add_zext_cmp_mask_narrower_result(i32 %x) {
; CHECK-LABEL: add_zext_cmp_mask_narrower_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andl $1, %edi
; CHECK-NEXT: xorb $43, %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl $1, %eax
; CHECK-NEXT: xorb $43, %al
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%a = and i32 %x, 1
%c = icmp eq i32 %a, 0
Expand Down Expand Up @@ -128,9 +131,10 @@ define i16 @low_bit_select_constants_bigger_false_narrower_result(i32 %x) {
define i8 @low_bit_select_constants_bigger_true_same_size_result(i8 %x) {
; CHECK-LABEL: low_bit_select_constants_bigger_true_same_size_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andb $1, %dil
; CHECK-NEXT: xorb $-29, %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andb $1, %al
; CHECK-NEXT: xorb $-29, %al
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
Expand All @@ -141,9 +145,9 @@ define i8 @low_bit_select_constants_bigger_true_same_size_result(i8 %x) {
define i32 @low_bit_select_constants_bigger_true_wider_result(i8 %x) {
; CHECK-LABEL: low_bit_select_constants_bigger_true_wider_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andl $1, %edi
; CHECK-NEXT: xorl $227, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl $1, %eax
; CHECK-NEXT: xorl $227, %eax
; CHECK-NEXT: retq
%a = and i8 %x, 1
%c = icmp eq i8 %a, 0
Expand All @@ -154,9 +158,10 @@ define i32 @low_bit_select_constants_bigger_true_wider_result(i8 %x) {
define i8 @low_bit_select_constants_bigger_true_narrower_result(i16 %x) {
; CHECK-LABEL: low_bit_select_constants_bigger_true_narrower_result:
; CHECK: # %bb.0:
; CHECK-NEXT: andl $1, %edi
; CHECK-NEXT: xorb $41, %dil
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl $1, %eax
; CHECK-NEXT: xorb $41, %al
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%a = and i16 %x, 1
%c = icmp eq i16 %a, 0
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/bool-simplify.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
define i32 @foo(<2 x i64> %c, i32 %a, i32 %b) {
; CHECK-LABEL: foo:
; CHECK: # %bb.0:
; CHECK-NEXT: ptest %xmm0, %xmm0
; CHECK-NEXT: cmovnel %esi, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: ptest %xmm0, %xmm0
; CHECK-NEXT: cmovnel %esi, %eax
; CHECK-NEXT: retq
%t1 = call i32 @llvm.x86.sse41.ptestz(<2 x i64> %c, <2 x i64> %c)
%t2 = icmp ne i32 %t1, 0
Expand Down
3 changes: 2 additions & 1 deletion llvm/test/CodeGen/X86/bswap-rotate.ll
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ define i16 @combine_bswap_rotate(i16 %a0) {
;
; X64-LABEL: combine_bswap_rotate:
; X64: # %bb.0:
; X64-NEXT: rolw $9, %di
; X64-NEXT: movl %edi, %eax
; X64-NEXT: rolw $9, %ax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
%1 = call i16 @llvm.bswap.i16(i16 %a0)
%2 = shl i16 %1, 1
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/CodeGen/X86/bswap-wide-int.ll
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ define i64 @bswap_i64(i64 %a0) nounwind {
;
; X64-LABEL: bswap_i64:
; X64: # %bb.0:
; X64-NEXT: bswapq %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: bswapq %rax
; X64-NEXT: retq
;
; X64-MOVBE-LABEL: bswap_i64:
; X64-MOVBE: # %bb.0:
; X64-MOVBE-NEXT: bswapq %rdi
; X64-MOVBE-NEXT: movq %rdi, %rax
; X64-MOVBE-NEXT: bswapq %rax
; X64-MOVBE-NEXT: retq
%1 = call i64 @llvm.bswap.i64(i64 %a0)
ret i64 %1
Expand Down Expand Up @@ -79,17 +79,17 @@ define i128 @bswap_i128(i128 %a0) nounwind {
;
; X64-LABEL: bswap_i128:
; X64: # %bb.0:
; X64-NEXT: bswapq %rsi
; X64-NEXT: bswapq %rdi
; X64-NEXT: movq %rsi, %rax
; X64-NEXT: bswapq %rax
; X64-NEXT: bswapq %rdi
; X64-NEXT: movq %rdi, %rdx
; X64-NEXT: retq
;
; X64-MOVBE-LABEL: bswap_i128:
; X64-MOVBE: # %bb.0:
; X64-MOVBE-NEXT: bswapq %rsi
; X64-MOVBE-NEXT: bswapq %rdi
; X64-MOVBE-NEXT: movq %rsi, %rax
; X64-MOVBE-NEXT: bswapq %rax
; X64-MOVBE-NEXT: bswapq %rdi
; X64-MOVBE-NEXT: movq %rdi, %rdx
; X64-MOVBE-NEXT: retq
%1 = call i128 @llvm.bswap.i128(i128 %a0)
Expand Down Expand Up @@ -149,6 +149,7 @@ define i256 @bswap_i256(i256 %a0) nounwind {
;
; X64-LABEL: bswap_i256:
; X64: # %bb.0:
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: bswapq %r8
; X64-NEXT: bswapq %rcx
; X64-NEXT: bswapq %rdx
Expand All @@ -157,16 +158,15 @@ define i256 @bswap_i256(i256 %a0) nounwind {
; X64-NEXT: movq %rdx, 16(%rdi)
; X64-NEXT: movq %rcx, 8(%rdi)
; X64-NEXT: movq %r8, (%rdi)
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: retq
;
; X64-MOVBE-LABEL: bswap_i256:
; X64-MOVBE: # %bb.0:
; X64-MOVBE-NEXT: movq %rdi, %rax
; X64-MOVBE-NEXT: movbeq %rsi, 24(%rdi)
; X64-MOVBE-NEXT: movbeq %rdx, 16(%rdi)
; X64-MOVBE-NEXT: movbeq %rcx, 8(%rdi)
; X64-MOVBE-NEXT: movbeq %r8, (%rdi)
; X64-MOVBE-NEXT: movq %rdi, %rax
; X64-MOVBE-NEXT: retq
%1 = call i256 @llvm.bswap.i256(i256 %a0)
ret i256 %1
Expand Down
15 changes: 8 additions & 7 deletions llvm/test/CodeGen/X86/bswap.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ define i16 @W(i16 %A) {
;
; CHECK64-LABEL: W:
; CHECK64: # %bb.0:
; CHECK64-NEXT: rolw $8, %di
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: rolw $8, %ax
; CHECK64-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK64-NEXT: retq
%Z = call i16 @llvm.bswap.i16( i16 %A ) ; <i16> [#uses=1]
ret i16 %Z
Expand All @@ -35,8 +36,8 @@ define i32 @X(i32 %A) {
;
; CHECK64-LABEL: X:
; CHECK64: # %bb.0:
; CHECK64-NEXT: bswapl %edi
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: bswapl %eax
; CHECK64-NEXT: retq
%Z = call i32 @llvm.bswap.i32( i32 %A ) ; <i32> [#uses=1]
ret i32 %Z
Expand All @@ -53,8 +54,8 @@ define i64 @Y(i64 %A) {
;
; CHECK64-LABEL: Y:
; CHECK64: # %bb.0:
; CHECK64-NEXT: bswapq %rdi
; CHECK64-NEXT: movq %rdi, %rax
; CHECK64-NEXT: bswapq %rax
; CHECK64-NEXT: retq
%Z = call i64 @llvm.bswap.i64( i64 %A ) ; <i64> [#uses=1]
ret i64 %Z
Expand All @@ -71,9 +72,9 @@ define i32 @test1(i32 %a) nounwind readnone {
;
; CHECK64-LABEL: test1:
; CHECK64: # %bb.0: # %entry
; CHECK64-NEXT: bswapl %edi
; CHECK64-NEXT: shrl $16, %edi
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: bswapl %eax
; CHECK64-NEXT: shrl $16, %eax
; CHECK64-NEXT: retq
entry:

Expand All @@ -95,9 +96,9 @@ define i32 @test2(i32 %a) nounwind readnone {
;
; CHECK64-LABEL: test2:
; CHECK64: # %bb.0: # %entry
; CHECK64-NEXT: bswapl %edi
; CHECK64-NEXT: sarl $16, %edi
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: bswapl %eax
; CHECK64-NEXT: sarl $16, %eax
; CHECK64-NEXT: retq
entry:

Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/X86/bswap_tree.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ define i32 @test1(i32 %x) nounwind {
;
; CHECK64-LABEL: test1:
; CHECK64: # %bb.0:
; CHECK64-NEXT: bswapl %edi
; CHECK64-NEXT: roll $16, %edi
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: bswapl %eax
; CHECK64-NEXT: roll $16, %eax
; CHECK64-NEXT: retq
%byte0 = and i32 %x, 255 ; 0x000000ff
%byte1 = and i32 %x, 65280 ; 0x0000ff00
Expand Down Expand Up @@ -53,9 +53,9 @@ define i32 @test2(i32 %x) nounwind {
;
; CHECK64-LABEL: test2:
; CHECK64: # %bb.0:
; CHECK64-NEXT: bswapl %edi
; CHECK64-NEXT: roll $16, %edi
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: bswapl %eax
; CHECK64-NEXT: roll $16, %eax
; CHECK64-NEXT: retq
%byte1 = shl i32 %x, 8
%byte0 = lshr i32 %x, 8
Expand Down
18 changes: 9 additions & 9 deletions llvm/test/CodeGen/X86/bswap_tree2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
; CHECK64-LABEL: test1:
; CHECK64: # %bb.0:
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: andl $16711680, %eax # imm = 0xFF0000
; CHECK64-NEXT: movl %edi, %ecx
; CHECK64-NEXT: orl $-16777216, %ecx # imm = 0xFF000000
; CHECK64-NEXT: shll $8, %eax
; CHECK64-NEXT: shrl $8, %ecx
; CHECK64-NEXT: orl %eax, %ecx
; CHECK64-NEXT: bswapl %edi
; CHECK64-NEXT: shrl $16, %edi
; CHECK64-NEXT: orl %ecx, %edi
; CHECK64-NEXT: movl %edi, %eax
; CHECK64-NEXT: andl $16711680, %ecx # imm = 0xFF0000
; CHECK64-NEXT: movl %edi, %edx
; CHECK64-NEXT: orl $-16777216, %edx # imm = 0xFF000000
; CHECK64-NEXT: shll $8, %ecx
; CHECK64-NEXT: shrl $8, %edx
; CHECK64-NEXT: orl %ecx, %edx
; CHECK64-NEXT: bswapl %eax
; CHECK64-NEXT: shrl $16, %eax
; CHECK64-NEXT: orl %edx, %eax
; CHECK64-NEXT: retq
%byte0 = and i32 %x, 255 ; 0x000000ff
%byte1 = and i32 %x, 65280 ; 0x0000ff00
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/CodeGen/X86/bt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1112,16 +1112,16 @@ define void @demanded_i32(i32* nocapture readonly, i32* nocapture, i32) nounwind
;
; X64-LABEL: demanded_i32:
; X64: # %bb.0:
; X64-NEXT: movl %edx, %ecx
; X64-NEXT: movl %edx, %eax
; X64-NEXT: shrl $5, %eax
; X64-NEXT: movl (%rdi,%rax,4), %r8d
; X64-NEXT: movl $1, %edi
; X64-NEXT: movl %edx, %ecx
; X64-NEXT: shll %cl, %edi
; X64-NEXT: btl %edx, %r8d
; X64-NEXT: movl (%rdi,%rax,4), %edi
; X64-NEXT: movl $1, %edx
; X64-NEXT: shll %cl, %edx
; X64-NEXT: btl %ecx, %edi
; X64-NEXT: jae .LBB30_2
; X64-NEXT: # %bb.1:
; X64-NEXT: orl %edi, (%rsi,%rax,4)
; X64-NEXT: orl %edx, (%rsi,%rax,4)
; X64-NEXT: .LBB30_2:
; X64-NEXT: retq
%4 = lshr i32 %2, 5
Expand Down
79 changes: 48 additions & 31 deletions llvm/test/CodeGen/X86/btc_bts_btr.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
define i16 @btr_16(i16 %x, i16 %n) {
; X64-LABEL: btr_16:
; X64: # %bb.0:
; X64-NEXT: movw $-2, %ax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movw $-2, %ax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: rolw %cl, %ax
; X64-NEXT: andl %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
Expand All @@ -28,8 +29,9 @@ define i16 @btr_16(i16 %x, i16 %n) {
define i16 @bts_16(i16 %x, i16 %n) {
; X64-LABEL: bts_16:
; X64: # %bb.0:
; X64-NEXT: btsl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btsl %esi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
;
; X86-LABEL: bts_16:
Expand All @@ -48,8 +50,9 @@ define i16 @bts_16(i16 %x, i16 %n) {
define i16 @btc_16(i16 %x, i16 %n) {
; X64-LABEL: btc_16:
; X64: # %bb.0:
; X64-NEXT: btcl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btcl %esi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
;
; X86-LABEL: btc_16:
Expand All @@ -68,8 +71,8 @@ define i16 @btc_16(i16 %x, i16 %n) {
define i32 @btr_32(i32 %x, i32 %n) {
; X64-LABEL: btr_32:
; X64: # %bb.0:
; X64-NEXT: btrl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btrl %esi, %eax
; X64-NEXT: retq
;
; X86-LABEL: btr_32:
Expand All @@ -87,8 +90,8 @@ define i32 @btr_32(i32 %x, i32 %n) {
define i32 @bts_32(i32 %x, i32 %n) {
; X64-LABEL: bts_32:
; X64: # %bb.0:
; X64-NEXT: btsl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btsl %esi, %eax
; X64-NEXT: retq
;
; X86-LABEL: bts_32:
Expand All @@ -105,8 +108,8 @@ define i32 @bts_32(i32 %x, i32 %n) {
define i32 @btc_32(i32 %x, i32 %n) {
; X64-LABEL: btc_32:
; X64: # %bb.0:
; X64-NEXT: btcl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btcl %esi, %eax
; X64-NEXT: retq
;
; X86-LABEL: btc_32:
Expand All @@ -123,8 +126,8 @@ define i32 @btc_32(i32 %x, i32 %n) {
define i64 @btr_64(i64 %x, i64 %n) {
; X64-LABEL: btr_64:
; X64: # %bb.0:
; X64-NEXT: btrq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: btrq %rsi, %rax
; X64-NEXT: retq
;
; X86-LABEL: btr_64:
Expand Down Expand Up @@ -154,8 +157,8 @@ define i64 @btr_64(i64 %x, i64 %n) {
define i64 @bts_64(i64 %x, i64 %n) {
; X64-LABEL: bts_64:
; X64: # %bb.0:
; X64-NEXT: btsq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: btsq %rsi, %rax
; X64-NEXT: retq
;
; X86-LABEL: bts_64:
Expand All @@ -182,8 +185,8 @@ define i64 @bts_64(i64 %x, i64 %n) {
define i64 @btc_64(i64 %x, i64 %n) {
; X64-LABEL: btc_64:
; X64: # %bb.0:
; X64-NEXT: btcq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: btcq %rsi, %rax
; X64-NEXT: retq
;
; X86-LABEL: btc_64:
Expand All @@ -210,8 +213,9 @@ define i64 @btc_64(i64 %x, i64 %n) {
define i16 @btr_16_mask(i16 %x, i16 %n) {
; X64-LABEL: btr_16_mask:
; X64: # %bb.0:
; X64-NEXT: movw $-2, %ax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movw $-2, %ax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: rolw %cl, %ax
; X64-NEXT: andl %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
Expand All @@ -233,9 +237,10 @@ define i16 @btr_16_mask(i16 %x, i16 %n) {
define i16 @bts_16_mask(i16 %x, i16 %n) {
; X64-LABEL: bts_16_mask:
; X64: # %bb.0:
; X64-NEXT: andb $15, %sil
; X64-NEXT: btsl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $15, %sil
; X64-NEXT: btsl %esi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
;
; X86-LABEL: bts_16_mask:
Expand All @@ -256,9 +261,10 @@ define i16 @bts_16_mask(i16 %x, i16 %n) {
define i16 @btc_16_mask(i16 %x, i16 %n) {
; X64-LABEL: btc_16_mask:
; X64: # %bb.0:
; X64-NEXT: andb $15, %sil
; X64-NEXT: btcl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $15, %sil
; X64-NEXT: btcl %esi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
;
; X86-LABEL: btc_16_mask:
Expand All @@ -279,8 +285,8 @@ define i16 @btc_16_mask(i16 %x, i16 %n) {
define i32 @btr_32_mask(i32 %x, i32 %n) {
; X64-LABEL: btr_32_mask:
; X64: # %bb.0:
; X64-NEXT: btrl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btrl %esi, %eax
; X64-NEXT: retq
;
; X86-LABEL: btr_32_mask:
Expand All @@ -299,8 +305,8 @@ define i32 @btr_32_mask(i32 %x, i32 %n) {
define i32 @bts_32_mask(i32 %x, i32 %n) {
; X64-LABEL: bts_32_mask:
; X64: # %bb.0:
; X64-NEXT: btsl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btsl %esi, %eax
; X64-NEXT: retq
;
; X86-LABEL: bts_32_mask:
Expand All @@ -318,8 +324,8 @@ define i32 @bts_32_mask(i32 %x, i32 %n) {
define i32 @btc_32_mask(i32 %x, i32 %n) {
; X64-LABEL: btc_32_mask:
; X64: # %bb.0:
; X64-NEXT: btcl %esi, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: btcl %esi, %eax
; X64-NEXT: retq
;
; X86-LABEL: btc_32_mask:
Expand All @@ -337,8 +343,8 @@ define i32 @btc_32_mask(i32 %x, i32 %n) {
define i64 @btr_64_mask(i64 %x, i64 %n) {
; X64-LABEL: btr_64_mask:
; X64: # %bb.0:
; X64-NEXT: btrq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: btrq %rsi, %rax
; X64-NEXT: retq
;
; X86-LABEL: btr_64_mask:
Expand Down Expand Up @@ -369,8 +375,8 @@ define i64 @btr_64_mask(i64 %x, i64 %n) {
define i64 @bts_64_mask(i64 %x, i64 %n) {
; X64-LABEL: bts_64_mask:
; X64: # %bb.0:
; X64-NEXT: btsq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: btsq %rsi, %rax
; X64-NEXT: retq
;
; X86-LABEL: bts_64_mask:
Expand Down Expand Up @@ -398,8 +404,8 @@ define i64 @bts_64_mask(i64 %x, i64 %n) {
define i64 @btc_64_mask(i64 %x, i64 %n) {
; X64-LABEL: btc_64_mask:
; X64: # %bb.0:
; X64-NEXT: btcq %rsi, %rdi
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: btcq %rsi, %rax
; X64-NEXT: retq
;
; X86-LABEL: btc_64_mask:
Expand Down Expand Up @@ -450,8 +456,9 @@ define i16 @btr_16_load(i16* %x, i16 %n) {
define i16 @bts_16_load(i16* %x, i16 %n) {
; X64-LABEL: bts_16_load:
; X64: # %bb.0:
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $1, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shll %cl, %eax
; X64-NEXT: orw (%rdi), %ax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
Expand All @@ -475,8 +482,9 @@ define i16 @bts_16_load(i16* %x, i16 %n) {
define i16 @btc_16_load(i16* %x, i16 %n) {
; X64-LABEL: btc_16_load:
; X64: # %bb.0:
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $1, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shll %cl, %eax
; X64-NEXT: xorw (%rdi), %ax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
Expand Down Expand Up @@ -673,8 +681,9 @@ define i64 @btc_64_load(i64* %x, i64 %n) {
define void @btr_16_dont_fold(i16* %x, i16 %n) {
; X64-LABEL: btr_16_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movw $-2, %ax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movw $-2, %ax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: rolw %cl, %ax
; X64-NEXT: andw %ax, (%rdi)
; X64-NEXT: retq
Expand All @@ -698,8 +707,9 @@ define void @btr_16_dont_fold(i16* %x, i16 %n) {
define void @bts_16_dont_fold(i16* %x, i16 %n) {
; X64-LABEL: bts_16_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $1, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shll %cl, %eax
; X64-NEXT: orw %ax, (%rdi)
; X64-NEXT: retq
Expand All @@ -722,8 +732,9 @@ define void @bts_16_dont_fold(i16* %x, i16 %n) {
define void @btc_16_dont_fold(i16* %x, i16 %n) {
; X64-LABEL: btc_16_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $1, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shll %cl, %eax
; X64-NEXT: xorw %ax, (%rdi)
; X64-NEXT: retq
Expand All @@ -746,8 +757,9 @@ define void @btc_16_dont_fold(i16* %x, i16 %n) {
define void @btr_32_dont_fold(i32* %x, i32 %n) {
; X64-LABEL: btr_32_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movl $-2, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $-2, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: roll %cl, %eax
; X64-NEXT: andl %eax, (%rdi)
; X64-NEXT: retq
Expand All @@ -771,8 +783,9 @@ define void @btr_32_dont_fold(i32* %x, i32 %n) {
define void @bts_32_dont_fold(i32* %x, i32 %n) {
; X64-LABEL: bts_32_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $1, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shll %cl, %eax
; X64-NEXT: orl %eax, (%rdi)
; X64-NEXT: retq
Expand All @@ -795,8 +808,9 @@ define void @bts_32_dont_fold(i32* %x, i32 %n) {
define void @btc_32_dont_fold(i32* %x, i32 %n) {
; X64-LABEL: btc_32_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: movl $1, %eax
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shll %cl, %eax
; X64-NEXT: xorl %eax, (%rdi)
; X64-NEXT: retq
Expand All @@ -819,8 +833,9 @@ define void @btc_32_dont_fold(i32* %x, i32 %n) {
define void @btr_64_dont_fold(i64* %x, i64 %n) {
; X64-LABEL: btr_64_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movq %rsi, %rcx
; X64-NEXT: movq $-2, %rax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NEXT: rolq %cl, %rax
; X64-NEXT: andq %rax, (%rdi)
; X64-NEXT: retq
Expand Down Expand Up @@ -860,8 +875,9 @@ define void @btr_64_dont_fold(i64* %x, i64 %n) {
define void @bts_64_dont_fold(i64* %x, i64 %n) {
; X64-LABEL: bts_64_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movq %rsi, %rcx
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NEXT: shlq %cl, %rax
; X64-NEXT: orq %rax, (%rdi)
; X64-NEXT: retq
Expand Down Expand Up @@ -898,8 +914,9 @@ define void @bts_64_dont_fold(i64* %x, i64 %n) {
define void @btc_64_dont_fold(i64* %x, i64 %n) {
; X64-LABEL: btc_64_dont_fold:
; X64: # %bb.0:
; X64-NEXT: movq %rsi, %rcx
; X64-NEXT: movl $1, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NEXT: shlq %cl, %rax
; X64-NEXT: xorq %rax, (%rdi)
; X64-NEXT: retq
Expand Down
27 changes: 13 additions & 14 deletions llvm/test/CodeGen/X86/bypass-slow-division-64.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ define i64 @Test_get_quotient(i64 %a, i64 %b) nounwind {
; CHECK-LABEL: Test_get_quotient:
; CHECK: # %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: orq %rsi, %rax
; CHECK-NEXT: shrq $32, %rax
; CHECK-NEXT: movq %rdi, %rcx
; CHECK-NEXT: orq %rsi, %rcx
; CHECK-NEXT: shrq $32, %rcx
; CHECK-NEXT: je .LBB0_1
; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: cqto
; CHECK-NEXT: idivq %rsi
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB0_1:
; CHECK-NEXT: xorl %edx, %edx
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
; CHECK-NEXT: divl %esi
; CHECK-NEXT: # kill: def $eax killed $eax def $rax
; CHECK-NEXT: retq
Expand All @@ -30,21 +30,20 @@ define i64 @Test_get_remainder(i64 %a, i64 %b) nounwind {
; CHECK-LABEL: Test_get_remainder:
; CHECK: # %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: orq %rsi, %rax
; CHECK-NEXT: shrq $32, %rax
; CHECK-NEXT: movq %rdi, %rcx
; CHECK-NEXT: orq %rsi, %rcx
; CHECK-NEXT: shrq $32, %rcx
; CHECK-NEXT: je .LBB1_1
; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: cqto
; CHECK-NEXT: idivq %rsi
; CHECK-NEXT: movq %rdx, %rax
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB1_1:
; CHECK-NEXT: xorl %edx, %edx
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
; CHECK-NEXT: divl %esi
; CHECK-NEXT: # kill: def $edx killed $edx def $rdx
; CHECK-NEXT: movq %rdx, %rax
; CHECK-NEXT: movl %edx, %eax
; CHECK-NEXT: retq
%result = srem i64 %a, %b
ret i64 %result
Expand All @@ -54,18 +53,18 @@ define i64 @Test_get_quotient_and_remainder(i64 %a, i64 %b) nounwind {
; CHECK-LABEL: Test_get_quotient_and_remainder:
; CHECK: # %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: orq %rsi, %rax
; CHECK-NEXT: shrq $32, %rax
; CHECK-NEXT: movq %rdi, %rcx
; CHECK-NEXT: orq %rsi, %rcx
; CHECK-NEXT: shrq $32, %rcx
; CHECK-NEXT: je .LBB2_1
; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: cqto
; CHECK-NEXT: idivq %rsi
; CHECK-NEXT: addq %rdx, %rax
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB2_1:
; CHECK-NEXT: xorl %edx, %edx
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
; CHECK-NEXT: divl %esi
; CHECK-NEXT: # kill: def $edx killed $edx def $rdx
; CHECK-NEXT: # kill: def $eax killed $eax def $rax
Expand Down
56 changes: 30 additions & 26 deletions llvm/test/CodeGen/X86/clear-highbits.ll
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ define i8 @clear_highbits8_c0(i8 %val, i8 %numhighbits) nounwind {
; X64-LABEL: clear_highbits8_c0:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: shlb %cl, %dil
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shrb %cl, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shlb %cl, %al
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shrb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%mask = lshr i8 -1, %numhighbits
%masked = and i8 %mask, %val
Expand Down Expand Up @@ -79,10 +80,11 @@ define i8 @clear_highbits8_c4_commutative(i8 %val, i8 %numhighbits) nounwind {
; X64-LABEL: clear_highbits8_c4_commutative:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: shlb %cl, %dil
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shrb %cl, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shlb %cl, %al
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shrb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%mask = lshr i8 -1, %numhighbits
%masked = and i8 %val, %mask ; swapped order
Expand Down Expand Up @@ -340,10 +342,10 @@ define i32 @clear_highbits32_c0(i32 %val, i32 %numhighbits) nounwind {
; X64-NOBMI2-LABEL: clear_highbits32_c0:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_highbits32_c0:
Expand Down Expand Up @@ -375,10 +377,10 @@ define i32 @clear_highbits32_c1_indexzext(i32 %val, i8 %numhighbits) nounwind {
; X64-NOBMI2-LABEL: clear_highbits32_c1_indexzext:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_highbits32_c1_indexzext:
Expand Down Expand Up @@ -488,10 +490,10 @@ define i32 @clear_highbits32_c4_commutative(i32 %val, i32 %numhighbits) nounwind
; X64-NOBMI2-LABEL: clear_highbits32_c4_commutative:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_highbits32_c4_commutative:
Expand Down Expand Up @@ -545,10 +547,10 @@ define i64 @clear_highbits64_c0(i64 %val, i64 %numhighbits) nounwind {
; X64-NOBMI2-LABEL: clear_highbits64_c0:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_highbits64_c0:
Expand Down Expand Up @@ -598,10 +600,10 @@ define i64 @clear_highbits64_c1_indexzext(i64 %val, i8 %numhighbits) nounwind {
; X64-NOBMI2-LABEL: clear_highbits64_c1_indexzext:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_highbits64_c1_indexzext:
Expand Down Expand Up @@ -775,10 +777,10 @@ define i64 @clear_highbits64_c4_commutative(i64 %val, i64 %numhighbits) nounwind
; X64-NOBMI2-LABEL: clear_highbits64_c4_commutative:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_highbits64_c4_commutative:
Expand Down Expand Up @@ -834,9 +836,10 @@ define i32 @oneuse32(i32 %val, i32 %numhighbits) nounwind {
; X64-NOBMI2-NEXT: pushq %rbp
; X64-NOBMI2-NEXT: pushq %rbx
; X64-NOBMI2-NEXT: pushq %rax
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: movl %edi, %ebx
; X64-NOBMI2-NEXT: movl $-1, %ebp
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shrl %cl, %ebp
; X64-NOBMI2-NEXT: movl %ebp, %edi
; X64-NOBMI2-NEXT: callq use32
Expand Down Expand Up @@ -934,9 +937,10 @@ define i64 @oneuse64(i64 %val, i64 %numhighbits) nounwind {
; X64-NOBMI2-NEXT: pushq %r14
; X64-NOBMI2-NEXT: pushq %rbx
; X64-NOBMI2-NEXT: pushq %rax
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: movq %rdi, %r14
; X64-NOBMI2-NEXT: movq $-1, %rbx
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shrq %cl, %rbx
; X64-NOBMI2-NEXT: movq %rbx, %rdi
; X64-NOBMI2-NEXT: callq use64
Expand Down
106 changes: 56 additions & 50 deletions llvm/test/CodeGen/X86/clear-lowbits.ll
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ define i8 @clear_lowbits8_c0(i8 %val, i8 %numlowbits) nounwind {
; X64-LABEL: clear_lowbits8_c0:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: shrb %cl, %dil
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shlb %cl, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shrb %cl, %al
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shlb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%mask = shl i8 -1, %numlowbits
%masked = and i8 %mask, %val
Expand Down Expand Up @@ -81,10 +82,11 @@ define i8 @clear_lowbits8_c4_commutative(i8 %val, i8 %numlowbits) nounwind {
; X64-LABEL: clear_lowbits8_c4_commutative:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: shrb %cl, %dil
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shlb %cl, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shrb %cl, %al
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: shlb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%mask = shl i8 -1, %numlowbits
%masked = and i8 %val, %mask ; swapped order
Expand Down Expand Up @@ -327,10 +329,10 @@ define i32 @clear_lowbits32_c0(i32 %val, i32 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits32_c0:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits32_c0:
Expand Down Expand Up @@ -362,10 +364,10 @@ define i32 @clear_lowbits32_c1_indexzext(i32 %val, i8 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits32_c1_indexzext:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits32_c1_indexzext:
Expand Down Expand Up @@ -475,10 +477,10 @@ define i32 @clear_lowbits32_c4_commutative(i32 %val, i32 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits32_c4_commutative:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits32_c4_commutative:
Expand Down Expand Up @@ -530,10 +532,10 @@ define i64 @clear_lowbits64_c0(i64 %val, i64 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits64_c0:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits64_c0:
Expand Down Expand Up @@ -583,10 +585,10 @@ define i64 @clear_lowbits64_c1_indexzext(i64 %val, i8 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits64_c1_indexzext:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits64_c1_indexzext:
Expand Down Expand Up @@ -760,10 +762,10 @@ define i64 @clear_lowbits64_c4_commutative(i64 %val, i64 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits64_c4_commutative:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits64_c4_commutative:
Expand Down Expand Up @@ -794,11 +796,12 @@ define i8 @clear_lowbits8_ic0(i8 %val, i8 %numlowbits) nounwind {
;
; X64-LABEL: clear_lowbits8_ic0:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movb $8, %cl
; X64-NEXT: subb %sil, %cl
; X64-NEXT: shrb %cl, %dil
; X64-NEXT: shlb %cl, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shrb %cl, %al
; X64-NEXT: shlb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%numhighbits = sub i8 8, %numlowbits
%mask = shl i8 -1, %numhighbits
Expand Down Expand Up @@ -844,11 +847,12 @@ define i8 @clear_lowbits8_ic4_commutative(i8 %val, i8 %numlowbits) nounwind {
;
; X64-LABEL: clear_lowbits8_ic4_commutative:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movb $8, %cl
; X64-NEXT: subb %sil, %cl
; X64-NEXT: shrb %cl, %dil
; X64-NEXT: shlb %cl, %dil
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shrb %cl, %al
; X64-NEXT: shlb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%numhighbits = sub i8 8, %numlowbits
%mask = shl i8 -1, %numhighbits
Expand Down Expand Up @@ -1126,11 +1130,11 @@ define i32 @clear_lowbits32_ic0(i32 %val, i32 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits32_ic0:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: negl %ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits32_ic0:
Expand Down Expand Up @@ -1167,11 +1171,11 @@ define i32 @clear_lowbits32_ic1_indexzext(i32 %val, i8 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits32_ic1_indexzext:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: negb %cl
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits32_ic1_indexzext:
Expand Down Expand Up @@ -1298,11 +1302,11 @@ define i32 @clear_lowbits32_ic4_commutative(i32 %val, i32 %numlowbits) nounwind
; X64-NOBMI2-LABEL: clear_lowbits32_ic4_commutative:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: negl %ecx
; X64-NOBMI2-NEXT: shrl %cl, %edi
; X64-NOBMI2-NEXT: shrl %cl, %eax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %edi
; X64-NOBMI2-NEXT: movl %edi, %eax
; X64-NOBMI2-NEXT: shll %cl, %eax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits32_ic4_commutative:
Expand Down Expand Up @@ -1358,11 +1362,11 @@ define i64 @clear_lowbits64_ic0(i64 %val, i64 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits64_ic0:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: negl %ecx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits64_ic0:
Expand Down Expand Up @@ -1416,11 +1420,11 @@ define i64 @clear_lowbits64_ic1_indexzext(i64 %val, i8 %numlowbits) nounwind {
; X64-NOBMI2-LABEL: clear_lowbits64_ic1_indexzext:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: negb %cl
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits64_ic1_indexzext:
Expand Down Expand Up @@ -1608,11 +1612,11 @@ define i64 @clear_lowbits64_ic4_commutative(i64 %val, i64 %numlowbits) nounwind
; X64-NOBMI2-LABEL: clear_lowbits64_ic4_commutative:
; X64-NOBMI2: # %bb.0:
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: negl %ecx
; X64-NOBMI2-NEXT: shrq %cl, %rdi
; X64-NOBMI2-NEXT: shrq %cl, %rax
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rdi
; X64-NOBMI2-NEXT: movq %rdi, %rax
; X64-NOBMI2-NEXT: shlq %cl, %rax
; X64-NOBMI2-NEXT: retq
;
; X64-BMI2-LABEL: clear_lowbits64_ic4_commutative:
Expand Down Expand Up @@ -1670,9 +1674,10 @@ define i32 @oneuse32(i32 %val, i32 %numlowbits) nounwind {
; X64-NOBMI2-NEXT: pushq %rbp
; X64-NOBMI2-NEXT: pushq %rbx
; X64-NOBMI2-NEXT: pushq %rax
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: movl %edi, %ebx
; X64-NOBMI2-NEXT: movl $-1, %ebp
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NOBMI2-NEXT: shll %cl, %ebp
; X64-NOBMI2-NEXT: movl %ebp, %edi
; X64-NOBMI2-NEXT: callq use32
Expand Down Expand Up @@ -1770,9 +1775,10 @@ define i64 @oneuse64(i64 %val, i64 %numlowbits) nounwind {
; X64-NOBMI2-NEXT: pushq %r14
; X64-NOBMI2-NEXT: pushq %rbx
; X64-NOBMI2-NEXT: pushq %rax
; X64-NOBMI2-NEXT: movq %rsi, %rcx
; X64-NOBMI2-NEXT: movq %rdi, %r14
; X64-NOBMI2-NEXT: movq $-1, %rbx
; X64-NOBMI2-NEXT: movl %esi, %ecx
; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NOBMI2-NEXT: shlq %cl, %rbx
; X64-NOBMI2-NEXT: movq %rbx, %rdi
; X64-NOBMI2-NEXT: callq use64
Expand Down
31 changes: 15 additions & 16 deletions llvm/test/CodeGen/X86/cmov-into-branch.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
define i32 @test1(double %a, double* nocapture %b, i32 %x, i32 %y) {
; CHECK-LABEL: test1:
; CHECK: # %bb.0:
; CHECK-NEXT: ucomisd (%rdi), %xmm0
; CHECK-NEXT: cmovbel %edx, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: ucomisd (%rdi), %xmm0
; CHECK-NEXT: cmovbel %edx, %eax
; CHECK-NEXT: retq
%load = load double, double* %b, align 8
%cmp = fcmp olt double %load, %a
Expand All @@ -19,9 +19,9 @@ define i32 @test1(double %a, double* nocapture %b, i32 %x, i32 %y) {
define i32 @test2(double %a, double %b, i32 %x, i32 %y) {
; CHECK-LABEL: test2:
; CHECK: # %bb.0:
; CHECK-NEXT: ucomisd %xmm1, %xmm0
; CHECK-NEXT: cmovbel %esi, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: ucomisd %xmm1, %xmm0
; CHECK-NEXT: cmovbel %esi, %eax
; CHECK-NEXT: retq
%cmp = fcmp ogt double %a, %b
%cond = select i1 %cmp, i32 %x, i32 %y
Expand All @@ -48,10 +48,10 @@ define i32 @test4(i32 %a, i32* nocapture %b, i32 %x, i32 %y) {
define i32 @test5(i32 %a, i32* nocapture %b, i32 %x, i32 %y) {
; CHECK-LABEL: test5:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl %edi, (%rsi)
; CHECK-NEXT: cmoval %edi, %ecx
; CHECK-NEXT: cmovael %edx, %ecx
; CHECK-NEXT: movl %ecx, %eax
; CHECK-NEXT: cmpl %edi, (%rsi)
; CHECK-NEXT: cmoval %edi, %eax
; CHECK-NEXT: cmovael %edx, %eax
; CHECK-NEXT: retq
%load = load i32, i32* %b, align 4
%cmp = icmp ult i32 %load, %a
Expand Down Expand Up @@ -83,9 +83,9 @@ entry:
define i32 @weighted_select1(i32 %a, i32 %b) {
; CHECK-LABEL: weighted_select1:
; CHECK: # %bb.0:
; CHECK-NEXT: testl %edi, %edi
; CHECK-NEXT: cmovnel %edi, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: testl %edi, %edi
; CHECK-NEXT: cmovnel %edi, %eax
; CHECK-NEXT: retq
%cmp = icmp ne i32 %a, 0
%sel = select i1 %cmp, i32 %a, i32 %b, !prof !0
Expand All @@ -96,12 +96,12 @@ define i32 @weighted_select1(i32 %a, i32 %b) {
define i32 @weighted_select2(i32 %a, i32 %b) {
; CHECK-LABEL: weighted_select2:
; CHECK: # %bb.0:
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: testl %edi, %edi
; CHECK-NEXT: jne .LBB6_2
; CHECK-NEXT: # %bb.1: # %select.false
; CHECK-NEXT: movl %esi, %edi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: .LBB6_2: # %select.end
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: retq
%cmp = icmp ne i32 %a, 0
%sel = select i1 %cmp, i32 %a, i32 %b, !prof !1
Expand All @@ -115,14 +115,13 @@ define i32 @weighted_select2(i32 %a, i32 %b) {
define i32 @weighted_select3(i32 %a, i32 %b) {
; CHECK-LABEL: weighted_select3:
; CHECK: # %bb.0:
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: testl %edi, %edi
; CHECK-NEXT: je .LBB7_1
; CHECK-NEXT: # %bb.2: # %select.end
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB7_1: # %select.false
; CHECK-NEXT: movl %esi, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: retq
%cmp = icmp ne i32 %a, 0
%sel = select i1 %cmp, i32 %a, i32 %b, !prof !2
Expand All @@ -133,9 +132,9 @@ define i32 @weighted_select3(i32 %a, i32 %b) {
define i32 @unweighted_select(i32 %a, i32 %b) {
; CHECK-LABEL: unweighted_select:
; CHECK: # %bb.0:
; CHECK-NEXT: testl %edi, %edi
; CHECK-NEXT: cmovnel %edi, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: testl %edi, %edi
; CHECK-NEXT: cmovnel %edi, %eax
; CHECK-NEXT: retq
%cmp = icmp ne i32 %a, 0
%sel = select i1 %cmp, i32 %a, i32 %b, !prof !3
Expand Down
11 changes: 7 additions & 4 deletions llvm/test/CodeGen/X86/cmov.ll
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@ define i8 @test7(i1 inreg %c, i8 inreg %a, i8 inreg %b) nounwind {
; CHECK-LABEL: test7:
; CHECK: # %bb.0:
; CHECK-NEXT: testb $1, %dil
; CHECK-NEXT: jne .LBB6_2
; CHECK-NEXT: # %bb.1:
; CHECK-NEXT: movl %edx, %esi
; CHECK-NEXT: .LBB6_2:
; CHECK-NEXT: jne .LBB6_1
; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: movl %edx, %eax
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB6_1:
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: retq
%d = select i1 %c, i8 %a, i8 %b
ret i8 %d
Expand Down
18 changes: 9 additions & 9 deletions llvm/test/CodeGen/X86/cmovcmov.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

; CHECK-LABEL: test_select_fcmp_oeq_i32:

; CMOV-NEXT: ucomiss %xmm1, %xmm0
; CMOV-NEXT: cmovnel %esi, %edi
; CMOV-NEXT: cmovpl %esi, %edi
; CMOV-NEXT: movl %edi, %eax
; CMOV-NEXT: ucomiss %xmm1, %xmm0
; CMOV-NEXT: cmovnel %esi, %eax
; CMOV-NEXT: cmovpl %esi, %eax
; CMOV-NEXT: retq

; NOCMOV-NEXT: flds 8(%esp)
Expand All @@ -36,10 +36,10 @@ entry:

; CHECK-LABEL: test_select_fcmp_oeq_i64:

; CMOV-NEXT: ucomiss %xmm1, %xmm0
; CMOV-NEXT: cmovneq %rsi, %rdi
; CMOV-NEXT: cmovpq %rsi, %rdi
; CMOV-NEXT: movq %rdi, %rax
; CMOV-NEXT: ucomiss %xmm1, %xmm0
; CMOV-NEXT: cmovneq %rsi, %rax
; CMOV-NEXT: cmovpq %rsi, %rax
; CMOV-NEXT: retq

; NOCMOV-NEXT: flds 8(%esp)
Expand All @@ -64,10 +64,10 @@ entry:

; CHECK-LABEL: test_select_fcmp_une_i64:

; CMOV-NEXT: ucomiss %xmm1, %xmm0
; CMOV-NEXT: cmovneq %rdi, %rsi
; CMOV-NEXT: cmovpq %rdi, %rsi
; CMOV-NEXT: movq %rsi, %rax
; CMOV-NEXT: ucomiss %xmm1, %xmm0
; CMOV-NEXT: cmovneq %rdi, %rax
; CMOV-NEXT: cmovpq %rdi, %rax
; CMOV-NEXT: retq

; NOCMOV-NEXT: flds 8(%esp)
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/X86/cmp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ declare zeroext i1 @test12b()
define i32 @test13(i32 %mask, i32 %base, i32 %intra) {
; CHECK-LABEL: test13:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: testb $8, %dil # encoding: [0x40,0xf6,0xc7,0x08]
; CHECK-NEXT: cmovnel %edx, %esi # encoding: [0x0f,0x45,0xf2]
; CHECK-NEXT: movl %esi, %eax # encoding: [0x89,0xf0]
; CHECK-NEXT: testb $8, %dil # encoding: [0x40,0xf6,0xc7,0x08]
; CHECK-NEXT: cmovnel %edx, %eax # encoding: [0x0f,0x45,0xc2]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%and = and i32 %mask, 8
Expand All @@ -286,9 +286,9 @@ entry:
define i32 @test14(i32 %mask, i32 %base, i32 %intra) {
; CHECK-LABEL: test14:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: shrl $7, %edi # encoding: [0xc1,0xef,0x07]
; CHECK-NEXT: cmovnsl %edx, %esi # encoding: [0x0f,0x49,0xf2]
; CHECK-NEXT: movl %esi, %eax # encoding: [0x89,0xf0]
; CHECK-NEXT: shrl $7, %edi # encoding: [0xc1,0xef,0x07]
; CHECK-NEXT: cmovnsl %edx, %eax # encoding: [0x0f,0x49,0xc2]
; CHECK-NEXT: retq # encoding: [0xc3]
entry:
%s = lshr i32 %mask, 7
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/cmpxchg-clobber-flags.ll
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ define i32 @test_control_flow(i32* %p, i32 %i, i32 %j) nounwind {
;
; 64-ALL-LABEL: test_control_flow:
; 64-ALL: # %bb.0: # %entry
; 64-ALL-NEXT: movl %esi, %eax
; 64-ALL-NEXT: cmpl %edx, %esi
; 64-ALL-NEXT: jle .LBB1_5
; 64-ALL-NEXT: .p2align 4, 0x90
Expand All @@ -171,9 +172,8 @@ define i32 @test_control_flow(i32* %p, i32 %i, i32 %j) nounwind {
; 64-ALL-NEXT: lock cmpxchgl %eax, (%rdi)
; 64-ALL-NEXT: jne .LBB1_1
; 64-ALL-NEXT: # %bb.4:
; 64-ALL-NEXT: xorl %esi, %esi
; 64-ALL-NEXT: xorl %eax, %eax
; 64-ALL-NEXT: .LBB1_5: # %cond.end
; 64-ALL-NEXT: movl %esi, %eax
; 64-ALL-NEXT: retq
entry:
%cmp = icmp sgt i32 %i, %j
Expand Down
22 changes: 9 additions & 13 deletions llvm/test/CodeGen/X86/cmpxchg-i128-i1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ define i1 @try_cmpxchg(i128* %addr, i128 %desired, i128 %new) {
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbx, -16
; CHECK-NEXT: movq %rcx, %r9
; CHECK-NEXT: movq %rcx, %rbx
; CHECK-NEXT: movq %rsi, %rax
; CHECK-NEXT: movq %r8, %rcx
; CHECK-NEXT: movq %r9, %rbx
; CHECK-NEXT: lock cmpxchg16b (%rdi)
; CHECK-NEXT: sete %al
; CHECK-NEXT: popq %rbx
Expand All @@ -27,10 +26,9 @@ define void @cmpxchg_flow(i128* %addr, i128 %desired, i128 %new) {
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbx, -16
; CHECK-NEXT: movq %rcx, %r9
; CHECK-NEXT: movq %rcx, %rbx
; CHECK-NEXT: movq %rsi, %rax
; CHECK-NEXT: movq %r8, %rcx
; CHECK-NEXT: movq %r9, %rbx
; CHECK-NEXT: lock cmpxchg16b (%rdi)
; CHECK-NEXT: jne .LBB1_2
; CHECK-NEXT: # %bb.1: # %true
Expand Down Expand Up @@ -64,14 +62,13 @@ define i1 @cmpxchg_arithcmp(i128* %addr, i128 %desired, i128 %new) {
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbx, -16
; CHECK-NEXT: movq %rcx, %r9
; CHECK-NEXT: movq %rdx, %r10
; CHECK-NEXT: movq %rcx, %rbx
; CHECK-NEXT: movq %rdx, %r9
; CHECK-NEXT: movq %rsi, %rax
; CHECK-NEXT: movq %r8, %rcx
; CHECK-NEXT: movq %r9, %rbx
; CHECK-NEXT: lock cmpxchg16b (%rdi)
; CHECK-NEXT: cmpq %rsi, %rax
; CHECK-NEXT: sbbq %r10, %rdx
; CHECK-NEXT: sbbq %r9, %rdx
; CHECK-NEXT: setge %al
; CHECK-NEXT: popq %rbx
; CHECK-NEXT: .cfi_def_cfa_offset 8
Expand All @@ -88,15 +85,14 @@ define i128 @cmpxchg_zext(i128* %addr, i128 %desired, i128 %new) {
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbx, -16
; CHECK-NEXT: movq %rcx, %r9
; CHECK-NEXT: xorl %r10d, %r10d
; CHECK-NEXT: movq %rcx, %rbx
; CHECK-NEXT: movq %rsi, %rax
; CHECK-NEXT: xorl %esi, %esi
; CHECK-NEXT: movq %r8, %rcx
; CHECK-NEXT: movq %r9, %rbx
; CHECK-NEXT: lock cmpxchg16b (%rdi)
; CHECK-NEXT: sete %r10b
; CHECK-NEXT: sete %sil
; CHECK-NEXT: xorl %edx, %edx
; CHECK-NEXT: movq %r10, %rax
; CHECK-NEXT: movq %rsi, %rax
; CHECK-NEXT: popq %rbx
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: retq
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/CodeGen/X86/combine-add.ll
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ define <4 x i32> @combine_vec_add_sub1(<4 x i32> %a, <4 x i32> %b) {
define <4 x i32> @combine_vec_add_sub_add0(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
; SSE-LABEL: combine_vec_add_sub_add0:
; SSE: # %bb.0:
; SSE-NEXT: psubd %xmm2, %xmm1
; SSE-NEXT: movdqa %xmm1, %xmm0
; SSE-NEXT: psubd %xmm2, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: combine_vec_add_sub_add0:
Expand All @@ -121,8 +121,8 @@ define <4 x i32> @combine_vec_add_sub_add0(<4 x i32> %a, <4 x i32> %b, <4 x i32>
define <4 x i32> @combine_vec_add_sub_add1(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
; SSE-LABEL: combine_vec_add_sub_add1:
; SSE: # %bb.0:
; SSE-NEXT: psubd %xmm2, %xmm1
; SSE-NEXT: movdqa %xmm1, %xmm0
; SSE-NEXT: psubd %xmm2, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: combine_vec_add_sub_add1:
Expand All @@ -139,8 +139,8 @@ define <4 x i32> @combine_vec_add_sub_add1(<4 x i32> %a, <4 x i32> %b, <4 x i32>
define <4 x i32> @combine_vec_add_sub_add2(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
; SSE-LABEL: combine_vec_add_sub_add2:
; SSE: # %bb.0:
; SSE-NEXT: paddd %xmm2, %xmm1
; SSE-NEXT: movdqa %xmm1, %xmm0
; SSE-NEXT: paddd %xmm2, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: combine_vec_add_sub_add2:
Expand All @@ -157,8 +157,8 @@ define <4 x i32> @combine_vec_add_sub_add2(<4 x i32> %a, <4 x i32> %b, <4 x i32>
define <4 x i32> @combine_vec_add_sub_add3(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
; SSE-LABEL: combine_vec_add_sub_add3:
; SSE: # %bb.0:
; SSE-NEXT: psubd %xmm2, %xmm1
; SSE-NEXT: movdqa %xmm1, %xmm0
; SSE-NEXT: psubd %xmm2, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: combine_vec_add_sub_add3:
Expand Down Expand Up @@ -203,9 +203,9 @@ define <4 x i32> @combine_vec_add_uniquebits(<4 x i32> %a, <4 x i32> %b) {
;
; AVX-LABEL: combine_vec_add_uniquebits:
; AVX: # %bb.0:
; AVX-NEXT: vbroadcastss {{.*}}(%rip), %xmm2
; AVX-NEXT: vbroadcastss {{.*#+}} xmm2 = [61680,61680,61680,61680]
; AVX-NEXT: vandps %xmm2, %xmm0, %xmm0
; AVX-NEXT: vbroadcastss {{.*}}(%rip), %xmm2
; AVX-NEXT: vbroadcastss {{.*#+}} xmm2 = [3855,3855,3855,3855]
; AVX-NEXT: vandps %xmm2, %xmm1, %xmm1
; AVX-NEXT: vorps %xmm1, %xmm0, %xmm0
; AVX-NEXT: retq
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/combine-rotates.ll
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ define <4 x i32> @combine_vec_rot_rot_splat_zero(<4 x i32> %x) {
define i32 @combine_rot_select_zero(i32, i32) {
; CHECK-LABEL: combine_rot_select_zero:
; CHECK: # %bb.0:
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: movl %esi, %ecx
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: roll %cl, %eax
; CHECK-NEXT: testl %esi, %esi
; CHECK-NEXT: cmovel %edi, %eax
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/combine-sdiv.ll
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ define <4 x i32> @combine_vec_sdiv_by_one(<4 x i32> %x) {
define i32 @combine_sdiv_by_negone(i32 %x) {
; CHECK-LABEL: combine_sdiv_by_negone:
; CHECK: # %bb.0:
; CHECK-NEXT: negl %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: negl %eax
; CHECK-NEXT: retq
%1 = sdiv i32 %x, -1
ret i32 %1
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/combine-udiv.ll
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ define <4 x i32> @combine_vec_udiv_by_negone(<4 x i32> %x) {
define i32 @combine_udiv_by_minsigned(i32 %x) {
; CHECK-LABEL: combine_udiv_by_minsigned:
; CHECK: # %bb.0:
; CHECK-NEXT: shrl $31, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: shrl $31, %eax
; CHECK-NEXT: retq
%1 = udiv i32 %x, -2147483648
ret i32 %1
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/combine-urem.ll
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ define <4 x i32> @combine_vec_urem_by_negone(<4 x i32> %x) {
define i32 @combine_urem_by_minsigned(i32 %x) {
; CHECK-LABEL: combine_urem_by_minsigned:
; CHECK: # %bb.0:
; CHECK-NEXT: andl $2147483647, %edi # imm = 0x7FFFFFFF
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
; CHECK-NEXT: retq
%1 = urem i32 %x, -2147483648
ret i32 %1
Expand Down
36 changes: 18 additions & 18 deletions llvm/test/CodeGen/X86/conditional-indecrement.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
define i32 @test1(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test1:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $-1, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $-1, %eax
; CHECK-NEXT: retq
%not.cmp = icmp ne i32 %a, 0
%inc = zext i1 %not.cmp to i32
Expand All @@ -17,9 +17,9 @@ define i32 @test1(i32 %a, i32 %b) nounwind readnone {
define i32 @test1_commute(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test1_commute:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $-1, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $-1, %eax
; CHECK-NEXT: retq
%cmp = icmp ne i32 %a, 0
%inc = zext i1 %cmp to i32
Expand All @@ -30,9 +30,9 @@ define i32 @test1_commute(i32 %a, i32 %b) nounwind readnone {
define i32 @test2(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test2:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $0, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $0, %eax
; CHECK-NEXT: retq
%cmp = icmp eq i32 %a, 0
%inc = zext i1 %cmp to i32
Expand All @@ -43,9 +43,9 @@ define i32 @test2(i32 %a, i32 %b) nounwind readnone {
define i32 @test3(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test3:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $0, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $0, %eax
; CHECK-NEXT: retq
%cmp = icmp eq i32 %a, 0
%inc = zext i1 %cmp to i32
Expand All @@ -56,9 +56,9 @@ define i32 @test3(i32 %a, i32 %b) nounwind readnone {
define i32 @test4(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test4:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $-1, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $-1, %eax
; CHECK-NEXT: retq
%not.cmp = icmp ne i32 %a, 0
%inc = zext i1 %not.cmp to i32
Expand All @@ -69,9 +69,9 @@ define i32 @test4(i32 %a, i32 %b) nounwind readnone {
define i32 @test5(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test5:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $-1, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $-1, %eax
; CHECK-NEXT: retq
%not.cmp = icmp ne i32 %a, 0
%inc = zext i1 %not.cmp to i32
Expand All @@ -82,9 +82,9 @@ define i32 @test5(i32 %a, i32 %b) nounwind readnone {
define i32 @test6(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test6:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $0, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $0, %eax
; CHECK-NEXT: retq
%cmp = icmp eq i32 %a, 0
%inc = zext i1 %cmp to i32
Expand All @@ -95,9 +95,9 @@ define i32 @test6(i32 %a, i32 %b) nounwind readnone {
define i32 @test7(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test7:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $0, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: sbbl $0, %eax
; CHECK-NEXT: retq
%cmp = icmp eq i32 %a, 0
%inc = zext i1 %cmp to i32
Expand All @@ -108,9 +108,9 @@ define i32 @test7(i32 %a, i32 %b) nounwind readnone {
define i32 @test8(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: test8:
; CHECK: # %bb.0:
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $-1, %esi
; CHECK-NEXT: movl %esi, %eax
; CHECK-NEXT: cmpl $1, %edi
; CHECK-NEXT: adcl $-1, %eax
; CHECK-NEXT: retq
%not.cmp = icmp ne i32 %a, 0
%inc = zext i1 %not.cmp to i32
Expand Down
21 changes: 12 additions & 9 deletions llvm/test/CodeGen/X86/dagcombine-select.ll
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ define i32 @sel_constants_shl_constant(i1 %cond) {
define i32 @shl_constant_sel_constants(i1 %cond) {
; CHECK-LABEL: shl_constant_sel_constants:
; CHECK: # %bb.0:
; CHECK-NEXT: andb $1, %dil
; CHECK-NEXT: xorb $3, %dil
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: movl %edi, %ecx
; CHECK-NEXT: andb $1, %cl
; CHECK-NEXT: xorb $3, %cl
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
; CHECK-NEXT: shll %cl, %eax
; CHECK-NEXT: retq
%sel = select i1 %cond, i32 2, i32 3
Expand All @@ -208,10 +209,11 @@ define i32 @shl_constant_sel_constants(i1 %cond) {
define i32 @lshr_constant_sel_constants(i1 %cond) {
; CHECK-LABEL: lshr_constant_sel_constants:
; CHECK: # %bb.0:
; CHECK-NEXT: andb $1, %dil
; CHECK-NEXT: xorb $3, %dil
; CHECK-NEXT: movl $64, %eax
; CHECK-NEXT: movl %edi, %ecx
; CHECK-NEXT: andb $1, %cl
; CHECK-NEXT: xorb $3, %cl
; CHECK-NEXT: movl $64, %eax
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
; CHECK-NEXT: shrl %cl, %eax
; CHECK-NEXT: retq
%sel = select i1 %cond, i32 2, i32 3
Expand All @@ -222,10 +224,11 @@ define i32 @lshr_constant_sel_constants(i1 %cond) {
define i32 @ashr_constant_sel_constants(i1 %cond) {
; CHECK-LABEL: ashr_constant_sel_constants:
; CHECK: # %bb.0:
; CHECK-NEXT: andb $1, %dil
; CHECK-NEXT: xorb $3, %dil
; CHECK-NEXT: movl $128, %eax
; CHECK-NEXT: movl %edi, %ecx
; CHECK-NEXT: andb $1, %cl
; CHECK-NEXT: xorb $3, %cl
; CHECK-NEXT: movl $128, %eax
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
; CHECK-NEXT: shrl %cl, %eax
; CHECK-NEXT: retq
%sel = select i1 %cond, i32 2, i32 3
Expand Down
54 changes: 26 additions & 28 deletions llvm/test/CodeGen/X86/divide-by-constant.ll
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ define i32 @test5(i32 %A) nounwind {
; X32: # %bb.0:
; X32-NEXT: movl $365384439, %eax # imm = 0x15C752F7
; X32-NEXT: mull {{[0-9]+}}(%esp)
; X32-NEXT: shrl $27, %edx
; X32-NEXT: movl %edx, %eax
; X32-NEXT: shrl $27, %eax
; X32-NEXT: retl
;
; X64-LABEL: test5:
Expand Down Expand Up @@ -217,9 +217,9 @@ define i32 @testsize1(i32 %x) minsize nounwind {
;
; X64-LABEL: testsize1:
; X64: # %bb.0: # %entry
; X64-NEXT: movl %edi, %eax
; X64-NEXT: pushq $32
; X64-NEXT: popq %rcx
; X64-NEXT: movl %edi, %eax
; X64-NEXT: cltd
; X64-NEXT: idivl %ecx
; X64-NEXT: retq
Expand All @@ -240,9 +240,9 @@ define i32 @testsize2(i32 %x) minsize nounwind {
;
; X64-LABEL: testsize2:
; X64: # %bb.0: # %entry
; X64-NEXT: movl %edi, %eax
; X64-NEXT: pushq $33
; X64-NEXT: popq %rcx
; X64-NEXT: movl %edi, %eax
; X64-NEXT: cltd
; X64-NEXT: idivl %ecx
; X64-NEXT: retq
Expand All @@ -260,8 +260,8 @@ define i32 @testsize3(i32 %x) minsize nounwind {
;
; X64-LABEL: testsize3:
; X64: # %bb.0: # %entry
; X64-NEXT: shrl $5, %edi
; X64-NEXT: movl %edi, %eax
; X64-NEXT: shrl $5, %eax
; X64-NEXT: retq
entry:
%div = udiv i32 %x, 32
Expand All @@ -280,10 +280,10 @@ define i32 @testsize4(i32 %x) minsize nounwind {
;
; X64-LABEL: testsize4:
; X64: # %bb.0: # %entry
; X64-NEXT: movl %edi, %eax
; X64-NEXT: pushq $33
; X64-NEXT: popq %rcx
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: movl %edi, %eax
; X64-NEXT: divl %ecx
; X64-NEXT: retq
entry:
Expand Down Expand Up @@ -311,38 +311,36 @@ define i64 @PR23590(i64 %x) nounwind {
;
; X64-FAST-LABEL: PR23590:
; X64-FAST: # %bb.0: # %entry
; X64-FAST-NEXT: movq %rdi, %rcx
; X64-FAST-NEXT: movabsq $6120523590596543007, %rdx # imm = 0x54F077C718E7C21F
; X64-FAST-NEXT: movabsq $6120523590596543007, %rcx # imm = 0x54F077C718E7C21F
; X64-FAST-NEXT: movq %rdi, %rax
; X64-FAST-NEXT: mulq %rdx
; X64-FAST-NEXT: mulq %rcx
; X64-FAST-NEXT: shrq $12, %rdx
; X64-FAST-NEXT: imulq $12345, %rdx, %rax # imm = 0x3039
; X64-FAST-NEXT: subq %rax, %rcx
; X64-FAST-NEXT: movabsq $2635249153387078803, %rdx # imm = 0x2492492492492493
; X64-FAST-NEXT: movq %rcx, %rax
; X64-FAST-NEXT: mulq %rdx
; X64-FAST-NEXT: subq %rdx, %rcx
; X64-FAST-NEXT: shrq %rcx
; X64-FAST-NEXT: leaq (%rcx,%rdx), %rax
; X64-FAST-NEXT: subq %rax, %rdi
; X64-FAST-NEXT: movabsq $2635249153387078803, %rcx # imm = 0x2492492492492493
; X64-FAST-NEXT: movq %rdi, %rax
; X64-FAST-NEXT: mulq %rcx
; X64-FAST-NEXT: subq %rdx, %rdi
; X64-FAST-NEXT: shrq %rdi
; X64-FAST-NEXT: leaq (%rdi,%rdx), %rax
; X64-FAST-NEXT: shrq $2, %rax
; X64-FAST-NEXT: retq
;
; X64-SLOW-LABEL: PR23590:
; X64-SLOW: # %bb.0: # %entry
; X64-SLOW-NEXT: movq %rdi, %rcx
; X64-SLOW-NEXT: movabsq $6120523590596543007, %rdx # imm = 0x54F077C718E7C21F
; X64-SLOW-NEXT: movabsq $6120523590596543007, %rcx # imm = 0x54F077C718E7C21F
; X64-SLOW-NEXT: movq %rdi, %rax
; X64-SLOW-NEXT: mulq %rdx
; X64-SLOW-NEXT: mulq %rcx
; X64-SLOW-NEXT: shrq $12, %rdx
; X64-SLOW-NEXT: imulq $12345, %rdx, %rax # imm = 0x3039
; X64-SLOW-NEXT: subq %rax, %rcx
; X64-SLOW-NEXT: imulq $613566757, %rcx, %rax # imm = 0x24924925
; X64-SLOW-NEXT: subq %rax, %rdi
; X64-SLOW-NEXT: imulq $613566757, %rdi, %rax # imm = 0x24924925
; X64-SLOW-NEXT: shrq $32, %rax
; X64-SLOW-NEXT: subl %eax, %ecx
; X64-SLOW-NEXT: shrl %ecx
; X64-SLOW-NEXT: addl %eax, %ecx
; X64-SLOW-NEXT: shrl $2, %ecx
; X64-SLOW-NEXT: movq %rcx, %rax
; X64-SLOW-NEXT: subl %eax, %edi
; X64-SLOW-NEXT: shrl %edi
; X64-SLOW-NEXT: addl %eax, %edi
; X64-SLOW-NEXT: shrl $2, %edi
; X64-SLOW-NEXT: movq %rdi, %rax
; X64-SLOW-NEXT: retq
entry:
%rem = urem i64 %x, 12345
Expand Down Expand Up @@ -390,10 +388,10 @@ define { i64, i32 } @PR38622(i64) nounwind {
; X64-NEXT: shrq $11, %rax
; X64-NEXT: movabsq $4835703278458517, %rcx # imm = 0x112E0BE826D695
; X64-NEXT: mulq %rcx
; X64-NEXT: shrq $9, %rdx
; X64-NEXT: imull $-294967296, %edx, %eax # imm = 0xEE6B2800
; X64-NEXT: subl %eax, %edi
; X64-NEXT: movq %rdx, %rax
; X64-NEXT: shrq $9, %rax
; X64-NEXT: imull $-294967296, %eax, %ecx # imm = 0xEE6B2800
; X64-NEXT: subl %ecx, %edi
; X64-NEXT: movl %edi, %edx
; X64-NEXT: retq
%2 = udiv i64 %0, 4000000000
Expand Down
9 changes: 6 additions & 3 deletions llvm/test/CodeGen/X86/divrem.ll
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ define void @si16(i16 %x, i16 %y, i16* %p, i16* %q) nounwind {
; X64: # %bb.0:
; X64-NEXT: movq %rdx, %r8
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: cwtd
; X64-NEXT: idivw %si
; X64-NEXT: movw %ax, (%r8)
Expand Down Expand Up @@ -131,6 +132,7 @@ define void @si8(i8 %x, i8 %y, i8* %p, i8* %q) nounwind {
; X64-LABEL: si8:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: cbtw
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %esi
Expand Down Expand Up @@ -182,8 +184,8 @@ define void @ui64(i64 %x, i64 %y, i64* %p, i64* %q) nounwind {
; X64-LABEL: ui64:
; X64: # %bb.0:
; X64-NEXT: movq %rdx, %r8
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: divq %rsi
; X64-NEXT: movq %rax, (%r8)
; X64-NEXT: movq %rdx, (%rcx)
Expand Down Expand Up @@ -212,8 +214,8 @@ define void @ui32(i32 %x, i32 %y, i32* %p, i32* %q) nounwind {
; X64-LABEL: ui32:
; X64: # %bb.0:
; X64-NEXT: movq %rdx, %r8
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: movl %edi, %eax
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: divl %esi
; X64-NEXT: movl %eax, (%r8)
; X64-NEXT: movl %edx, (%rcx)
Expand Down Expand Up @@ -242,8 +244,9 @@ define void @ui16(i16 %x, i16 %y, i16* %p, i16* %q) nounwind {
; X64-LABEL: ui16:
; X64: # %bb.0:
; X64-NEXT: movq %rdx, %r8
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: movl %edi, %eax
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: divw %si
; X64-NEXT: movw %ax, (%r8)
; X64-NEXT: movw %dx, (%rcx)
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/CodeGen/X86/divrem8_ext.ll
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ define signext i8 @test_sdivrem_sext_ah(i8 %x, i8 %y) {
; X64-LABEL: test_sdivrem_sext_ah:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: cbtw
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %ecx
Expand All @@ -137,6 +138,7 @@ define signext i8 @test_srem_sext_ah(i8 %x, i8 %y) {
; X64-LABEL: test_srem_sext_ah:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: cbtw
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %eax
Expand All @@ -161,6 +163,7 @@ define i8 @test_srem_noext_ah(i8 %x, i8 %y) {
; X64-LABEL: test_srem_noext_ah:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: cbtw
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %eax
Expand All @@ -186,6 +189,7 @@ define i64 @test_srem_sext64_ah(i8 %x, i8 %y) {
; X64-LABEL: test_srem_sext64_ah:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: cbtw
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %eax
Expand Down
Loading