[llvm] r222662 - [Hexagon] Adding zxth instruction.

Colin LeMahieu colinl at codeaurora.org
Mon Nov 24 09:11:34 PST 2014


Author: colinl
Date: Mon Nov 24 11:11:34 2014
New Revision: 222662

URL: http://llvm.org/viewvc/llvm-project?rev=222662&view=rev
Log:
[Hexagon] Adding zxth instruction.

Added:
    llvm/trunk/test/MC/Hexagon/inst_zxth.ll
Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp?rev=222662&r1=222661&r2=222662&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp Mon Nov 24 11:11:34 2014
@@ -718,7 +718,7 @@ bool HexagonInstrInfo::isPredicable(Mach
   case Hexagon::A2_sxtb:
   case Hexagon::A2_sxth:
   case Hexagon::A2_zxtb:
-  case Hexagon::ZXTH:
+  case Hexagon::A2_zxth:
     return Subtarget.hasV4TOps();
   }
 
@@ -1327,6 +1327,10 @@ bool HexagonInstrInfo::isConditionalALU3
     case Hexagon::A4_pzxtbfnew:
     case Hexagon::A4_pzxtbt:
     case Hexagon::A4_pzxtbtnew:
+    case Hexagon::A4_pzxthf:
+    case Hexagon::A4_pzxthfnew:
+    case Hexagon::A4_pzxtht:
+    case Hexagon::A4_pzxthtnew:
     case Hexagon::ADD_ri_cPt:
     case Hexagon::ADD_ri_cNotPt:
     case Hexagon::COMBINE_rr_cPt:
@@ -1336,8 +1340,6 @@ bool HexagonInstrInfo::isConditionalALU3
     case Hexagon::ASLH_cNotPt_V4:
     case Hexagon::ASRH_cPt_V4:
     case Hexagon::ASRH_cNotPt_V4:
-    case Hexagon::ZXTH_cPt_V4:
-    case Hexagon::ZXTH_cNotPt_V4:
       return QRI.Subtarget.hasV4TOps();
   }
 }

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td?rev=222662&r1=222661&r2=222662&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td Mon Nov 24 11:11:34 2014
@@ -267,6 +267,7 @@ multiclass ALU32_2op_base<string mnemoni
 
 defm sxtb : ALU32_2op_base<"sxtb", 0b101>, PredNewRel;
 defm sxth : ALU32_2op_base<"sxth", 0b111>, PredNewRel;
+defm zxth : ALU32_2op_base<"zxth", 0b110>, PredNewRel;
 
 // Rd=zxtb(Rs): assembler mapped to Rd=and(Rs,#255).
 // Compiler would want to generate 'zxtb' instead of 'and' becuase 'zxtb' has
@@ -635,7 +636,6 @@ multiclass ALU32_2op_base2<string mnemon
 
 defm ASLH : ALU32_2op_base2<"aslh">, PredNewRel;
 defm ASRH : ALU32_2op_base2<"asrh">, PredNewRel;
-defm ZXTH : ALU32_2op_base2<"zxth">,  PredNewRel;
 
 def : Pat <(shl (i32 IntRegs:$src1), (i32 16)),
            (ASLH IntRegs:$src1)>;
@@ -2320,7 +2320,7 @@ def : Pat<(atomic_store_64 (add (i32 Int
 
 // Map from r0 = and(r1, 65535) to r0 = zxth(r1)
 def : Pat <(and (i32 IntRegs:$src1), 65535),
-      (ZXTH (i32 IntRegs:$src1))>;
+      (A2_zxth (i32 IntRegs:$src1))>;
 
 // Map from r0 = and(r1, 255) to r0 = zxtb(r1).
 def : Pat <(and (i32 IntRegs:$src1), 255),

Added: llvm/trunk/test/MC/Hexagon/inst_zxth.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Hexagon/inst_zxth.ll?rev=222662&view=auto
==============================================================================
--- llvm/trunk/test/MC/Hexagon/inst_zxth.ll (added)
+++ llvm/trunk/test/MC/Hexagon/inst_zxth.ll Mon Nov 24 11:11:34 2014
@@ -0,0 +1,10 @@
+;; RUN: llc -mtriple=hexagon-unknown-elf -filetype=obj %s -o - \
+;; RUN: | llvm-objdump -s - | FileCheck %s
+
+define i32 @foo (i16 %a)
+{
+  %1 = zext i16 %a to i32
+  ret i32 %1
+}
+
+; CHECK:   0000 0040c070 00c09f52
\ No newline at end of file





More information about the llvm-commits mailing list