[llvm] r201370 - R600/SI: Add a pattern for i32 anyext

Tom Stellard thomas.stellard at amd.com
Thu Feb 13 15:34:14 PST 2014


Author: tstellar
Date: Thu Feb 13 17:34:13 2014
New Revision: 201370

URL: http://llvm.org/viewvc/llvm-project?rev=201370&view=rev
Log:
R600/SI: Add a pattern for i32 anyext

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

Added:
    llvm/trunk/test/CodeGen/R600/anyext.ll
Modified:
    llvm/trunk/lib/Target/R600/SIInstructions.td

Modified: llvm/trunk/lib/Target/R600/SIInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstructions.td?rev=201370&r1=201369&r2=201370&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIInstructions.td (original)
+++ llvm/trunk/lib/Target/R600/SIInstructions.td Thu Feb 13 17:34:13 2014
@@ -1838,11 +1838,14 @@ def : Pat <
   (V_CNDMASK_B32_e64 (i32 0), (i32 -1), $src0)
 >;
 
-def : Pat <
-  (i32 (zext i1:$src0)),
+class Ext32Pat <SDNode ext> : Pat <
+  (i32 (ext i1:$src0)),
   (V_CNDMASK_B32_e64 (i32 0), (i32 1), $src0)
 >;
 
+def : Ext32Pat <zext>;
+def : Ext32Pat <anyext>;
+
 // 1. Offset as 8bit DWORD immediate
 def : Pat <
   (SIload_constant i128:$sbase, IMM8bitDWORD:$offset),

Added: llvm/trunk/test/CodeGen/R600/anyext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/anyext.ll?rev=201370&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/anyext.ll (added)
+++ llvm/trunk/test/CodeGen/R600/anyext.ll Thu Feb 13 17:34:13 2014
@@ -0,0 +1,14 @@
+; RUN: llc < %s -march=r600 -mcpu=verde -verify-machineinstrs | FileCheck %s
+
+; CHECK-LABEL: @anyext_i1_i32
+; CHECK: V_CNDMASK_B32_e64
+define void @anyext_i1_i32(i32 addrspace(1)* %out, i32 %cond) {
+entry:
+  %0 = icmp eq i32 %cond, 0
+  %1 = zext i1 %0 to i8
+  %2 = xor i8 %1, -1
+  %3 = and i8 %2, 1
+  %4 = zext i8 %3 to i32
+  store i32 %4, i32 addrspace(1)* %out
+  ret void
+}





More information about the llvm-commits mailing list