[llvm] 2df69ed - [X86] Add scalar isel test coverage for AND/OR/XOR types
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 07:13:38 PDT 2023
Author: Simon Pilgrim
Date: 2023-10-24T15:13:17+01:00
New Revision: 2df69ed14c7c64c55c24d3ba3b521741b31c27e1
URL: https://github.com/llvm/llvm-project/commit/2df69ed14c7c64c55c24d3ba3b521741b31c27e1
DIFF: https://github.com/llvm/llvm-project/commit/2df69ed14c7c64c55c24d3ba3b521741b31c27e1.diff
LOG: [X86] Add scalar isel test coverage for AND/OR/XOR types
Even something as simple as bitlogic ops are showing differences between DAG/Fast/Global ISel - promotion, commutation, load/rmw folding etc.
Added:
llvm/test/CodeGen/X86/isel-and.ll
llvm/test/CodeGen/X86/isel-or.ll
llvm/test/CodeGen/X86/isel-xor.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/isel-and.ll b/llvm/test/CodeGen/X86/isel-and.ll
new file mode 100644
index 000000000000000..32dbbf6091b707f
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-and.ll
@@ -0,0 +1,505 @@
+; 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 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
+}
diff --git a/llvm/test/CodeGen/X86/isel-or.ll b/llvm/test/CodeGen/X86/isel-or.ll
new file mode 100644
index 000000000000000..43817fb27c756fa
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-or.ll
@@ -0,0 +1,493 @@
+; 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 i8 @or_i8(i8 %a, i8 %b) {
+; SDAG-X86-LABEL: or_i8:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: orb {{[0-9]+}}(%esp), %al
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_i8:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orb {{[0-9]+}}(%esp), %al
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_i8:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orb %cl, %al
+; GISEL-X86-NEXT: # kill: def $al killed $al killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: or_i8:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: orl %esi, %eax
+; SDAG-X64-NEXT: # kill: def $al killed $al killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: or_i8:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: orb %sil, %al
+; FASTISEL-X64-NEXT: # kill: def $al killed $al killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: or_i8:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %esi, %eax
+; GISEL-X64-NEXT: orb %dil, %al
+; GISEL-X64-NEXT: # kill: def $al killed $al killed $eax
+; GISEL-X64-NEXT: retq
+ %c = or i8 %a, %b
+ ret i8 %c
+}
+
+define i16 @or_i16(i16 %a, i16 %b) {
+; SDAG-X86-LABEL: or_i16:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: orw {{[0-9]+}}(%esp), %ax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_i16:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orw {{[0-9]+}}(%esp), %ax
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_i16:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orw %cx, %ax
+; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: or_i16:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: orl %esi, %eax
+; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: or_i16:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: orw %si, %ax
+; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: or_i16:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %esi, %eax
+; GISEL-X64-NEXT: orw %di, %ax
+; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X64-NEXT: retq
+ %c = or i16 %a, %b
+ ret i16 %c
+}
+
+define i32 @or_i32(i32 %a, i32 %b) {
+; X86-LABEL: or_i32:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: retl
+;
+; SDAG-X64-LABEL: or_i32:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: orl %esi, %eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: or_i32:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: orl %esi, %eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: or_i32:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %esi, %eax
+; GISEL-X64-NEXT: orl %edi, %eax
+; GISEL-X64-NEXT: retq
+ %c = or i32 %a, %b
+ ret i32 %c
+}
+
+define i64 @or_i64(i64 %a, i64 %b) nounwind {
+; SDAG-X86-LABEL: or_i64:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_i64:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_i64:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; GISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %edx
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: or_i64:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movq %rdi, %rax
+; SDAG-X64-NEXT: orq %rsi, %rax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: or_i64:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movq %rdi, %rax
+; FASTISEL-X64-NEXT: orq %rsi, %rax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: or_i64:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movq %rsi, %rax
+; GISEL-X64-NEXT: orq %rdi, %rax
+; GISEL-X64-NEXT: retq
+ %c = or i64 %a, %b
+ ret i64 %c
+}
+
+define i8 @or_imm8_i8(i8 %a) {
+; SDAG-X86-LABEL: or_imm8_i8:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: orb $1, %al
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm8_i8:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orb $1, %al
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_imm8_i8:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orb $1, %al
+; GISEL-X86-NEXT: # kill: def $al killed $al killed $eax
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm8_i8:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: orb $1, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+ %c = or i8 %a, 1
+ ret i8 %c
+}
+
+define i16 @or_imm8_i16(i16 %a) {
+; SDAG-X86-LABEL: or_imm8_i16:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: orl $6, %eax
+; SDAG-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm8_i16:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orw $6, %ax
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_imm8_i16:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orw $6, %ax
+; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: or_imm8_i16:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: orl $6, %eax
+; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: or_imm8_i16:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: orw $6, %ax
+; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: or_imm8_i16:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %edi, %eax
+; GISEL-X64-NEXT: orw $6, %ax
+; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X64-NEXT: retq
+ %c = or i16 %a, 6
+ ret i16 %c
+}
+
+define i32 @or_imm8_i32(i32 %a) {
+; X86-LABEL: or_imm8_i32:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: orl $-5, %eax
+; X86-NEXT: retl
+;
+; X64-LABEL: or_imm8_i32:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: orl $-5, %eax
+; X64-NEXT: retq
+ %c = or i32 %a, -5
+ ret i32 %c
+}
+
+define i64 @or_imm8_i64(i64 %a) {
+; SDAG-X86-LABEL: or_imm8_i64:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; SDAG-X86-NEXT: orl $1, %eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm8_i64:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl $1, %eax
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_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: orl $1, %eax
+; GISEL-X86-NEXT: orl $0, %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm8_i64:
+; X64: # %bb.0:
+; X64-NEXT: movq %rdi, %rax
+; X64-NEXT: orq $1, %rax
+; X64-NEXT: retq
+ %c = or i64 %a, 1
+ ret i64 %c
+}
+
+define i16 @or_imm16_i16(i16 %a) {
+; SDAG-X86-LABEL: or_imm16_i16:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $1023, %eax # imm = 0x3FF
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm16_i16:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orw $1023, %ax # imm = 0x3FF
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_imm16_i16:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orw $1023, %ax # imm = 0x3FF
+; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: or_imm16_i16:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: orl $1023, %eax # imm = 0x3FF
+; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: or_imm16_i16:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: orw $1023, %ax # imm = 0x3FF
+; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: or_imm16_i16:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %edi, %eax
+; GISEL-X64-NEXT: orw $1023, %ax # imm = 0x3FF
+; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X64-NEXT: retq
+ %c = or i16 %a, 1023
+ ret i16 %c
+}
+
+define i32 @or_imm16_i32(i32 %a) {
+; SDAG-X86-LABEL: or_imm16_i32:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $2044, %eax # imm = 0x7FC
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm16_i32:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl $2044, %eax # imm = 0x7FC
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_imm16_i32:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orl $2044, %eax # imm = 0x7FC
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm16_i32:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: orl $2044, %eax # imm = 0x7FC
+; X64-NEXT: retq
+ %c = or i32 %a, 2044
+ ret i32 %c
+}
+
+define i64 @or_imm16_i64(i64 %a) {
+; SDAG-X86-LABEL: or_imm16_i64:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $-5022, %eax # imm = 0xEC62
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: movl $-1, %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm16_i64:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl $-5022, %eax # imm = 0xEC62
+; FASTISEL-X86-NEXT: movl $-1, %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_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: orl $-5022, %eax # imm = 0xEC62
+; GISEL-X86-NEXT: orl $-1, %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm16_i64:
+; X64: # %bb.0:
+; X64-NEXT: movq %rdi, %rax
+; X64-NEXT: orq $-5022, %rax # imm = 0xEC62
+; X64-NEXT: retq
+ %c = or i64 %a, -5022
+ ret i64 %c
+}
+
+define i32 @or_imm32_i32(i32 %a) {
+; SDAG-X86-LABEL: or_imm32_i32:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $85538, %eax # imm = 0x14E22
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm32_i32:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl $85538, %eax # imm = 0x14E22
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_imm32_i32:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: orl $85538, %eax # imm = 0x14E22
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm32_i32:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: orl $85538, %eax # imm = 0x14E22
+; X64-NEXT: retq
+ %c = or i32 %a, 85538
+ ret i32 %c
+}
+
+define i64 @or_imm32_i64(i64 %a) {
+; SDAG-X86-LABEL: or_imm32_i64:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $-125778, %eax # imm = 0xFFFE14AE
+; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: movl $-1, %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_imm32_i64:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: orl $-125778, %eax # imm = 0xFFFE14AE
+; FASTISEL-X86-NEXT: movl $-1, %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_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: orl $-125778, %eax # imm = 0xFFFE14AE
+; GISEL-X86-NEXT: orl $-1, %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm32_i64:
+; X64: # %bb.0:
+; X64-NEXT: movq %rdi, %rax
+; X64-NEXT: orq $-125778, %rax # imm = 0xFFFE14AE
+; X64-NEXT: retq
+ %c = or i64 %a, -125778
+ ret i64 %c
+}
+
+define i64 @or_imm64_i64(i64 %a) {
+; SDAG-X86-LABEL: or_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: orl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: orl $-2, %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: or_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: orl $-1850691612, %eax # imm = 0x91B0AFE4
+; FASTISEL-X86-NEXT: orl $-2, %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: or_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: orl $-1850691612, %eax # imm = 0x91B0AFE4
+; GISEL-X86-NEXT: orl $-2, %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: or_imm64_i64:
+; X64: # %bb.0:
+; X64-NEXT: movabsq $-6145658908, %rax # imm = 0xFFFFFFFE91B0AFE4
+; X64-NEXT: orq %rdi, %rax
+; X64-NEXT: retq
+ %c = or i64 %a, -6145658908
+ ret i64 %c
+}
diff --git a/llvm/test/CodeGen/X86/isel-xor.ll b/llvm/test/CodeGen/X86/isel-xor.ll
new file mode 100644
index 000000000000000..72032c2558f78b2
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-xor.ll
@@ -0,0 +1,497 @@
+; 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 i8 @xor_i8(i8 %a, i8 %b) {
+; SDAG-X86-LABEL: xor_i8:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: xorb {{[0-9]+}}(%esp), %al
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_i8:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorb {{[0-9]+}}(%esp), %al
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_i8:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorb %cl, %al
+; GISEL-X86-NEXT: # kill: def $al killed $al killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: xor_i8:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: xorl %esi, %eax
+; SDAG-X64-NEXT: # kill: def $al killed $al killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: xor_i8:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: xorb %sil, %al
+; FASTISEL-X64-NEXT: # kill: def $al killed $al killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: xor_i8:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %esi, %eax
+; GISEL-X64-NEXT: xorb %dil, %al
+; GISEL-X64-NEXT: # kill: def $al killed $al killed $eax
+; GISEL-X64-NEXT: retq
+ %c = xor i8 %a, %b
+ ret i8 %c
+}
+
+define i16 @xor_i16(i16 %a, i16 %b) {
+; SDAG-X86-LABEL: xor_i16:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: xorw {{[0-9]+}}(%esp), %ax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_i16:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorw {{[0-9]+}}(%esp), %ax
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_i16:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorw %cx, %ax
+; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: xor_i16:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: xorl %esi, %eax
+; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: xor_i16:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: xorw %si, %ax
+; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: xor_i16:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %esi, %eax
+; GISEL-X64-NEXT: xorw %di, %ax
+; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X64-NEXT: retq
+ %c = xor i16 %a, %b
+ ret i16 %c
+}
+
+define i32 @xor_i32(i32 %a, i32 %b) {
+; X86-LABEL: xor_i32:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: retl
+;
+; SDAG-X64-LABEL: xor_i32:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: xorl %esi, %eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: xor_i32:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: xorl %esi, %eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: xor_i32:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %esi, %eax
+; GISEL-X64-NEXT: xorl %edi, %eax
+; GISEL-X64-NEXT: retq
+ %c = xor i32 %a, %b
+ ret i32 %c
+}
+
+define i64 @xor_i64(i64 %a, i64 %b) nounwind {
+; SDAG-X86-LABEL: xor_i64:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; SDAG-X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_i64:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_i64:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; GISEL-X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: xor_i64:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movq %rdi, %rax
+; SDAG-X64-NEXT: xorq %rsi, %rax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: xor_i64:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movq %rdi, %rax
+; FASTISEL-X64-NEXT: xorq %rsi, %rax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: xor_i64:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movq %rsi, %rax
+; GISEL-X64-NEXT: xorq %rdi, %rax
+; GISEL-X64-NEXT: retq
+ %c = xor i64 %a, %b
+ ret i64 %c
+}
+
+define i8 @xor_imm8_i8(i8 %a) {
+; SDAG-X86-LABEL: xor_imm8_i8:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: xorb $1, %al
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_imm8_i8:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorb $1, %al
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_imm8_i8:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorb $1, %al
+; GISEL-X86-NEXT: # kill: def $al killed $al killed $eax
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm8_i8:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: xorb $1, %al
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+ %c = xor i8 %a, 1
+ ret i8 %c
+}
+
+define i16 @xor_imm8_i16(i16 %a) {
+; SDAG-X86-LABEL: xor_imm8_i16:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: xorl $6, %eax
+; SDAG-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_imm8_i16:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorw $6, %ax
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_imm8_i16:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorw $6, %ax
+; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: xor_imm8_i16:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: xorl $6, %eax
+; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: xor_imm8_i16:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: xorw $6, %ax
+; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: xor_imm8_i16:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %edi, %eax
+; GISEL-X64-NEXT: xorw $6, %ax
+; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X64-NEXT: retq
+ %c = xor i16 %a, 6
+ ret i16 %c
+}
+
+define i32 @xor_imm8_i32(i32 %a) {
+; X86-LABEL: xor_imm8_i32:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: xorl $-5, %eax
+; X86-NEXT: retl
+;
+; X64-LABEL: xor_imm8_i32:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: xorl $-5, %eax
+; X64-NEXT: retq
+ %c = xor i32 %a, -5
+ ret i32 %c
+}
+
+define i64 @xor_imm8_i64(i64 %a) {
+; SDAG-X86-LABEL: xor_imm8_i64:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; SDAG-X86-NEXT: xorl $1, %eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_imm8_i64:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorl $1, %eax
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_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: xorl $1, %eax
+; GISEL-X86-NEXT: xorl $0, %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm8_i64:
+; X64: # %bb.0:
+; X64-NEXT: movq %rdi, %rax
+; X64-NEXT: xorq $1, %rax
+; X64-NEXT: retq
+ %c = xor i64 %a, 1
+ ret i64 %c
+}
+
+define i16 @xor_imm16_i16(i16 %a) {
+; SDAG-X86-LABEL: xor_imm16_i16:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $1023, %eax # imm = 0x3FF
+; SDAG-X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_imm16_i16:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorw $1023, %ax # imm = 0x3FF
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_imm16_i16:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorw $1023, %ax # imm = 0x3FF
+; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X86-NEXT: retl
+;
+; SDAG-X64-LABEL: xor_imm16_i16:
+; SDAG-X64: # %bb.0:
+; SDAG-X64-NEXT: movl %edi, %eax
+; SDAG-X64-NEXT: xorl $1023, %eax # imm = 0x3FF
+; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; SDAG-X64-NEXT: retq
+;
+; FASTISEL-X64-LABEL: xor_imm16_i16:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: movl %edi, %eax
+; FASTISEL-X64-NEXT: xorw $1023, %ax # imm = 0x3FF
+; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; FASTISEL-X64-NEXT: retq
+;
+; GISEL-X64-LABEL: xor_imm16_i16:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: movl %edi, %eax
+; GISEL-X64-NEXT: xorw $1023, %ax # imm = 0x3FF
+; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
+; GISEL-X64-NEXT: retq
+ %c = xor i16 %a, 1023
+ ret i16 %c
+}
+
+define i32 @xor_imm16_i32(i32 %a) {
+; SDAG-X86-LABEL: xor_imm16_i32:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $2044, %eax # imm = 0x7FC
+; SDAG-X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_imm16_i32:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorl $2044, %eax # imm = 0x7FC
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_imm16_i32:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorl $2044, %eax # imm = 0x7FC
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm16_i32:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: xorl $2044, %eax # imm = 0x7FC
+; X64-NEXT: retq
+ %c = xor i32 %a, 2044
+ ret i32 %c
+}
+
+define i64 @xor_imm16_i64(i64 %a) {
+; SDAG-X86-LABEL: xor_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: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: notl %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_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: xorl $-5022, %eax # imm = 0xEC62
+; FASTISEL-X86-NEXT: notl %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_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: xorl $-5022, %eax # imm = 0xEC62
+; GISEL-X86-NEXT: notl %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm16_i64:
+; X64: # %bb.0:
+; X64-NEXT: movq %rdi, %rax
+; X64-NEXT: xorq $-5022, %rax # imm = 0xEC62
+; X64-NEXT: retq
+ %c = xor i64 %a, -5022
+ ret i64 %c
+}
+
+define i32 @xor_imm32_i32(i32 %a) {
+; SDAG-X86-LABEL: xor_imm32_i32:
+; SDAG-X86: # %bb.0:
+; SDAG-X86-NEXT: movl $85538, %eax # imm = 0x14E22
+; SDAG-X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_imm32_i32:
+; FASTISEL-X86: # %bb.0:
+; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; FASTISEL-X86-NEXT: xorl $85538, %eax # imm = 0x14E22
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_imm32_i32:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: xorl $85538, %eax # imm = 0x14E22
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm32_i32:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: xorl $85538, %eax # imm = 0x14E22
+; X64-NEXT: retq
+ %c = xor i32 %a, 85538
+ ret i32 %c
+}
+
+define i64 @xor_imm32_i64(i64 %a) {
+; SDAG-X86-LABEL: xor_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: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: notl %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_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: xorl $-125778, %eax # imm = 0xFFFE14AE
+; FASTISEL-X86-NEXT: notl %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_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: xorl $-125778, %eax # imm = 0xFFFE14AE
+; GISEL-X86-NEXT: notl %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm32_i64:
+; X64: # %bb.0:
+; X64-NEXT: movq %rdi, %rax
+; X64-NEXT: xorq $-125778, %rax # imm = 0xFFFE14AE
+; X64-NEXT: retq
+ %c = xor i64 %a, -125778
+ ret i64 %c
+}
+
+define i64 @xor_imm64_i64(i64 %a) {
+; SDAG-X86-LABEL: xor_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: xorl {{[0-9]+}}(%esp), %eax
+; SDAG-X86-NEXT: xorl $-2, %edx
+; SDAG-X86-NEXT: retl
+;
+; FASTISEL-X86-LABEL: xor_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: xorl $-1850691612, %eax # imm = 0x91B0AFE4
+; FASTISEL-X86-NEXT: xorl $-2, %edx
+; FASTISEL-X86-NEXT: retl
+;
+; GISEL-X86-LABEL: xor_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: xorl $-1850691612, %eax # imm = 0x91B0AFE4
+; GISEL-X86-NEXT: xorl $-2, %edx
+; GISEL-X86-NEXT: retl
+;
+; X64-LABEL: xor_imm64_i64:
+; X64: # %bb.0:
+; X64-NEXT: movabsq $-6145658908, %rax # imm = 0xFFFFFFFE91B0AFE4
+; X64-NEXT: xorq %rdi, %rax
+; X64-NEXT: retq
+ %c = xor i64 %a, -6145658908
+ ret i64 %c
+}
More information about the llvm-commits
mailing list