[llvm] 5aa7ad3 - [NFC] Add a new test case in add-and-not.ll
Amaury Séchet via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 7 15:39:01 PDT 2023
Author: Amaury Séchet
Date: 2023-04-07T22:38:54Z
New Revision: 5aa7ad369e0b33986b9931340f6299190ff299b5
URL: https://github.com/llvm/llvm-project/commit/5aa7ad369e0b33986b9931340f6299190ff299b5
DIFF: https://github.com/llvm/llvm-project/commit/5aa7ad369e0b33986b9931340f6299190ff299b5.diff
LOG: [NFC] Add a new test case in add-and-not.ll
Added:
Modified:
llvm/test/CodeGen/X86/add-and-not.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/add-and-not.ll b/llvm/test/CodeGen/X86/add-and-not.ll
index d4dc732ce782c..18f8e6d623828 100644
--- a/llvm/test/CodeGen/X86/add-and-not.ll
+++ b/llvm/test/CodeGen/X86/add-and-not.ll
@@ -307,3 +307,30 @@ define ptr @gep_and_xor_const(ptr %a) {
%p = getelementptr i8, ptr %a, i64 %offset
ret ptr %p
}
+
+define i64 @add_and_xor_const_ext_trunc(i64 %x) {
+; X86-LABEL: add_and_xor_const_ext_trunc:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT: movl %ecx, %eax
+; X86-NEXT: notl %eax
+; X86-NEXT: andl $1, %eax
+; X86-NEXT: addl %ecx, %eax
+; X86-NEXT: adcl $0, %edx
+; X86-NEXT: retl
+;
+; X64-LABEL: add_and_xor_const_ext_trunc:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: notl %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: addq %rdi, %rax
+; X64-NEXT: retq
+ %t = trunc i64 %x to i32
+ %xor = xor i32 %t, -1
+ %and = and i32 %xor, 1
+ %ext = zext i32 %and to i64
+ %add = add i64 %ext, %x
+ ret i64 %add
+}
More information about the llvm-commits
mailing list