[llvm] a437347 - [X86][GlobalISel] Remove G_OR/G_AND/G_XOR test duplication (NFC) (#79088)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 07:48:55 PST 2024


Author: Evgenii Kudriashov
Date: 2024-01-26T16:48:51+01:00
New Revision: a437347562e2f0711ca9f5819831946e06e1ac93

URL: https://github.com/llvm/llvm-project/commit/a437347562e2f0711ca9f5819831946e06e1ac93
DIFF: https://github.com/llvm/llvm-project/commit/a437347562e2f0711ca9f5819831946e06e1ac93.diff

LOG: [X86][GlobalISel] Remove G_OR/G_AND/G_XOR test duplication (NFC) (#79088)

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/isel-and.ll
    llvm/test/CodeGen/X86/isel-or.ll
    llvm/test/CodeGen/X86/isel-xor.ll

Removed: 
    llvm/test/CodeGen/X86/GlobalISel/and-scalar.ll
    llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll
    llvm/test/CodeGen/X86/GlobalISel/xor-scalar.ll


################################################################################
diff  --git a/llvm/test/CodeGen/X86/GlobalISel/and-scalar.ll b/llvm/test/CodeGen/X86/GlobalISel/and-scalar.ll
deleted file mode 100644
index 88a7563612e231..00000000000000
--- a/llvm/test/CodeGen/X86/GlobalISel/and-scalar.ll
+++ /dev/null
@@ -1,60 +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=ALL
-
-define i32 @test_and_i1(i32 %arg1, i32 %arg2) {
-; ALL-LABEL: test_and_i1:
-; ALL:       # %bb.0:
-; ALL-NEXT:    cmpl %esi, %edi
-; ALL-NEXT:    sete %al
-; ALL-NEXT:    andb %al, %al
-; ALL-NEXT:    movzbl %al, %eax
-; ALL-NEXT:    andl $1, %eax
-; ALL-NEXT:    retq
-  %c = icmp eq i32 %arg1, %arg2
-  %x = and i1 %c , %c
-  %ret = zext i1 %x to i32
-  ret i32 %ret
-}
-
-define i8 @test_and_i8(i8 %arg1, i8 %arg2) {
-; ALL-LABEL: test_and_i8:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    andb %dil, %al
-; ALL-NEXT:    # kill: def $al killed $al killed $eax
-; ALL-NEXT:    retq
-  %ret = and i8 %arg1, %arg2
-  ret i8 %ret
-}
-
-define i16 @test_and_i16(i16 %arg1, i16 %arg2) {
-; ALL-LABEL: test_and_i16:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    andw %di, %ax
-; ALL-NEXT:    # kill: def $ax killed $ax killed $eax
-; ALL-NEXT:    retq
-  %ret = and i16 %arg1, %arg2
-  ret i16 %ret
-}
-
-define i32 @test_and_i32(i32 %arg1, i32 %arg2) {
-; ALL-LABEL: test_and_i32:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    andl %edi, %eax
-; ALL-NEXT:    retq
-  %ret = and i32 %arg1, %arg2
-  ret i32 %ret
-}
-
-define i64 @test_and_i64(i64 %arg1, i64 %arg2) {
-; ALL-LABEL: test_and_i64:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movq %rsi, %rax
-; ALL-NEXT:    andq %rdi, %rax
-; ALL-NEXT:    retq
-  %ret = and i64 %arg1, %arg2
-  ret i64 %ret
-}
-

diff  --git a/llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll b/llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll
deleted file mode 100644
index 1edb72ca9b6cfc..00000000000000
--- a/llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll
+++ /dev/null
@@ -1,60 +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=ALL
-
-define i32 @test_or_i1(i32 %arg1, i32 %arg2) {
-; ALL-LABEL: test_or_i1:
-; ALL:       # %bb.0:
-; ALL-NEXT:    cmpl %esi, %edi
-; ALL-NEXT:    sete %al
-; ALL-NEXT:    orb %al, %al
-; ALL-NEXT:    movzbl %al, %eax
-; ALL-NEXT:    andl $1, %eax
-; ALL-NEXT:    retq
-  %c = icmp eq i32 %arg1, %arg2
-  %x = or i1 %c , %c
-  %ret = zext i1 %x to i32
-  ret i32 %ret
-}
-
-define i8 @test_or_i8(i8 %arg1, i8 %arg2) {
-; ALL-LABEL: test_or_i8:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    orb %dil, %al
-; ALL-NEXT:    # kill: def $al killed $al killed $eax
-; ALL-NEXT:    retq
-  %ret = or i8 %arg1, %arg2
-  ret i8 %ret
-}
-
-define i16 @test_or_i16(i16 %arg1, i16 %arg2) {
-; ALL-LABEL: test_or_i16:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    orw %di, %ax
-; ALL-NEXT:    # kill: def $ax killed $ax killed $eax
-; ALL-NEXT:    retq
-  %ret = or i16 %arg1, %arg2
-  ret i16 %ret
-}
-
-define i32 @test_or_i32(i32 %arg1, i32 %arg2) {
-; ALL-LABEL: test_or_i32:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    orl %edi, %eax
-; ALL-NEXT:    retq
-  %ret = or i32 %arg1, %arg2
-  ret i32 %ret
-}
-
-define i64 @test_or_i64(i64 %arg1, i64 %arg2) {
-; ALL-LABEL: test_or_i64:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movq %rsi, %rax
-; ALL-NEXT:    orq %rdi, %rax
-; ALL-NEXT:    retq
-  %ret = or i64 %arg1, %arg2
-  ret i64 %ret
-}
-

diff  --git a/llvm/test/CodeGen/X86/GlobalISel/xor-scalar.ll b/llvm/test/CodeGen/X86/GlobalISel/xor-scalar.ll
deleted file mode 100644
index 5a256d5875fcb6..00000000000000
--- a/llvm/test/CodeGen/X86/GlobalISel/xor-scalar.ll
+++ /dev/null
@@ -1,60 +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=ALL
-
-define i32 @test_xor_i1(i32 %arg1, i32 %arg2) {
-; ALL-LABEL: test_xor_i1:
-; ALL:       # %bb.0:
-; ALL-NEXT:    cmpl %esi, %edi
-; ALL-NEXT:    sete %al
-; ALL-NEXT:    xorb %al, %al
-; ALL-NEXT:    movzbl %al, %eax
-; ALL-NEXT:    andl $1, %eax
-; ALL-NEXT:    retq
-  %c = icmp eq i32 %arg1, %arg2
-  %x = xor i1 %c , %c
-  %ret = zext i1 %x to i32
-  ret i32 %ret
-}
-
-define i8 @test_xor_i8(i8 %arg1, i8 %arg2) {
-; ALL-LABEL: test_xor_i8:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    xorb %dil, %al
-; ALL-NEXT:    # kill: def $al killed $al killed $eax
-; ALL-NEXT:    retq
-  %ret = xor i8 %arg1, %arg2
-  ret i8 %ret
-}
-
-define i16 @test_xor_i16(i16 %arg1, i16 %arg2) {
-; ALL-LABEL: test_xor_i16:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    xorw %di, %ax
-; ALL-NEXT:    # kill: def $ax killed $ax killed $eax
-; ALL-NEXT:    retq
-  %ret = xor i16 %arg1, %arg2
-  ret i16 %ret
-}
-
-define i32 @test_xor_i32(i32 %arg1, i32 %arg2) {
-; ALL-LABEL: test_xor_i32:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    xorl %edi, %eax
-; ALL-NEXT:    retq
-  %ret = xor i32 %arg1, %arg2
-  ret i32 %ret
-}
-
-define i64 @test_xor_i64(i64 %arg1, i64 %arg2) {
-; ALL-LABEL: test_xor_i64:
-; ALL:       # %bb.0:
-; ALL-NEXT:    movq %rsi, %rax
-; ALL-NEXT:    xorq %rdi, %rax
-; ALL-NEXT:    retq
-  %ret = xor i64 %arg1, %arg2
-  ret i64 %ret
-}
-

diff  --git a/llvm/test/CodeGen/X86/isel-and.ll b/llvm/test/CodeGen/X86/isel-and.ll
index 32dbbf6091b707..8db8060a0b9c71 100644
--- a/llvm/test/CodeGen/X86/isel-and.ll
+++ b/llvm/test/CodeGen/X86/isel-and.ll
@@ -6,6 +6,50 @@
 ; 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:

diff  --git a/llvm/test/CodeGen/X86/isel-or.ll b/llvm/test/CodeGen/X86/isel-or.ll
index 43817fb27c756f..ad11e4e5bd3b15 100644
--- a/llvm/test/CodeGen/X86/isel-or.ll
+++ b/llvm/test/CodeGen/X86/isel-or.ll
@@ -6,6 +6,51 @@
 ; 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 @or_i1(i1 %a, i1 %b) {
+; SDAG-X86-LABEL: or_i1:
+; 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_i1:
+; 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_i1:
+; 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_i1:
+; 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_i1:
+; 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_i1:
+; 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 i1 %a, %b
+  ret i1 %c
+}
+
 define i8 @or_i8(i8 %a, i8 %b) {
 ; SDAG-X86-LABEL: or_i8:
 ; SDAG-X86:       # %bb.0:

diff  --git a/llvm/test/CodeGen/X86/isel-xor.ll b/llvm/test/CodeGen/X86/isel-xor.ll
index 72032c2558f78b..979993cb7bdcf4 100644
--- a/llvm/test/CodeGen/X86/isel-xor.ll
+++ b/llvm/test/CodeGen/X86/isel-xor.ll
@@ -6,6 +6,51 @@
 ; 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 @xor_i1(i1 %a, i1 %b) {
+; SDAG-X86-LABEL: xor_i1:
+; 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_i1:
+; 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_i1:
+; 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_i1:
+; 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_i1:
+; 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_i1:
+; 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 i1 %a, %b
+  ret i1 %c
+}
+
 define i8 @xor_i8(i8 %a, i8 %b) {
 ; SDAG-X86-LABEL: xor_i8:
 ; SDAG-X86:       # %bb.0:


        


More information about the llvm-commits mailing list