llvm/llvm/test/CodeGen/X86/isel-and.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefixes=X86,SDAG-X86
; RUN: llc < %s -mtriple=i686-- -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X86,FASTISEL-X86
; RUN: llc < %s -mtriple=i686-- -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86
; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefixes=X64,SDAG-X64
; RUN: llc < %s -mtriple=x86_64-- -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64,FASTISEL-X64
; RUN: llc < %s -mtriple=x86_64-- -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X64,GISEL-X64

define i1 @and_i1(i1 %a, i1 %b) {
; SDAG-X86-LABEL: and_i1:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_i1:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_i1:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andb %cl, %al
; GISEL-X86-NEXT:    # kill: def $al killed $al killed $eax
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_i1:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movl %edi, %eax
; SDAG-X64-NEXT:    andl %esi, %eax
; SDAG-X64-NEXT:    # kill: def $al killed $al killed $eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_i1:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movl %edi, %eax
; FASTISEL-X64-NEXT:    andb %sil, %al
; FASTISEL-X64-NEXT:    # kill: def $al killed $al killed $eax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_i1:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movl %esi, %eax
; GISEL-X64-NEXT:    andb %dil, %al
; GISEL-X64-NEXT:    # kill: def $al killed $al killed $eax
; GISEL-X64-NEXT:    retq
  %c = and i1 %a, %b
  ret i1 %c
}
define i8 @and_i8(i8 %a, i8 %b) {
; SDAG-X86-LABEL: and_i8:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_i8:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_i8:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andb %cl, %al
; GISEL-X86-NEXT:    # kill: def $al killed $al killed $eax
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_i8:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movl %edi, %eax
; SDAG-X64-NEXT:    andl %esi, %eax
; SDAG-X64-NEXT:    # kill: def $al killed $al killed $eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_i8:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movl %edi, %eax
; FASTISEL-X64-NEXT:    andb %sil, %al
; FASTISEL-X64-NEXT:    # kill: def $al killed $al killed $eax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_i8:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movl %esi, %eax
; GISEL-X64-NEXT:    andb %dil, %al
; GISEL-X64-NEXT:    # kill: def $al killed $al killed $eax
; GISEL-X64-NEXT:    retq
  %c = and i8 %a, %b
  ret i8 %c
}

define i16 @and_i16(i16 %a, i16 %b) {
; SDAG-X86-LABEL: and_i16:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andw {{[0-9]+}}(%esp), %ax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_i16:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andw {{[0-9]+}}(%esp), %ax
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_i16:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andw %cx, %ax
; GISEL-X86-NEXT:    # kill: def $ax killed $ax killed $eax
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_i16:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movl %edi, %eax
; SDAG-X64-NEXT:    andl %esi, %eax
; SDAG-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_i16:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movl %edi, %eax
; FASTISEL-X64-NEXT:    andw %si, %ax
; FASTISEL-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_i16:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movl %esi, %eax
; GISEL-X64-NEXT:    andw %di, %ax
; GISEL-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; GISEL-X64-NEXT:    retq
  %c = and i16 %a, %b
  ret i16 %c
}

define i32 @and_i32(i32 %a, i32 %b) {
; X86-LABEL: and_i32:
; X86:       # %bb.0:
; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_i32:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movl %edi, %eax
; SDAG-X64-NEXT:    andl %esi, %eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_i32:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movl %edi, %eax
; FASTISEL-X64-NEXT:    andl %esi, %eax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_i32:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movl %esi, %eax
; GISEL-X64-NEXT:    andl %edi, %eax
; GISEL-X64-NEXT:    retq
  %c = and i32 %a, %b
  ret i32 %c
}

define i64 @and_i64(i64 %a, i64 %b) nounwind {
; SDAG-X86-LABEL: and_i64:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %edx
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_i64:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_i64:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; GISEL-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andl {{[0-9]+}}(%esp), %edx
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_i64:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movq %rdi, %rax
; SDAG-X64-NEXT:    andq %rsi, %rax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_i64:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movq %rdi, %rax
; FASTISEL-X64-NEXT:    andq %rsi, %rax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_i64:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movq %rsi, %rax
; GISEL-X64-NEXT:    andq %rdi, %rax
; GISEL-X64-NEXT:    retq
  %c = and i64 %a, %b
  ret i64 %c
}

