[PATCH] D89390: [TargetLowering] Update optimization to check for boolean content

Sven van Haastregt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 03:48:29 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1af51f077b00: [TargetLowering] Add test for bit comparison fold (authored by svenvh).

Changed prior to commit:
  https://reviews.llvm.org/D89390?vs=299415&id=299631#toc

Repository:
  rG LLVM Github Monorepo

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.299631.patch
Type: text/x-patch
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201021/28d45442/attachment.bin>


More information about the llvm-commits mailing list