[PATCH] D89390: [TargetLowering] Update optimization to check for boolean content
Erik Hogeman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 10:40:25 PDT 2020
ErikHogeman updated this revision to Diff 299413.
ErikHogeman added a comment.
Adds the test without the patch, to make it explicit what code was generated before.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89390/new/
https://reviews.llvm.org/D89390
Files:
llvm/test/CodeGen/NVPTX/pow2_mask_cmp.ll
Index: llvm/test/CodeGen/NVPTX/pow2_mask_cmp.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/NVPTX/pow2_mask_cmp.ll
@@ -0,0 +1,13 @@
+; RUN: llc -march=nvptx -verify-machineinstrs < %s | FileCheck %s
+
+; Tests the following pattern:
+; (X & 8) != 0 --> (X & 8) >> 3
+
+; CHECK-LABEL: @pow2_mask_cmp
+; CHECK: bfe.u32 {{%r[0-9]+}}, {{%r[0-9]+}}, 3, 1
+define i32 @pow2_mask_cmp(i32 %x) {
+ %a = and i32 %x, 8
+ %cmp = icmp ne i32 %a, 0
+ %r = zext i1 %cmp to i32
+ ret i32 %r
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89390.299413.patch
Type: text/x-patch
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201020/0eb1978f/attachment.bin>
More information about the llvm-commits
mailing list