define i32 @shl_constant_sel_constants(i1 %cond) {
; CHECK-LABEL: shl_constant_sel_constants:
; CHECK: # %bb.0:
-; 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: notb %dil
+; CHECK-NEXT: movzbl %dil, %eax
+; CHECK-NEXT: andl $1, %eax
+; CHECK-NEXT: leal 4(,%rax,4), %eax
; CHECK-NEXT: retq
%sel = select i1 %cond, i32 2, i32 3
%bo = shl i32 1, %sel
define i32 @shl_constant_sel_setcc(i32 %a) {
; CHECK-LABEL: shl_constant_sel_setcc:
; CHECK: # %bb.0:
-; 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: xorl %eax, %eax
+; CHECK-NEXT: testb $1, %dil
+; CHECK-NEXT: sete %al
+; CHECK-NEXT: leal 4(,%rax,4), %eax
; CHECK-NEXT: retq
%m = and i32 %a, 1
%cond = icmp ne i32 %m, 0
define i32 @lshr_constant_sel_constants(i1 %cond) {
; CHECK-LABEL: lshr_constant_sel_constants:
; CHECK: # %bb.0:
-; 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: # kill: def $edi killed $edi def $rdi
+; CHECK-NEXT: andl $1, %edi
+; CHECK-NEXT: leal 8(,%rdi,8), %eax
; CHECK-NEXT: retq
%sel = select i1 %cond, i32 2, i32 3
%bo = lshr i32 64, %sel
define i32 @lshr_constant_sel_setcc(i32 %a) {
; CHECK-LABEL: lshr_constant_sel_setcc:
; CHECK: # %bb.0:
-; 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: # kill: def $edi killed $edi def $rdi
+; CHECK-NEXT: andl $1, %edi
+; CHECK-NEXT: leal 8(,%rdi,8), %eax
; CHECK-NEXT: retq
%m = and i32 %a, 1
%cond = icmp ne i32 %m, 0
define i32 @ashr_constant_sel_constants(i1 %cond) {
; CHECK-LABEL: ashr_constant_sel_constants:
; CHECK: # %bb.0:
-; 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: # kill: def $edi killed $edi def $rdi
+; CHECK-NEXT: andl $1, %edi
+; CHECK-NEXT: shll $4, %edi
+; CHECK-NEXT: leal 16(%rdi), %eax
; CHECK-NEXT: retq
%sel = select i1 %cond, i32 2, i32 3
%bo = ashr i32 128, %sel
define i32 @ashr_constant_sel_setcc(i32 %a) {
; CHECK-LABEL: ashr_constant_sel_setcc:
; CHECK: # %bb.0:
-; 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: # kill: def $edi killed $edi def $rdi
+; CHECK-NEXT: andl $1, %edi
+; CHECK-NEXT: shll $4, %edi
+; CHECK-NEXT: leal 16(%rdi), %eax
; CHECK-NEXT: retq
%m = and i32 %a, 1
%cond = icmp ne i32 %m, 0