[clang] [clang-tools-extra] [llvm] [X86][GlobalISel] Remove G_OR/G_AND/G_XOR test duplication (NFC) (PR #79088)

Evgenii Kudriashov via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 17:08:07 PST 2024


https://github.com/e-kud updated https://github.com/llvm/llvm-project/pull/79088

>From 8ba23b70c07f21be03102b2975046ca9a5afb90b Mon Sep 17 00:00:00 2001
From: Evgenii Kudriashov <evgenii.kudriashov at intel.com>
Date: Mon, 22 Jan 2024 18:00:19 -0800
Subject: [PATCH] [X86][GlobalISel] Remove G_OR/G_AND/G_XOR test duplication
 (NFC)

---
 .../test/CodeGen/X86/GlobalISel/and-scalar.ll | 60 -------------------
 llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll | 60 -------------------
 .../test/CodeGen/X86/GlobalISel/xor-scalar.ll | 60 -------------------
 llvm/test/CodeGen/X86/isel-and.ll             | 44 ++++++++++++++
 llvm/test/CodeGen/X86/isel-or.ll              | 45 ++++++++++++++
 llvm/test/CodeGen/X86/isel-xor.ll             | 45 ++++++++++++++
 6 files changed, 134 insertions(+), 180 deletions(-)
 delete mode 100644 llvm/test/CodeGen/X86/GlobalISel/and-scalar.ll
 delete mode 100644 llvm/test/CodeGen/X86/GlobalISel/or-scalar.ll
 delete mode 100644 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 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:



More information about the cfe-commits mailing list