define i8 @and_imm8_i8(i8 %a) {
; SDAG-X86-LABEL: and_imm8_i8:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andb $1, %al
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm8_i8:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andb $1, %al
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm8_i8:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andb $1, %al
; GISEL-X86-NEXT:    # kill: def $al killed $al killed $eax
; GISEL-X86-NEXT:    retl
;
; X64-LABEL: and_imm8_i8:
; X64:       # %bb.0:
; X64-NEXT:    movl %edi, %eax
; X64-NEXT:    andb $1, %al
; X64-NEXT:    # kill: def $al killed $al killed $eax
; X64-NEXT:    retq
  %c = and i8 %a, 1
  ret i8 %c
}

define i16 @and_imm8_i16(i16 %a) {
; SDAG-X86-LABEL: and_imm8_i16:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andl $6, %eax
; SDAG-X86-NEXT:    # kill: def $ax killed $ax killed $eax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm8_i16:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andw $6, %ax
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm8_i16:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andw $6, %ax
; GISEL-X86-NEXT:    # kill: def $ax killed $ax killed $eax
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_imm8_i16:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movl %edi, %eax
; SDAG-X64-NEXT:    andl $6, %eax
; SDAG-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_imm8_i16:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movl %edi, %eax
; FASTISEL-X64-NEXT:    andw $6, %ax
; FASTISEL-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_imm8_i16:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movl %edi, %eax
; GISEL-X64-NEXT:    andw $6, %ax
; GISEL-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; GISEL-X64-NEXT:    retq
  %c = and i16 %a, 6
  ret i16 %c
}

define i32 @and_imm8_i32(i32 %a) {
; X86-LABEL: and_imm8_i32:
; X86:       # %bb.0:
; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; X86-NEXT:    andl $-5, %eax
; X86-NEXT:    retl
;
; X64-LABEL: and_imm8_i32:
; X64:       # %bb.0:
; X64-NEXT:    movl %edi, %eax
; X64-NEXT:    andl $-5, %eax
; X64-NEXT:    retq
  %c = and i32 %a, -5
  ret i32 %c
}

define i64 @and_imm8_i64(i64 %a) {
; SDAG-X86-LABEL: and_imm8_i64:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andl $1, %eax
; SDAG-X86-NEXT:    xorl %edx, %edx
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm8_i64:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl $1, %eax
; FASTISEL-X86-NEXT:    xorl %edx, %edx
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm8_i64:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; GISEL-X86-NEXT:    andl $1, %eax
; GISEL-X86-NEXT:    andl $0, %edx
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_imm8_i64:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movq %rdi, %rax
; SDAG-X64-NEXT:    andl $1, %eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_imm8_i64:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movq %rdi, %rax
; FASTISEL-X64-NEXT:    andq $1, %rax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_imm8_i64:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movq %rdi, %rax
; GISEL-X64-NEXT:    andq $1, %rax
; GISEL-X64-NEXT:    retq
  %c = and i64 %a, 1
  ret i64 %c
}

define i16 @and_imm16_i16(i16 %a) {
; SDAG-X86-LABEL: and_imm16_i16:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andl $1023, %eax # imm = 0x3FF
; SDAG-X86-NEXT:    # kill: def $ax killed $ax killed $eax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm16_i16:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andw $1023, %ax # imm = 0x3FF
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm16_i16:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andw $1023, %ax # imm = 0x3FF
; GISEL-X86-NEXT:    # kill: def $ax killed $ax killed $eax
; GISEL-X86-NEXT:    retl
;
; SDAG-X64-LABEL: and_imm16_i16:
; SDAG-X64:       # %bb.0:
; SDAG-X64-NEXT:    movl %edi, %eax
; SDAG-X64-NEXT:    andl $1023, %eax # imm = 0x3FF
; SDAG-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; SDAG-X64-NEXT:    retq
;
; FASTISEL-X64-LABEL: and_imm16_i16:
; FASTISEL-X64:       # %bb.0:
; FASTISEL-X64-NEXT:    movl %edi, %eax
; FASTISEL-X64-NEXT:    andw $1023, %ax # imm = 0x3FF
; FASTISEL-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; FASTISEL-X64-NEXT:    retq
;
; GISEL-X64-LABEL: and_imm16_i16:
; GISEL-X64:       # %bb.0:
; GISEL-X64-NEXT:    movl %edi, %eax
; GISEL-X64-NEXT:    andw $1023, %ax # imm = 0x3FF
; GISEL-X64-NEXT:    # kill: def $ax killed $ax killed $eax
; GISEL-X64-NEXT:    retq
  %c = and i16 %a, 1023
  ret i16 %c
}

