[llvm] [X86][GlobalISel] Reorganize shift scalar tests (NFC) (PR #68232)

Evgenii Kudriashov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 09:09:49 PDT 2023


https://github.com/e-kud created https://github.com/llvm/llvm-project/pull/68232

Removed duplicated tests from GlobalISel directory

>From b9bf01e0b82702bf29e57078204710e2e0b30046 Mon Sep 17 00:00:00 2001
From: Evgenii Kudriashov <evgenii.kudriashov at intel.com>
Date: Wed, 4 Oct 2023 08:58:50 -0700
Subject: [PATCH] [X86][GlobalISel] Reorganize shift tests (NFC)

Removed duplicated tests from GlobalISel directory
---
 .../CodeGen/X86/GlobalISel/ashr-scalar.ll     | 177 ----
 .../test/CodeGen/X86/GlobalISel/shl-scalar.ll | 171 ----
 llvm/test/CodeGen/X86/fast-isel-shift.ll      | 419 ----------
 llvm/test/CodeGen/X86/isel-shift.ll           | 756 ++++++++++++++++++
 4 files changed, 756 insertions(+), 767 deletions(-)
 delete mode 100644 llvm/test/CodeGen/X86/GlobalISel/ashr-scalar.ll
 delete mode 100644 llvm/test/CodeGen/X86/GlobalISel/shl-scalar.ll
 delete mode 100644 llvm/test/CodeGen/X86/fast-isel-shift.ll
 create mode 100644 llvm/test/CodeGen/X86/isel-shift.ll

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 28a29cc8fb4122b..000000000000000
--- 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 c298ed6d106c7d7..000000000000000
--- 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 34cddfef4dd7c79..000000000000000
--- 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 000000000000000..8a579cf918a2dad
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-shift.ll
@@ -0,0 +1,756 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=COMMON,SDAG
+; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=COMMON,FASTISEL
+; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefixes=COMMON,GISEL
+
+define i8 @shl_i8(i8 %a, i8 %b) {
+; SDAG-LABEL: shl_i8:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    shlb %cl, %al
+; SDAG-NEXT:    ## kill: def $al killed $al killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_i8:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; FASTISEL-NEXT:    shlb %cl, %al
+; FASTISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_i8:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    shlb %cl, %al
+; GISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; GISEL-NEXT:    retq
+  %c = shl i8 %a, %b
+  ret i8 %c
+}
+
+define i16 @shl_i16(i16 %a, i16 %b) {
+; SDAG-LABEL: shl_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    shll %cl, %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cx killed $cx killed $ecx
+; FASTISEL-NEXT:    ## kill: def $cl killed $cx
+; FASTISEL-NEXT:    shlw %cl, %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    shlw %cl, %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = shl i16 %a, %b
+  ret i16 %c
+}
+
+define i32 @shl_i32(i32 %a, i32 %b) {
+; SDAG-LABEL: shl_i32:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    shll %cl, %eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_i32:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cl killed $ecx
+; FASTISEL-NEXT:    shll %cl, %eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_i32:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    shll %cl, %eax
+; GISEL-NEXT:    retq
+  %c = shl i32 %a, %b
+  ret i32 %c
+}
+
+define i64 @shl_i64(i64 %a, i64 %b) {
+; SDAG-LABEL: shl_i64:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movq %rsi, %rcx
+; SDAG-NEXT:    movq %rdi, %rax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $rcx
+; SDAG-NEXT:    shlq %cl, %rax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_i64:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movq %rsi, %rcx
+; FASTISEL-NEXT:    movq %rdi, %rax
+; FASTISEL-NEXT:    ## kill: def $cl killed $rcx
+; FASTISEL-NEXT:    shlq %cl, %rax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_i64:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movq %rdi, %rax
+; GISEL-NEXT:    movq %rsi, %rcx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $rcx
+; GISEL-NEXT:    shlq %cl, %rax
+; GISEL-NEXT:    retq
+  %c = shl i64 %a, %b
+  ret i64 %c
+}
+
+define i8 @lshr_i8(i8 %a, i8 %b) {
+; SDAG-LABEL: lshr_i8:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    shrb %cl, %al
+; SDAG-NEXT:    ## kill: def $al killed $al killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: lshr_i8:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; FASTISEL-NEXT:    shrb %cl, %al
+; FASTISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: lshr_i8:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    shrb %cl, %al
+; GISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; GISEL-NEXT:    retq
+  %c = lshr i8 %a, %b
+  ret i8 %c
+}
+
+define i16 @lshr_i16(i16 %a, i16 %b) {
+; SDAG-LABEL: lshr_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movzwl %di, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    shrl %cl, %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: lshr_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cx killed $cx killed $ecx
+; FASTISEL-NEXT:    ## kill: def $cl killed $cx
+; FASTISEL-NEXT:    shrw %cl, %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: lshr_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    shrw %cl, %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = lshr i16 %a, %b
+  ret i16 %c
+}
+
+define i32 @lshr_i32(i32 %a, i32 %b) {
+; SDAG-LABEL: lshr_i32:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    shrl %cl, %eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: lshr_i32:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cl killed $ecx
+; FASTISEL-NEXT:    shrl %cl, %eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: lshr_i32:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    shrl %cl, %eax
+; GISEL-NEXT:    retq
+  %c = lshr i32 %a, %b
+  ret i32 %c
+}
+
+define i64 @lshr_i64(i64 %a, i64 %b) {
+; SDAG-LABEL: lshr_i64:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movq %rsi, %rcx
+; SDAG-NEXT:    movq %rdi, %rax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $rcx
+; SDAG-NEXT:    shrq %cl, %rax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: lshr_i64:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movq %rsi, %rcx
+; FASTISEL-NEXT:    movq %rdi, %rax
+; FASTISEL-NEXT:    ## kill: def $cl killed $rcx
+; FASTISEL-NEXT:    shrq %cl, %rax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: lshr_i64:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movq %rdi, %rax
+; GISEL-NEXT:    movq %rsi, %rcx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $rcx
+; GISEL-NEXT:    shrq %cl, %rax
+; GISEL-NEXT:    retq
+  %c = lshr i64 %a, %b
+  ret i64 %c
+}
+
+define i8 @ashr_i8(i8 %a, i8 %b) {
+; SDAG-LABEL: ashr_i8:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    sarb %cl, %al
+; SDAG-NEXT:    ## kill: def $al killed $al killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: ashr_i8:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; FASTISEL-NEXT:    sarb %cl, %al
+; FASTISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: ashr_i8:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    sarb %cl, %al
+; GISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; GISEL-NEXT:    retq
+  %c = ashr i8 %a, %b
+  ret i8 %c
+}
+
+define i16 @ashr_i16(i16 %a, i16 %b) {
+; SDAG-LABEL: ashr_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movswl %di, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    sarl %cl, %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: ashr_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cx killed $cx killed $ecx
+; FASTISEL-NEXT:    ## kill: def $cl killed $cx
+; FASTISEL-NEXT:    sarw %cl, %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: ashr_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    sarw %cl, %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = ashr i16 %a, %b
+  ret i16 %c
+}
+
+define i32 @ashr_i32(i32 %a, i32 %b) {
+; SDAG-LABEL: ashr_i32:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %esi, %ecx
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; SDAG-NEXT:    sarl %cl, %eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: ashr_i32:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %esi, %ecx
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    ## kill: def $cl killed $ecx
+; FASTISEL-NEXT:    sarl %cl, %eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: ashr_i32:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    movl %esi, %ecx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $ecx
+; GISEL-NEXT:    sarl %cl, %eax
+; GISEL-NEXT:    retq
+  %c = ashr i32 %a, %b
+  ret i32 %c
+}
+
+define i64 @ashr_i64(i64 %a, i64 %b) {
+; SDAG-LABEL: ashr_i64:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movq %rsi, %rcx
+; SDAG-NEXT:    movq %rdi, %rax
+; SDAG-NEXT:    ## kill: def $cl killed $cl killed $rcx
+; SDAG-NEXT:    sarq %cl, %rax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: ashr_i64:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movq %rsi, %rcx
+; FASTISEL-NEXT:    movq %rdi, %rax
+; FASTISEL-NEXT:    ## kill: def $cl killed $rcx
+; FASTISEL-NEXT:    sarq %cl, %rax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: ashr_i64:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movq %rdi, %rax
+; GISEL-NEXT:    movq %rsi, %rcx
+; GISEL-NEXT:    ## kill: def $cl killed $cl killed $rcx
+; GISEL-NEXT:    sarq %cl, %rax
+; GISEL-NEXT:    retq
+  %c = ashr i64 %a, %b
+  ret i64 %c
+}
+
+define i8 @shl_imm1_i8(i8 %a) {
+; SDAG-LABEL: shl_imm1_i8:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    ## kill: def $edi killed $edi def $rdi
+; SDAG-NEXT:    leal (%rdi,%rdi), %eax
+; SDAG-NEXT:    ## kill: def $al killed $al killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_imm1_i8:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    ## kill: def $edi killed $edi def $rdi
+; FASTISEL-NEXT:    leal (,%rdi,2), %eax
+; FASTISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_imm1_i8:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    ## kill: def $edi killed $edi def $rdi
+; GISEL-NEXT:    leal (%rdi,%rdi), %eax
+; GISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; GISEL-NEXT:    retq
+  %c = shl i8 %a, 1
+  ret i8 %c
+}
+
+define i16 @shl_imm1_i16(i16 %a) {
+; SDAG-LABEL: shl_imm1_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    ## kill: def $edi killed $edi def $rdi
+; SDAG-NEXT:    leal (%rdi,%rdi), %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_imm1_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    ## kill: def $edi killed $edi def $rdi
+; FASTISEL-NEXT:    leal (,%rdi,2), %eax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_imm1_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    ## kill: def $edi killed $edi def $rdi
+; GISEL-NEXT:    leal (%rdi,%rdi), %eax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = shl i16 %a, 1
+  ret i16 %c
+}
+
+define i32 @shl_imm1_i32(i32 %a) {
+; SDAG-LABEL: shl_imm1_i32:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    ## kill: def $edi killed $edi def $rdi
+; SDAG-NEXT:    leal (%rdi,%rdi), %eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_imm1_i32:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    ## kill: def $edi killed $edi def $rdi
+; FASTISEL-NEXT:    leal (,%rdi,2), %eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_imm1_i32:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    ## kill: def $edi killed $edi def $rdi
+; GISEL-NEXT:    leal (%rdi,%rdi), %eax
+; GISEL-NEXT:    retq
+  %c = shl i32 %a, 1
+  ret i32 %c
+}
+
+define i64 @shl_imm1_i64(i64 %a) {
+; SDAG-LABEL: shl_imm1_i64:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    leaq (%rdi,%rdi), %rax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_imm1_i64:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    leaq (,%rdi,2), %rax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_imm1_i64:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    leaq (%rdi,%rdi), %rax
+; GISEL-NEXT:    retq
+  %c = shl i64 %a, 1
+  ret i64 %c
+}
+
+define i8 @lshr_imm1_i8(i8 %a) {
+; COMMON-LABEL: lshr_imm1_i8:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    shrb %al
+; COMMON-NEXT:    ## kill: def $al killed $al killed $eax
+; COMMON-NEXT:    retq
+  %c = lshr i8 %a, 1
+  ret i8 %c
+}
+
+define i16 @lshr_imm1_i16(i16 %a) {
+; SDAG-LABEL: lshr_imm1_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movzwl %di, %eax
+; SDAG-NEXT:    shrl %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: lshr_imm1_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    shrw %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: lshr_imm1_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    shrw %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = lshr i16 %a, 1
+  ret i16 %c
+}
+
+define i32 @lshr_imm1_i32(i32 %a) {
+; COMMON-LABEL: lshr_imm1_i32:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    shrl %eax
+; COMMON-NEXT:    retq
+  %c = lshr i32 %a, 1
+  ret i32 %c
+}
+
+define i64 @lshr_imm1_i64(i64 %a) {
+; COMMON-LABEL: lshr_imm1_i64:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movq %rdi, %rax
+; COMMON-NEXT:    shrq %rax
+; COMMON-NEXT:    retq
+  %c = lshr i64 %a, 1
+  ret i64 %c
+}
+
+define i8 @ashr_imm1_i8(i8 %a) {
+; COMMON-LABEL: ashr_imm1_i8:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    sarb %al
+; COMMON-NEXT:    ## kill: def $al killed $al killed $eax
+; COMMON-NEXT:    retq
+  %c = ashr i8 %a, 1
+  ret i8 %c
+}
+
+define i16 @ashr_imm1_i16(i16 %a) {
+; SDAG-LABEL: ashr_imm1_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movswl %di, %eax
+; SDAG-NEXT:    shrl %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: ashr_imm1_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    sarw %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: ashr_imm1_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    sarw %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = ashr i16 %a, 1
+  ret i16 %c
+}
+
+define i32 @ashr_imm1_i32(i32 %a) {
+; COMMON-LABEL: ashr_imm1_i32:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    sarl %eax
+; COMMON-NEXT:    retq
+  %c = ashr i32 %a, 1
+  ret i32 %c
+}
+
+define i64 @ashr_imm1_i64(i64 %a) {
+; COMMON-LABEL: ashr_imm1_i64:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movq %rdi, %rax
+; COMMON-NEXT:    sarq %rax
+; COMMON-NEXT:    retq
+  %c = ashr i64 %a, 1
+  ret i64 %c
+}
+
+define i8 @shl_imm4_i8(i8 %a) {
+; COMMON-LABEL: shl_imm4_i8:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    shlb $4, %al
+; COMMON-NEXT:    ## kill: def $al killed $al killed $eax
+; COMMON-NEXT:    retq
+  %c = shl i8 %a, 4
+  ret i8 %c
+}
+
+define i16 @shl_imm4_i16(i16 %a) {
+; SDAG-LABEL: shl_imm4_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movl %edi, %eax
+; SDAG-NEXT:    shll $4, %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: shl_imm4_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    shlw $4, %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: shl_imm4_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    shlw $4, %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = shl i16 %a, 4
+  ret i16 %c
+}
+
+define i32 @shl_imm4_i32(i32 %a) {
+; COMMON-LABEL: shl_imm4_i32:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    shll $4, %eax
+; COMMON-NEXT:    retq
+  %c = shl i32 %a, 4
+  ret i32 %c
+}
+
+define i64 @shl_imm4_i64(i64 %a) {
+; COMMON-LABEL: shl_imm4_i64:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movq %rdi, %rax
+; COMMON-NEXT:    shlq $4, %rax
+; COMMON-NEXT:    retq
+  %c = shl i64 %a, 4
+  ret i64 %c
+}
+
+define i8 @lshr_imm4_i8(i8 %a) {
+; COMMON-LABEL: lshr_imm4_i8:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    shrb $4, %al
+; COMMON-NEXT:    ## kill: def $al killed $al killed $eax
+; COMMON-NEXT:    retq
+  %c = lshr i8 %a, 4
+  ret i8 %c
+}
+
+define i16 @lshr_imm4_i16(i16 %a) {
+; SDAG-LABEL: lshr_imm4_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movzwl %di, %eax
+; SDAG-NEXT:    shrl $4, %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: lshr_imm4_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    shrw $4, %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: lshr_imm4_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    shrw $4, %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = lshr i16 %a, 4
+  ret i16 %c
+}
+
+define i32 @lshr_imm4_i32(i32 %a) {
+; COMMON-LABEL: lshr_imm4_i32:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    shrl $4, %eax
+; COMMON-NEXT:    retq
+  %c = lshr i32 %a, 4
+  ret i32 %c
+}
+
+define i64 @lshr_imm4_i64(i64 %a) {
+; COMMON-LABEL: lshr_imm4_i64:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movq %rdi, %rax
+; COMMON-NEXT:    shrq $4, %rax
+; COMMON-NEXT:    retq
+  %c = lshr i64 %a, 4
+  ret i64 %c
+}
+
+define i8 @ashr_imm4_i8(i8 %a) {
+; COMMON-LABEL: ashr_imm4_i8:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    sarb $4, %al
+; COMMON-NEXT:    ## kill: def $al killed $al killed $eax
+; COMMON-NEXT:    retq
+  %c = ashr i8 %a, 4
+  ret i8 %c
+}
+
+define i16 @ashr_imm4_i16(i16 %a) {
+; SDAG-LABEL: ashr_imm4_i16:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    movswl %di, %eax
+; SDAG-NEXT:    shrl $4, %eax
+; SDAG-NEXT:    ## kill: def $ax killed $ax killed $eax
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: ashr_imm4_i16:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    sarw $4, %ax
+; FASTISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: ashr_imm4_i16:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    sarw $4, %ax
+; GISEL-NEXT:    ## kill: def $ax killed $ax killed $eax
+; GISEL-NEXT:    retq
+  %c = ashr i16 %a, 4
+  ret i16 %c
+}
+
+define i32 @ashr_imm4_i32(i32 %a) {
+; COMMON-LABEL: ashr_imm4_i32:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movl %edi, %eax
+; COMMON-NEXT:    sarl $4, %eax
+; COMMON-NEXT:    retq
+  %c = ashr i32 %a, 4
+  ret i32 %c
+}
+
+define i64 @ashr_imm4_i64(i64 %a) {
+; COMMON-LABEL: ashr_imm4_i64:
+; COMMON:       ## %bb.0:
+; COMMON-NEXT:    movq %rdi, %rax
+; COMMON-NEXT:    sarq $4, %rax
+; COMMON-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) {
+; SDAG-LABEL: PR36731:
+; SDAG:       ## %bb.0:
+; SDAG-NEXT:    retq
+;
+; FASTISEL-LABEL: PR36731:
+; FASTISEL:       ## %bb.0:
+; FASTISEL-NEXT:    movl %edi, %eax
+; FASTISEL-NEXT:    movb $255, %cl
+; FASTISEL-NEXT:    shlb %cl, %al
+; FASTISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; FASTISEL-NEXT:    retq
+;
+; GISEL-LABEL: PR36731:
+; GISEL:       ## %bb.0:
+; GISEL-NEXT:    movl %edi, %eax
+; GISEL-NEXT:    shlb $255, %al
+; GISEL-NEXT:    ## kill: def $al killed $al killed $eax
+; GISEL-NEXT:    retq
+  %b = shl i8 %a, -1
+  ret i8 %b
+}



More information about the llvm-commits mailing list