[PATCH] D145142: [X86] Add test for `~x & x` -> `0` in DAG Lowering; NFC
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 2 00:29:22 PST 2023
goldstein.w.n updated this revision to Diff 501771.
goldstein.w.n added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145142/new/
https://reviews.llvm.org/D145142
Files:
llvm/test/CodeGen/X86/andn-x-x.ll
Index: llvm/test/CodeGen/X86/andn-x-x.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/andn-x-x.ll
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu | FileCheck %s
+
+define <2 x i64> @andnp_xx(<2 x i64> %v0) nounwind {
+; CHECK-LABEL: andnp_xx:
+; CHECK: # %bb.0:
+; CHECK-NEXT: andnps %xmm0, %xmm0
+; CHECK-NEXT: retq
+ %x = xor <2 x i64> %v0, <i64 -1, i64 -1>
+ %y = and <2 x i64> %v0, %x
+ ret <2 x i64> %y
+}
+
+define <2 x i64> @andnp_xx_2(<2 x i64> %v0) nounwind {
+; CHECK-LABEL: andnp_xx_2:
+; CHECK: # %bb.0:
+; CHECK-NEXT: andnps %xmm0, %xmm0
+; CHECK-NEXT: retq
+ %x = xor <2 x i64> %v0, <i64 -1, i64 -1>
+ %y = and <2 x i64> %x, %v0
+ ret <2 x i64> %y
+}
+
+define i64 @andn_xx(i64 %v0) nounwind {
+; CHECK-LABEL: andn_xx:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq %rdi, %rax
+; CHECK-NEXT: notq %rax
+; CHECK-NEXT: andq %rdi, %rax
+; CHECK-NEXT: retq
+ %x = xor i64 %v0, -1
+ %y = and i64 %v0, %x
+ ret i64 %y
+}
+
+define i64 @andn_xx_2(i64 %v0) nounwind {
+; CHECK-LABEL: andn_xx_2:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq %rdi, %rax
+; CHECK-NEXT: notq %rax
+; CHECK-NEXT: andq %rdi, %rax
+; CHECK-NEXT: retq
+ %x = xor i64 %v0, -1
+ %y = and i64 %x, %v0
+ ret i64 %y
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145142.501771.patch
Type: text/x-patch
Size: 1410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230302/3bea33f7/attachment-0001.bin>
More information about the llvm-commits
mailing list