-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-globalisel Author: Evgenii Kudriashov (e-kud) ChangesFull diff: https://github.com/llvm/llvm-project/pull/79088.diff 6 Files Affected:
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:
|
RKSimon
approved these changes
Jan 23, 2024
There was a problem hiding this 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.