diff --git a/llvm/test/CodeGen/X86/GlobalISel/ashr-scalar.ll b/llvm/test/CodeGen/X86/GlobalISel/ashr-scalar.ll deleted file mode 100644 index 28a29cc8fb412..0000000000000 --- a/llvm/test/CodeGen/X86/GlobalISel/ashr-scalar.ll +++ /dev/null @@ -1,177 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64 - -define i64 @test_ashr_i64(i64 %arg1, i64 %arg2) { -; X64-LABEL: test_ashr_i64: -; X64: # %bb.0: -; X64-NEXT: movq %rdi, %rax -; X64-NEXT: movq %rsi, %rcx -; X64-NEXT: # kill: def $cl killed $cl killed $rcx -; X64-NEXT: sarq %cl, %rax -; X64-NEXT: retq - %res = ashr i64 %arg1, %arg2 - ret i64 %res -} - -define i64 @test_ashr_i64_imm(i64 %arg1) { -; X64-LABEL: test_ashr_i64_imm: -; X64: # %bb.0: -; X64-NEXT: movq %rdi, %rax -; X64-NEXT: sarq $5, %rax -; X64-NEXT: retq - %res = ashr i64 %arg1, 5 - ret i64 %res -} - -define i64 @test_ashr_i64_imm1(i64 %arg1) { -; X64-LABEL: test_ashr_i64_imm1: -; X64: # %bb.0: -; X64-NEXT: movq %rdi, %rax -; X64-NEXT: sarq %rax -; X64-NEXT: retq - %res = ashr i64 %arg1, 1 - ret i64 %res -} - -define i32 @test_ashr_i32(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_ashr_i32: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-NEXT: sarl %cl, %eax -; X64-NEXT: retq - %res = ashr i32 %arg1, %arg2 - ret i32 %res -} - -define i32 @test_ashr_i32_imm(i32 %arg1) { -; X64-LABEL: test_ashr_i32_imm: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: sarl $5, %eax -; X64-NEXT: retq - %res = ashr i32 %arg1, 5 - ret i32 %res -} - -define i32 @test_ashr_i32_imm1(i32 %arg1) { -; X64-LABEL: test_ashr_i32_imm1: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: sarl %eax -; X64-NEXT: retq - %res = ashr i32 %arg1, 1 - ret i32 %res -} - -define i16 @test_ashr_i16(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_ashr_i16: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-NEXT: sarw %cl, %ax -; X64-NEXT: # kill: def $ax killed $ax killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i16 - %a2 = trunc i32 %arg2 to i16 - %res = ashr i16 %a, %a2 - ret i16 %res -} - -define i16 @test_ashr_i16_imm(i32 %arg1) { -; X64-LABEL: test_ashr_i16_imm: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: sarw $5, %ax -; X64-NEXT: # kill: def $ax killed $ax killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i16 - %res = ashr i16 %a, 5 - ret i16 %res -} - -define i16 @test_ashr_i16_imm1(i32 %arg1) { -; X64-LABEL: test_ashr_i16_imm1: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: sarw %ax -; X64-NEXT: # kill: def $ax killed $ax killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i16 - %res = ashr i16 %a, 1 - ret i16 %res -} - -define i8 @test_ashr_i8(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_ashr_i8: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-NEXT: sarb %cl, %al -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i8 - %a2 = trunc i32 %arg2 to i8 - %res = ashr i8 %a, %a2 - ret i8 %res -} - -define i8 @test_ashr_i8_imm(i32 %arg1) { -; X64-LABEL: test_ashr_i8_imm: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: sarb $5, %al -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i8 - %res = ashr i8 %a, 5 - ret i8 %res -} - -define i8 @test_ashr_i8_imm1(i32 %arg1) { -; X64-LABEL: test_ashr_i8_imm1: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: sarb %al -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i8 - %res = ashr i8 %a, 1 - ret i8 %res -} - -define i1 @test_ashr_i1(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_ashr_i1: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: shlb $7, %al -; X64-NEXT: sarb $7, %al -; X64-NEXT: andb $1, %cl -; X64-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-NEXT: sarb %cl, %al -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i1 - %a2 = trunc i32 %arg2 to i1 - %res = ashr i1 %a, %a2 - ret i1 %res -} - -define i1 @test_ashr_i1_imm1(i32 %arg1) { -; X64-LABEL: test_ashr_i1_imm1: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: shlb $7, %al -; X64-NEXT: sarb $7, %al -; X64-NEXT: movb $1, %cl -; X64-NEXT: sarb %cl, %al -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i1 - %res = ashr i1 %a, 1 - ret i1 %res -} diff --git a/llvm/test/CodeGen/X86/GlobalISel/shl-scalar.ll b/llvm/test/CodeGen/X86/GlobalISel/shl-scalar.ll deleted file mode 100644 index c298ed6d106c7..0000000000000 --- a/llvm/test/CodeGen/X86/GlobalISel/shl-scalar.ll +++ /dev/null @@ -1,171 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64 - -define i64 @test_shl_i64(i64 %arg1, i64 %arg2) { -; X64-LABEL: test_shl_i64: -; X64: # %bb.0: -; X64-NEXT: movq %rdi, %rax -; X64-NEXT: movq %rsi, %rcx -; X64-NEXT: # kill: def $cl killed $cl killed $rcx -; X64-NEXT: shlq %cl, %rax -; X64-NEXT: retq - %res = shl i64 %arg1, %arg2 - ret i64 %res -} - -define i64 @test_shl_i64_imm(i64 %arg1) { -; X64-LABEL: test_shl_i64_imm: -; X64: # %bb.0: -; X64-NEXT: movq %rdi, %rax -; X64-NEXT: shlq $5, %rax -; X64-NEXT: retq - %res = shl i64 %arg1, 5 - ret i64 %res -} - -define i64 @test_shl_i64_imm1(i64 %arg1) { -; X64-LABEL: test_shl_i64_imm1: -; X64: # %bb.0: -; X64-NEXT: leaq (%rdi,%rdi), %rax -; X64-NEXT: retq - %res = shl i64 %arg1, 1 - ret i64 %res -} - -define i32 @test_shl_i32(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_shl_i32: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-NEXT: shll %cl, %eax -; X64-NEXT: retq - %res = shl i32 %arg1, %arg2 - ret i32 %res -} - -define i32 @test_shl_i32_imm(i32 %arg1) { -; X64-LABEL: test_shl_i32_imm: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: shll $5, %eax -; X64-NEXT: retq - %res = shl i32 %arg1, 5 - ret i32 %res -} - -define i32 @test_shl_i32_imm1(i32 %arg1) { -; X64-LABEL: test_shl_i32_imm1: -; X64: # %bb.0: -; X64-NEXT: # kill: def $edi killed $edi def $rdi -; X64-NEXT: leal (%rdi,%rdi), %eax -; X64-NEXT: retq - %res = shl i32 %arg1, 1 - ret i32 %res -} - -define i16 @test_shl_i16(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_shl_i16: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-NEXT: shlw %cl, %ax -; X64-NEXT: # kill: def $ax killed $ax killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i16 - %a2 = trunc i32 %arg2 to i16 - %res = shl i16 %a, %a2 - ret i16 %res -} - -define i16 @test_shl_i16_imm(i32 %arg1) { -; X64-LABEL: test_shl_i16_imm: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: shlw $5, %ax -; X64-NEXT: # kill: def $ax killed $ax killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i16 - %res = shl i16 %a, 5 - ret i16 %res -} - -define i16 @test_shl_i16_imm1(i32 %arg1) { -; X64-LABEL: test_shl_i16_imm1: -; X64: # %bb.0: -; X64-NEXT: # kill: def $edi killed $edi def $rdi -; X64-NEXT: leal (%rdi,%rdi), %eax -; X64-NEXT: # kill: def $ax killed $ax killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i16 - %res = shl i16 %a, 1 - ret i16 %res -} - -define i8 @test_shl_i8(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_shl_i8: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; 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 - %a = trunc i32 %arg1 to i8 - %a2 = trunc i32 %arg2 to i8 - %res = shl i8 %a, %a2 - ret i8 %res -} - -define i8 @test_shl_i8_imm(i32 %arg1) { -; X64-LABEL: test_shl_i8_imm: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: shlb $5, %al -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i8 - %res = shl i8 %a, 5 - ret i8 %res -} - -define i8 @test_shl_i8_imm1(i32 %arg1) { -; X64-LABEL: test_shl_i8_imm1: -; X64: # %bb.0: -; X64-NEXT: # kill: def $edi killed $edi def $rdi -; X64-NEXT: leal (%rdi,%rdi), %eax -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i8 - %res = shl i8 %a, 1 - ret i8 %res -} - -define i1 @test_shl_i1(i32 %arg1, i32 %arg2) { -; X64-LABEL: test_shl_i1: -; X64: # %bb.0: -; X64-NEXT: movl %edi, %eax -; X64-NEXT: movl %esi, %ecx -; X64-NEXT: andb $1, %cl -; 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 - %a = trunc i32 %arg1 to i1 - %a2 = trunc i32 %arg2 to i1 - %res = shl i1 %a, %a2 - ret i1 %res -} - -define i1 @test_shl_i1_imm1(i32 %arg1) { -; X64-LABEL: test_shl_i1_imm1: -; X64: # %bb.0: -; X64-NEXT: # kill: def $edi killed $edi def $rdi -; X64-NEXT: leal (%rdi,%rdi), %eax -; X64-NEXT: # kill: def $al killed $al killed $eax -; X64-NEXT: retq - %a = trunc i32 %arg1 to i1 - %res = shl i1 %a, 1 - ret i1 %res -} diff --git a/llvm/test/CodeGen/X86/fast-isel-shift.ll b/llvm/test/CodeGen/X86/fast-isel-shift.ll deleted file mode 100644 index 34cddfef4dd7c..0000000000000 --- a/llvm/test/CodeGen/X86/fast-isel-shift.ll +++ /dev/null @@ -1,419 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s - -define i8 @shl_i8(i8 %a, i8 %b) { -; CHECK-LABEL: shl_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cl killed $cl killed $ecx -; CHECK-NEXT: shlb %cl, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = shl i8 %a, %b - ret i8 %c -} - -define i16 @shl_i16(i16 %a, i16 %b) { -; CHECK-LABEL: shl_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cx killed $cx killed $ecx -; CHECK-NEXT: ## kill: def $cl killed $cx -; CHECK-NEXT: shlw %cl, %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = shl i16 %a, %b - ret i16 %c -} - -define i32 @shl_i32(i32 %a, i32 %b) { -; CHECK-LABEL: shl_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cl killed $ecx -; CHECK-NEXT: shll %cl, %eax -; CHECK-NEXT: retq - %c = shl i32 %a, %b - ret i32 %c -} - -define i64 @shl_i64(i64 %a, i64 %b) { -; CHECK-LABEL: shl_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rsi, %rcx -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: ## kill: def $cl killed $rcx -; CHECK-NEXT: shlq %cl, %rax -; CHECK-NEXT: retq - %c = shl i64 %a, %b - ret i64 %c -} - -define i8 @lshr_i8(i8 %a, i8 %b) { -; CHECK-LABEL: lshr_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cl killed $cl killed $ecx -; CHECK-NEXT: shrb %cl, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = lshr i8 %a, %b - ret i8 %c -} - -define i16 @lshr_i16(i16 %a, i16 %b) { -; CHECK-LABEL: lshr_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cx killed $cx killed $ecx -; CHECK-NEXT: ## kill: def $cl killed $cx -; CHECK-NEXT: shrw %cl, %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = lshr i16 %a, %b - ret i16 %c -} - -define i32 @lshr_i32(i32 %a, i32 %b) { -; CHECK-LABEL: lshr_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cl killed $ecx -; CHECK-NEXT: shrl %cl, %eax -; CHECK-NEXT: retq - %c = lshr i32 %a, %b - ret i32 %c -} - -define i64 @lshr_i64(i64 %a, i64 %b) { -; CHECK-LABEL: lshr_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rsi, %rcx -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: ## kill: def $cl killed $rcx -; CHECK-NEXT: shrq %cl, %rax -; CHECK-NEXT: retq - %c = lshr i64 %a, %b - ret i64 %c -} - -define i8 @ashr_i8(i8 %a, i8 %b) { -; CHECK-LABEL: ashr_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cl killed $cl killed $ecx -; CHECK-NEXT: sarb %cl, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = ashr i8 %a, %b - ret i8 %c -} - -define i16 @ashr_i16(i16 %a, i16 %b) { -; CHECK-LABEL: ashr_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cx killed $cx killed $ecx -; CHECK-NEXT: ## kill: def $cl killed $cx -; CHECK-NEXT: sarw %cl, %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = ashr i16 %a, %b - ret i16 %c -} - -define i32 @ashr_i32(i32 %a, i32 %b) { -; CHECK-LABEL: ashr_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %esi, %ecx -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: ## kill: def $cl killed $ecx -; CHECK-NEXT: sarl %cl, %eax -; CHECK-NEXT: retq - %c = ashr i32 %a, %b - ret i32 %c -} - -define i64 @ashr_i64(i64 %a, i64 %b) { -; CHECK-LABEL: ashr_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rsi, %rcx -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: ## kill: def $cl killed $rcx -; CHECK-NEXT: sarq %cl, %rax -; CHECK-NEXT: retq - %c = ashr i64 %a, %b - ret i64 %c -} - -define i8 @shl_imm1_i8(i8 %a) { -; CHECK-LABEL: shl_imm1_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi -; CHECK-NEXT: leal (,%rdi,2), %eax -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = shl i8 %a, 1 - ret i8 %c -} - -define i16 @shl_imm1_i16(i16 %a) { -; CHECK-LABEL: shl_imm1_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi -; CHECK-NEXT: leal (,%rdi,2), %eax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = shl i16 %a, 1 - ret i16 %c -} - -define i32 @shl_imm1_i32(i32 %a) { -; CHECK-LABEL: shl_imm1_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: ## kill: def $edi killed $edi def $rdi -; CHECK-NEXT: leal (,%rdi,2), %eax -; CHECK-NEXT: retq - %c = shl i32 %a, 1 - ret i32 %c -} - -define i64 @shl_imm1_i64(i64 %a) { -; CHECK-LABEL: shl_imm1_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: leaq (,%rdi,2), %rax -; CHECK-NEXT: retq - %c = shl i64 %a, 1 - ret i64 %c -} - -define i8 @lshr_imm1_i8(i8 %a) { -; CHECK-LABEL: lshr_imm1_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shrb %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = lshr i8 %a, 1 - ret i8 %c -} - -define i16 @lshr_imm1_i16(i16 %a) { -; CHECK-LABEL: lshr_imm1_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shrw %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = lshr i16 %a, 1 - ret i16 %c -} - -define i32 @lshr_imm1_i32(i32 %a) { -; CHECK-LABEL: lshr_imm1_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shrl %eax -; CHECK-NEXT: retq - %c = lshr i32 %a, 1 - ret i32 %c -} - -define i64 @lshr_imm1_i64(i64 %a) { -; CHECK-LABEL: lshr_imm1_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: shrq %rax -; CHECK-NEXT: retq - %c = lshr i64 %a, 1 - ret i64 %c -} - -define i8 @ashr_imm1_i8(i8 %a) { -; CHECK-LABEL: ashr_imm1_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: sarb %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = ashr i8 %a, 1 - ret i8 %c -} - -define i16 @ashr_imm1_i16(i16 %a) { -; CHECK-LABEL: ashr_imm1_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: sarw %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = ashr i16 %a, 1 - ret i16 %c -} - -define i32 @ashr_imm1_i32(i32 %a) { -; CHECK-LABEL: ashr_imm1_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: sarl %eax -; CHECK-NEXT: retq - %c = ashr i32 %a, 1 - ret i32 %c -} - -define i64 @ashr_imm1_i64(i64 %a) { -; CHECK-LABEL: ashr_imm1_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: sarq %rax -; CHECK-NEXT: retq - %c = ashr i64 %a, 1 - ret i64 %c -} - -define i8 @shl_imm4_i8(i8 %a) { -; CHECK-LABEL: shl_imm4_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shlb $4, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = shl i8 %a, 4 - ret i8 %c -} - -define i16 @shl_imm4_i16(i16 %a) { -; CHECK-LABEL: shl_imm4_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shlw $4, %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = shl i16 %a, 4 - ret i16 %c -} - -define i32 @shl_imm4_i32(i32 %a) { -; CHECK-LABEL: shl_imm4_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shll $4, %eax -; CHECK-NEXT: retq - %c = shl i32 %a, 4 - ret i32 %c -} - -define i64 @shl_imm4_i64(i64 %a) { -; CHECK-LABEL: shl_imm4_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: shlq $4, %rax -; CHECK-NEXT: retq - %c = shl i64 %a, 4 - ret i64 %c -} - -define i8 @lshr_imm4_i8(i8 %a) { -; CHECK-LABEL: lshr_imm4_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shrb $4, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = lshr i8 %a, 4 - ret i8 %c -} - -define i16 @lshr_imm4_i16(i16 %a) { -; CHECK-LABEL: lshr_imm4_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shrw $4, %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = lshr i16 %a, 4 - ret i16 %c -} - -define i32 @lshr_imm4_i32(i32 %a) { -; CHECK-LABEL: lshr_imm4_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: shrl $4, %eax -; CHECK-NEXT: retq - %c = lshr i32 %a, 4 - ret i32 %c -} - -define i64 @lshr_imm4_i64(i64 %a) { -; CHECK-LABEL: lshr_imm4_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: shrq $4, %rax -; CHECK-NEXT: retq - %c = lshr i64 %a, 4 - ret i64 %c -} - -define i8 @ashr_imm4_i8(i8 %a) { -; CHECK-LABEL: ashr_imm4_i8: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: sarb $4, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %c = ashr i8 %a, 4 - ret i8 %c -} - -define i16 @ashr_imm4_i16(i16 %a) { -; CHECK-LABEL: ashr_imm4_i16: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: sarw $4, %ax -; CHECK-NEXT: ## kill: def $ax killed $ax killed $eax -; CHECK-NEXT: retq - %c = ashr i16 %a, 4 - ret i16 %c -} - -define i32 @ashr_imm4_i32(i32 %a) { -; CHECK-LABEL: ashr_imm4_i32: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: sarl $4, %eax -; CHECK-NEXT: retq - %c = ashr i32 %a, 4 - ret i32 %c -} - -define i64 @ashr_imm4_i64(i64 %a) { -; CHECK-LABEL: ashr_imm4_i64: -; CHECK: ## %bb.0: -; CHECK-NEXT: movq %rdi, %rax -; CHECK-NEXT: sarq $4, %rax -; CHECK-NEXT: retq - %c = ashr i64 %a, 4 - ret i64 %c -} - -; Make sure we don't crash on out of bounds i8 shifts. -define i8 @PR36731(i8 %a) { -; CHECK-LABEL: PR36731: -; CHECK: ## %bb.0: -; CHECK-NEXT: movl %edi, %eax -; CHECK-NEXT: movb $255, %cl -; CHECK-NEXT: shlb %cl, %al -; CHECK-NEXT: ## kill: def $al killed $al killed $eax -; CHECK-NEXT: retq - %b = shl i8 %a, -1 - ret i8 %b -} diff --git a/llvm/test/CodeGen/X86/isel-shift.ll b/llvm/test/CodeGen/X86/isel-shift.ll new file mode 100644 index 0000000000000..476dcf04dbaa2 --- /dev/null +++ b/llvm/test/CodeGen/X86/isel-shift.ll @@ -0,0 +1,1241 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=i686-apple-darwin10 | FileCheck %s --check-prefixes=X86,SDAG,SDAG-X86 +; RUN: llc < %s -mtriple=i686-apple-darwin10 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X86,FASTISEL-X86 +; TODO: llc < %s -mtriple=i686-apple-darwin10 -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86 +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=X64,SDAG,SDAG-X64 +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64,FASTISEL-X64 +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X64,GISEL-X64 + +define i8 @shl_i8(i8 %a, i8 %b) { +; X86-LABEL: shl_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shlb %cl, %al +; X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_i8: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: shlb %cl, %al +; SDAG-X64-NEXT: ## kill: def $al killed $al killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_i8: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; FASTISEL-X64-NEXT: shlb %cl, %al +; FASTISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_i8: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: shlb %cl, %al +; GISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; GISEL-X64-NEXT: retq + %c = shl i8 %a, %b + ret i8 %c +} + +define i16 @shl_i16(i16 %a, i16 %b) { +; SDAG-X86-LABEL: shl_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shll %cl, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: ## kill: def $cl killed $cx +; FASTISEL-X86-NEXT: shlw %cl, %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: shll %cl, %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cx killed $cx killed $ecx +; FASTISEL-X64-NEXT: ## kill: def $cl killed $cx +; FASTISEL-X64-NEXT: shlw %cl, %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: shlw %cl, %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = shl i16 %a, %b + ret i16 %c +} + +define i32 @shl_i32(i32 %a, i32 %b) { +; SDAG-X86-LABEL: shl_i32: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shll %cl, %eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_i32: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: ## kill: def $cl killed $ecx +; FASTISEL-X86-NEXT: shll %cl, %eax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_i32: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: shll %cl, %eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_i32: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $ecx +; FASTISEL-X64-NEXT: shll %cl, %eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_i32: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: shll %cl, %eax +; GISEL-X64-NEXT: retq + %c = shl i32 %a, %b + ret i32 %c +} + +define i64 @shl_i64(i64 %a, i64 %b) nounwind { +; SDAG-X86-LABEL: shl_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: pushl %esi +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: movl %esi, %eax +; SDAG-X86-NEXT: shll %cl, %eax +; SDAG-X86-NEXT: shldl %cl, %esi, %edx +; SDAG-X86-NEXT: testb $32, %cl +; SDAG-X86-NEXT: je LBB3_2 +; SDAG-X86-NEXT: ## %bb.1: +; SDAG-X86-NEXT: movl %eax, %edx +; SDAG-X86-NEXT: xorl %eax, %eax +; SDAG-X86-NEXT: LBB3_2: +; SDAG-X86-NEXT: popl %esi +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shldl %cl, %eax, %edx +; FASTISEL-X86-NEXT: shll %cl, %eax +; FASTISEL-X86-NEXT: testb $32, %cl +; FASTISEL-X86-NEXT: je LBB3_2 +; FASTISEL-X86-NEXT: ## %bb.1: +; FASTISEL-X86-NEXT: movl %eax, %edx +; FASTISEL-X86-NEXT: xorl %eax, %eax +; FASTISEL-X86-NEXT: LBB3_2: +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_i64: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movq %rsi, %rcx +; SDAG-X64-NEXT: movq %rdi, %rax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $rcx +; SDAG-X64-NEXT: shlq %cl, %rax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_i64: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movq %rsi, %rcx +; FASTISEL-X64-NEXT: movq %rdi, %rax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $rcx +; FASTISEL-X64-NEXT: shlq %cl, %rax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_i64: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movq %rdi, %rax +; GISEL-X64-NEXT: movq %rsi, %rcx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $rcx +; GISEL-X64-NEXT: shlq %cl, %rax +; GISEL-X64-NEXT: retq + %c = shl i64 %a, %b + ret i64 %c +} + +define i8 @lshr_i8(i8 %a, i8 %b) { +; X86-LABEL: lshr_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shrb %cl, %al +; X86-NEXT: retl +; +; SDAG-X64-LABEL: lshr_i8: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: shrb %cl, %al +; SDAG-X64-NEXT: ## kill: def $al killed $al killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: lshr_i8: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; FASTISEL-X64-NEXT: shrb %cl, %al +; FASTISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: lshr_i8: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: shrb %cl, %al +; GISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; GISEL-X64-NEXT: retq + %c = lshr i8 %a, %b + ret i8 %c +} + +define i16 @lshr_i16(i16 %a, i16 %b) { +; SDAG-X86-LABEL: lshr_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shrl %cl, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: ## kill: def $cl killed $cx +; FASTISEL-X86-NEXT: shrw %cl, %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: lshr_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movzwl %di, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: shrl %cl, %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: lshr_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cx killed $cx killed $ecx +; FASTISEL-X64-NEXT: ## kill: def $cl killed $cx +; FASTISEL-X64-NEXT: shrw %cl, %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: lshr_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: shrw %cl, %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = lshr i16 %a, %b + ret i16 %c +} + +define i32 @lshr_i32(i32 %a, i32 %b) { +; SDAG-X86-LABEL: lshr_i32: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shrl %cl, %eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_i32: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: ## kill: def $cl killed $ecx +; FASTISEL-X86-NEXT: shrl %cl, %eax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: lshr_i32: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: shrl %cl, %eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: lshr_i32: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $ecx +; FASTISEL-X64-NEXT: shrl %cl, %eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: lshr_i32: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: shrl %cl, %eax +; GISEL-X64-NEXT: retq + %c = lshr i32 %a, %b + ret i32 %c +} + +define i64 @lshr_i64(i64 %a, i64 %b) nounwind { +; SDAG-X86-LABEL: lshr_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: pushl %esi +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; SDAG-X86-NEXT: movl %esi, %edx +; SDAG-X86-NEXT: shrl %cl, %edx +; SDAG-X86-NEXT: shrdl %cl, %esi, %eax +; SDAG-X86-NEXT: testb $32, %cl +; SDAG-X86-NEXT: je LBB7_2 +; SDAG-X86-NEXT: ## %bb.1: +; SDAG-X86-NEXT: movl %edx, %eax +; SDAG-X86-NEXT: xorl %edx, %edx +; SDAG-X86-NEXT: LBB7_2: +; SDAG-X86-NEXT: popl %esi +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrdl %cl, %edx, %eax +; FASTISEL-X86-NEXT: shrl %cl, %edx +; FASTISEL-X86-NEXT: testb $32, %cl +; FASTISEL-X86-NEXT: je LBB7_2 +; FASTISEL-X86-NEXT: ## %bb.1: +; FASTISEL-X86-NEXT: movl %edx, %eax +; FASTISEL-X86-NEXT: xorl %edx, %edx +; FASTISEL-X86-NEXT: LBB7_2: +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: lshr_i64: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movq %rsi, %rcx +; SDAG-X64-NEXT: movq %rdi, %rax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $rcx +; SDAG-X64-NEXT: shrq %cl, %rax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: lshr_i64: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movq %rsi, %rcx +; FASTISEL-X64-NEXT: movq %rdi, %rax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $rcx +; FASTISEL-X64-NEXT: shrq %cl, %rax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: lshr_i64: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movq %rdi, %rax +; GISEL-X64-NEXT: movq %rsi, %rcx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $rcx +; GISEL-X64-NEXT: shrq %cl, %rax +; GISEL-X64-NEXT: retq + %c = lshr i64 %a, %b + ret i64 %c +} + +define i8 @ashr_i8(i8 %a, i8 %b) { +; X86-LABEL: ashr_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: sarb %cl, %al +; X86-NEXT: retl +; +; SDAG-X64-LABEL: ashr_i8: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: sarb %cl, %al +; SDAG-X64-NEXT: ## kill: def $al killed $al killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: ashr_i8: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; FASTISEL-X64-NEXT: sarb %cl, %al +; FASTISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: ashr_i8: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: sarb %cl, %al +; GISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; GISEL-X64-NEXT: retq + %c = ashr i8 %a, %b + ret i8 %c +} + +define i16 @ashr_i16(i16 %a, i16 %b) { +; SDAG-X86-LABEL: ashr_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movswl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: sarl %cl, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: ## kill: def $cl killed $cx +; FASTISEL-X86-NEXT: sarw %cl, %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: ashr_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movswl %di, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: sarl %cl, %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: ashr_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cx killed $cx killed $ecx +; FASTISEL-X64-NEXT: ## kill: def $cl killed $cx +; FASTISEL-X64-NEXT: sarw %cl, %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: ashr_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: sarw %cl, %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = ashr i16 %a, %b + ret i16 %c +} + +define i32 @ashr_i32(i32 %a, i32 %b) { +; SDAG-X86-LABEL: ashr_i32: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: sarl %cl, %eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_i32: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: ## kill: def $cl killed $ecx +; FASTISEL-X86-NEXT: sarl %cl, %eax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: ashr_i32: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %esi, %ecx +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; SDAG-X64-NEXT: sarl %cl, %eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: ashr_i32: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %esi, %ecx +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $ecx +; FASTISEL-X64-NEXT: sarl %cl, %eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: ashr_i32: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: movl %esi, %ecx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $ecx +; GISEL-X64-NEXT: sarl %cl, %eax +; GISEL-X64-NEXT: retq + %c = ashr i32 %a, %b + ret i32 %c +} + +define i64 @ashr_i64(i64 %a, i64 %b) nounwind { +; SDAG-X86-LABEL: ashr_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: pushl %esi +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; SDAG-X86-NEXT: movl %esi, %edx +; SDAG-X86-NEXT: sarl %cl, %edx +; SDAG-X86-NEXT: shrdl %cl, %esi, %eax +; SDAG-X86-NEXT: testb $32, %cl +; SDAG-X86-NEXT: je LBB11_2 +; SDAG-X86-NEXT: ## %bb.1: +; SDAG-X86-NEXT: sarl $31, %esi +; SDAG-X86-NEXT: movl %edx, %eax +; SDAG-X86-NEXT: movl %esi, %edx +; SDAG-X86-NEXT: LBB11_2: +; SDAG-X86-NEXT: popl %esi +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: pushl %esi +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrdl %cl, %esi, %eax +; FASTISEL-X86-NEXT: movl %esi, %edx +; FASTISEL-X86-NEXT: sarl %cl, %edx +; FASTISEL-X86-NEXT: testb $32, %cl +; FASTISEL-X86-NEXT: je LBB11_2 +; FASTISEL-X86-NEXT: ## %bb.1: +; FASTISEL-X86-NEXT: sarl $31, %esi +; FASTISEL-X86-NEXT: movl %edx, %eax +; FASTISEL-X86-NEXT: movl %esi, %edx +; FASTISEL-X86-NEXT: LBB11_2: +; FASTISEL-X86-NEXT: popl %esi +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: ashr_i64: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movq %rsi, %rcx +; SDAG-X64-NEXT: movq %rdi, %rax +; SDAG-X64-NEXT: ## kill: def $cl killed $cl killed $rcx +; SDAG-X64-NEXT: sarq %cl, %rax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: ashr_i64: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movq %rsi, %rcx +; FASTISEL-X64-NEXT: movq %rdi, %rax +; FASTISEL-X64-NEXT: ## kill: def $cl killed $rcx +; FASTISEL-X64-NEXT: sarq %cl, %rax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: ashr_i64: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movq %rdi, %rax +; GISEL-X64-NEXT: movq %rsi, %rcx +; GISEL-X64-NEXT: ## kill: def $cl killed $cl killed $rcx +; GISEL-X64-NEXT: sarq %cl, %rax +; GISEL-X64-NEXT: retq + %c = ashr i64 %a, %b + ret i64 %c +} + +define i8 @shl_imm1_i8(i8 %a) { +; SDAG-X86-LABEL: shl_imm1_i8: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: addb %al, %al +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_imm1_i8: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shlb %al +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_imm1_i8: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; SDAG-X64-NEXT: leal (%rdi,%rdi), %eax +; SDAG-X64-NEXT: ## kill: def $al killed $al killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_imm1_i8: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; FASTISEL-X64-NEXT: leal (,%rdi,2), %eax +; FASTISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_imm1_i8: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; GISEL-X64-NEXT: leal (%rdi,%rdi), %eax +; GISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; GISEL-X64-NEXT: retq + %c = shl i8 %a, 1 + ret i8 %c +} + +define i16 @shl_imm1_i16(i16 %a) { +; SDAG-X86-LABEL: shl_imm1_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: addl %eax, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_imm1_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shlw %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_imm1_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; SDAG-X64-NEXT: leal (%rdi,%rdi), %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_imm1_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; FASTISEL-X64-NEXT: leal (,%rdi,2), %eax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_imm1_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; GISEL-X64-NEXT: leal (%rdi,%rdi), %eax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = shl i16 %a, 1 + ret i16 %c +} + +define i32 @shl_imm1_i32(i32 %a) { +; SDAG-X86-LABEL: shl_imm1_i32: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: addl %eax, %eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_imm1_i32: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shll %eax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_imm1_i32: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; SDAG-X64-NEXT: leal (%rdi,%rdi), %eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_imm1_i32: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; FASTISEL-X64-NEXT: leal (,%rdi,2), %eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_imm1_i32: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ## kill: def $edi killed $edi def $rdi +; GISEL-X64-NEXT: leal (%rdi,%rdi), %eax +; GISEL-X64-NEXT: retq + %c = shl i32 %a, 1 + ret i32 %c +} + +define i64 @shl_imm1_i64(i64 %a) { +; SDAG-X86-LABEL: shl_imm1_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: shldl $1, %eax, %edx +; SDAG-X86-NEXT: addl %eax, %eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_imm1_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shldl $1, %eax, %edx +; FASTISEL-X86-NEXT: addl %eax, %eax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_imm1_i64: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: leaq (%rdi,%rdi), %rax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_imm1_i64: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: leaq (,%rdi,2), %rax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_imm1_i64: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: leaq (%rdi,%rdi), %rax +; GISEL-X64-NEXT: retq + %c = shl i64 %a, 1 + ret i64 %c +} + +define i8 @lshr_imm1_i8(i8 %a) { +; X86-LABEL: lshr_imm1_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shrb %al +; X86-NEXT: retl +; +; X64-LABEL: lshr_imm1_i8: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: shrb %al +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq + %c = lshr i8 %a, 1 + ret i8 %c +} + +define i16 @lshr_imm1_i16(i16 %a) { +; SDAG-X86-LABEL: lshr_imm1_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shrl %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_imm1_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrw %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: lshr_imm1_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movzwl %di, %eax +; SDAG-X64-NEXT: shrl %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: lshr_imm1_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: shrw %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: lshr_imm1_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: shrw %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = lshr i16 %a, 1 + ret i16 %c +} + +define i32 @lshr_imm1_i32(i32 %a) { +; X86-LABEL: lshr_imm1_i32: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shrl %eax +; X86-NEXT: retl +; +; X64-LABEL: lshr_imm1_i32: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: shrl %eax +; X64-NEXT: retq + %c = lshr i32 %a, 1 + ret i32 %c +} + +define i64 @lshr_imm1_i64(i64 %a) { +; SDAG-X86-LABEL: lshr_imm1_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: shrdl $1, %edx, %eax +; SDAG-X86-NEXT: shrl %edx +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_imm1_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrdl $1, %edx, %eax +; FASTISEL-X86-NEXT: shrl %edx +; FASTISEL-X86-NEXT: retl +; +; X64-LABEL: lshr_imm1_i64: +; X64: ## %bb.0: +; X64-NEXT: movq %rdi, %rax +; X64-NEXT: shrq %rax +; X64-NEXT: retq + %c = lshr i64 %a, 1 + ret i64 %c +} + +define i8 @ashr_imm1_i8(i8 %a) { +; X86-LABEL: ashr_imm1_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: sarb %al +; X86-NEXT: retl +; +; X64-LABEL: ashr_imm1_i8: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: sarb %al +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq + %c = ashr i8 %a, 1 + ret i8 %c +} + +define i16 @ashr_imm1_i16(i16 %a) { +; SDAG-X86-LABEL: ashr_imm1_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movswl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shrl %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_imm1_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: sarw %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: ashr_imm1_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movswl %di, %eax +; SDAG-X64-NEXT: shrl %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: ashr_imm1_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: sarw %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: ashr_imm1_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: sarw %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = ashr i16 %a, 1 + ret i16 %c +} + +define i32 @ashr_imm1_i32(i32 %a) { +; X86-LABEL: ashr_imm1_i32: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: sarl %eax +; X86-NEXT: retl +; +; X64-LABEL: ashr_imm1_i32: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: sarl %eax +; X64-NEXT: retq + %c = ashr i32 %a, 1 + ret i32 %c +} + +define i64 @ashr_imm1_i64(i64 %a) { +; SDAG-X86-LABEL: ashr_imm1_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: shrdl $1, %edx, %eax +; SDAG-X86-NEXT: sarl %edx +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_imm1_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrdl $1, %edx, %eax +; FASTISEL-X86-NEXT: sarl %edx +; FASTISEL-X86-NEXT: retl +; +; X64-LABEL: ashr_imm1_i64: +; X64: ## %bb.0: +; X64-NEXT: movq %rdi, %rax +; X64-NEXT: sarq %rax +; X64-NEXT: retq + %c = ashr i64 %a, 1 + ret i64 %c +} + +define i8 @shl_imm4_i8(i8 %a) { +; X86-LABEL: shl_imm4_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shlb $4, %al +; X86-NEXT: retl +; +; X64-LABEL: shl_imm4_i8: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: shlb $4, %al +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq + %c = shl i8 %a, 4 + ret i8 %c +} + +define i16 @shl_imm4_i16(i16 %a) { +; SDAG-X86-LABEL: shl_imm4_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shll $4, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_imm4_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shlw $4, %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: shl_imm4_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movl %edi, %eax +; SDAG-X64-NEXT: shll $4, %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: shl_imm4_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: shlw $4, %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: shl_imm4_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: shlw $4, %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = shl i16 %a, 4 + ret i16 %c +} + +define i32 @shl_imm4_i32(i32 %a) { +; X86-LABEL: shl_imm4_i32: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shll $4, %eax +; X86-NEXT: retl +; +; X64-LABEL: shl_imm4_i32: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: shll $4, %eax +; X64-NEXT: retq + %c = shl i32 %a, 4 + ret i32 %c +} + +define i64 @shl_imm4_i64(i64 %a) { +; SDAG-X86-LABEL: shl_imm4_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: shldl $4, %eax, %edx +; SDAG-X86-NEXT: shll $4, %eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: shl_imm4_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shldl $4, %eax, %edx +; FASTISEL-X86-NEXT: shll $4, %eax +; FASTISEL-X86-NEXT: retl +; +; X64-LABEL: shl_imm4_i64: +; X64: ## %bb.0: +; X64-NEXT: movq %rdi, %rax +; X64-NEXT: shlq $4, %rax +; X64-NEXT: retq + %c = shl i64 %a, 4 + ret i64 %c +} + +define i8 @lshr_imm4_i8(i8 %a) { +; X86-LABEL: lshr_imm4_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shrb $4, %al +; X86-NEXT: retl +; +; X64-LABEL: lshr_imm4_i8: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: shrb $4, %al +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq + %c = lshr i8 %a, 4 + ret i8 %c +} + +define i16 @lshr_imm4_i16(i16 %a) { +; SDAG-X86-LABEL: lshr_imm4_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shrl $4, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_imm4_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrw $4, %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: lshr_imm4_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movzwl %di, %eax +; SDAG-X64-NEXT: shrl $4, %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: lshr_imm4_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: shrw $4, %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: lshr_imm4_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: shrw $4, %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = lshr i16 %a, 4 + ret i16 %c +} + +define i32 @lshr_imm4_i32(i32 %a) { +; X86-LABEL: lshr_imm4_i32: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: shrl $4, %eax +; X86-NEXT: retl +; +; X64-LABEL: lshr_imm4_i32: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: shrl $4, %eax +; X64-NEXT: retq + %c = lshr i32 %a, 4 + ret i32 %c +} + +define i64 @lshr_imm4_i64(i64 %a) { +; SDAG-X86-LABEL: lshr_imm4_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: shrdl $4, %edx, %eax +; SDAG-X86-NEXT: shrl $4, %edx +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: lshr_imm4_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrdl $4, %edx, %eax +; FASTISEL-X86-NEXT: shrl $4, %edx +; FASTISEL-X86-NEXT: retl +; +; X64-LABEL: lshr_imm4_i64: +; X64: ## %bb.0: +; X64-NEXT: movq %rdi, %rax +; X64-NEXT: shrq $4, %rax +; X64-NEXT: retq + %c = lshr i64 %a, 4 + ret i64 %c +} + +define i8 @ashr_imm4_i8(i8 %a) { +; X86-LABEL: ashr_imm4_i8: +; X86: ## %bb.0: +; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X86-NEXT: sarb $4, %al +; X86-NEXT: retl +; +; X64-LABEL: ashr_imm4_i8: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: sarb $4, %al +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq + %c = ashr i8 %a, 4 + ret i8 %c +} + +define i16 @ashr_imm4_i16(i16 %a) { +; SDAG-X86-LABEL: ashr_imm4_i16: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movswl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: shrl $4, %eax +; SDAG-X86-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_imm4_i16: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: sarw $4, %ax +; FASTISEL-X86-NEXT: retl +; +; SDAG-X64-LABEL: ashr_imm4_i16: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: movswl %di, %eax +; SDAG-X64-NEXT: shrl $4, %eax +; SDAG-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; SDAG-X64-NEXT: retq +; +; FASTISEL-X64-LABEL: ashr_imm4_i16: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: sarw $4, %ax +; FASTISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: ashr_imm4_i16: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: sarw $4, %ax +; GISEL-X64-NEXT: ## kill: def $ax killed $ax killed $eax +; GISEL-X64-NEXT: retq + %c = ashr i16 %a, 4 + ret i16 %c +} + +define i32 @ashr_imm4_i32(i32 %a) { +; X86-LABEL: ashr_imm4_i32: +; X86: ## %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: sarl $4, %eax +; X86-NEXT: retl +; +; X64-LABEL: ashr_imm4_i32: +; X64: ## %bb.0: +; X64-NEXT: movl %edi, %eax +; X64-NEXT: sarl $4, %eax +; X64-NEXT: retq + %c = ashr i32 %a, 4 + ret i32 %c +} + +define i64 @ashr_imm4_i64(i64 %a) { +; SDAG-X86-LABEL: ashr_imm4_i64: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; SDAG-X86-NEXT: shrdl $4, %edx, %eax +; SDAG-X86-NEXT: sarl $4, %edx +; SDAG-X86-NEXT: retl +; +; FASTISEL-X86-LABEL: ashr_imm4_i64: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: shrdl $4, %edx, %eax +; FASTISEL-X86-NEXT: sarl $4, %edx +; FASTISEL-X86-NEXT: retl +; +; X64-LABEL: ashr_imm4_i64: +; X64: ## %bb.0: +; X64-NEXT: movq %rdi, %rax +; X64-NEXT: sarq $4, %rax +; X64-NEXT: retq + %c = ashr i64 %a, 4 + ret i64 %c +} + +define i8 @PR36731(i8 %a) { +; SDAG-LABEL: PR36731: +; SDAG: ## %bb.0: +; SDAG-NEXT: ret{{[l|q]}} +; +; FASTISEL-X86-LABEL: PR36731: +; FASTISEL-X86: ## %bb.0: +; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; FASTISEL-X86-NEXT: movb $255, %cl +; FASTISEL-X86-NEXT: shlb %cl, %al +; FASTISEL-X86-NEXT: retl +; +; FASTISEL-X64-LABEL: PR36731: +; FASTISEL-X64: ## %bb.0: +; FASTISEL-X64-NEXT: movl %edi, %eax +; FASTISEL-X64-NEXT: movb $255, %cl +; FASTISEL-X64-NEXT: shlb %cl, %al +; FASTISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; FASTISEL-X64-NEXT: retq +; +; GISEL-X64-LABEL: PR36731: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: movl %edi, %eax +; GISEL-X64-NEXT: shlb $255, %al +; GISEL-X64-NEXT: ## kill: def $al killed $al killed $eax +; GISEL-X64-NEXT: retq + %b = shl i8 %a, -1 + ret i8 %b +}