define i32 @and_imm16_i32(i32 %a) {
; SDAG-X86-LABEL: and_imm16_i32:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl $2044, %eax # imm = 0x7FC
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm16_i32:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl $2044, %eax # imm = 0x7FC
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm16_i32:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andl $2044, %eax # imm = 0x7FC
; GISEL-X86-NEXT:    retl
;
; X64-LABEL: and_imm16_i32:
; X64:       # %bb.0:
; X64-NEXT:    movl %edi, %eax
; X64-NEXT:    andl $2044, %eax # imm = 0x7FC
; X64-NEXT:    retq
  %c = and i32 %a, 2044
  ret i32 %c
}

define i64 @and_imm16_i64(i64 %a) {
; SDAG-X86-LABEL: and_imm16_i64:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; SDAG-X86-NEXT:    movl $-5022, %eax # imm = 0xEC62
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm16_i64:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl $-5022, %eax # imm = 0xEC62
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm16_i64:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; GISEL-X86-NEXT:    andl $-5022, %eax # imm = 0xEC62
; GISEL-X86-NEXT:    andl $-1, %edx
; GISEL-X86-NEXT:    retl
;
; X64-LABEL: and_imm16_i64:
; X64:       # %bb.0:
; X64-NEXT:    movq %rdi, %rax
; X64-NEXT:    andq $-5022, %rax # imm = 0xEC62
; X64-NEXT:    retq
  %c = and i64 %a, -5022
  ret i64 %c
}

define i32 @and_imm32_i32(i32 %a) {
; SDAG-X86-LABEL: and_imm32_i32:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl $85538, %eax # imm = 0x14E22
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm32_i32:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl $85538, %eax # imm = 0x14E22
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm32_i32:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    andl $85538, %eax # imm = 0x14E22
; GISEL-X86-NEXT:    retl
;
; X64-LABEL: and_imm32_i32:
; X64:       # %bb.0:
; X64-NEXT:    movl %edi, %eax
; X64-NEXT:    andl $85538, %eax # imm = 0x14E22
; X64-NEXT:    retq
  %c = and i32 %a, 85538
  ret i32 %c
}

define i64 @and_imm32_i64(i64 %a) {
; SDAG-X86-LABEL: and_imm32_i64:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; SDAG-X86-NEXT:    movl $-125778, %eax # imm = 0xFFFE14AE
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm32_i64:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl $-125778, %eax # imm = 0xFFFE14AE
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm32_i64:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; GISEL-X86-NEXT:    andl $-125778, %eax # imm = 0xFFFE14AE
; GISEL-X86-NEXT:    andl $-1, %edx
; GISEL-X86-NEXT:    retl
;
; X64-LABEL: and_imm32_i64:
; X64:       # %bb.0:
; X64-NEXT:    movq %rdi, %rax
; X64-NEXT:    andq $-125778, %rax # imm = 0xFFFE14AE
; X64-NEXT:    retq
  %c = and i64 %a, -125778
  ret i64 %c
}

define i64 @and_imm64_i64(i64 %a) {
; SDAG-X86-LABEL: and_imm64_i64:
; SDAG-X86:       # %bb.0:
; SDAG-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; SDAG-X86-NEXT:    movl $-1850691612, %eax # imm = 0x91B0AFE4
; SDAG-X86-NEXT:    andl {{[0-9]+}}(%esp), %eax
; SDAG-X86-NEXT:    andl $-2, %edx
; SDAG-X86-NEXT:    retl
;
; FASTISEL-X86-LABEL: and_imm64_i64:
; FASTISEL-X86:       # %bb.0:
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT:    andl $-1850691612, %eax # imm = 0x91B0AFE4
; FASTISEL-X86-NEXT:    andl $-2, %edx
; FASTISEL-X86-NEXT:    retl
;
; GISEL-X86-LABEL: and_imm64_i64:
; GISEL-X86:       # %bb.0:
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
; GISEL-X86-NEXT:    andl $-1850691612, %eax # imm = 0x91B0AFE4
; GISEL-X86-NEXT:    andl $-2, %edx
; GISEL-X86-NEXT:    retl
;
; X64-LABEL: and_imm64_i64:
; X64:       # %bb.0:
; X64-NEXT:    movabsq $-6145658908, %rax # imm = 0xFFFFFFFE91B0AFE4
; X64-NEXT:    andq %rdi, %rax
; X64-NEXT:    retq
  %c = and i64 %a, -6145658908
  ret i64 %c
}