Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

e-kud
Copy link
Contributor

@e-kud e-kud commented Jan 23, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jan 23, 2024

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-llvm-globalisel

Author: Evgenii Kudriashov (e-kud)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/79088.diff

6 Files Affected:

  • (removed) llvm/test/CodeGen/X86/GlobalISel/and-scalar.ll (-60)
  • (removed) llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll (-60)
  • (removed) llvm/test/CodeGen/X86/GlobalISel/xor-scalar.ll (-60)
  • (modified) llvm/test/CodeGen/X86/isel-and.ll (+44)
  • (modified) llvm/test/CodeGen/X86/isel-or.ll (+45)
  • (modified) llvm/test/CodeGen/X86/isel-xor.ll (+45)
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 88a7563612e231d..000000000000000
--- 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 1edb72ca9b6cfcd..000000000000000
--- 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 5a256d5875fcb6e..000000000000000
--- 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 32dbbf6091b707f..8db8060a0b9c713 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 43817fb27c756fa..ad11e4e5bd3b150 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 72032c2558f78b2..979993cb7bdcf44 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:

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the cleanup

@e-kud e-kud merged commit a437347 into llvm:main Jan 26, 2024
@e-kud e-kud deleted the global-andor branch January 26, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants