[Hexagon] Fixing load instruction parsing and reenabling tests.
authorColin LeMahieu <colinl@codeaurora.org>
Tue, 10 Nov 2015 00:02:27 +0000 (00:02 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Tue, 10 Nov 2015 00:02:27 +0000 (00:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252555 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonInstrInfoV4.td
lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h
test/CodeGen/Hexagon/always-ext.ll
test/CodeGen/Hexagon/static.ll
test/MC/Disassembler/Hexagon/ld.txt
test/MC/Hexagon/instructions/ld.s

index 09a8a21c91b07e7dabd7f0fd737cf10c192bc0d6..618ea316e6507623aa12f8e37fa14d0e1425680e 100644 (file)
@@ -3631,9 +3631,9 @@ let AddedComplexity = 100 in {
 //===----------------------------------------------------------------------===//
 let isPredicable = 1, hasSideEffects = 0 in
 class T_LoadAbsGP <string mnemonic, RegisterClass RC, Operand ImmOp,
-                   bits<3> MajOp, Operand AddrOp, bit isAbs>
-  : LDInst <(outs RC:$dst), (ins AddrOp:$addr),
-  "$dst = "#mnemonic# !if(isAbs, "(##", "(#")#"$addr)",
+                   bits<3> MajOp>
+  : LDInst <(outs RC:$dst), (ins ImmOp:$addr),
+  "$dst = "#mnemonic# "(#$addr)",
   [], "", V2LDST_tc_ld_SLOT01> {
     bits<5> dst;
     bits<19> addr;
@@ -3658,7 +3658,7 @@ class T_LoadAbsGP <string mnemonic, RegisterClass RC, Operand ImmOp,
 
 class T_LoadAbs <string mnemonic, RegisterClass RC, Operand ImmOp,
                  bits<3> MajOp>
-  : T_LoadAbsGP <mnemonic, RC, ImmOp, MajOp, u32Imm, 1>, AddrModeRel {
+  : T_LoadAbsGP <mnemonic, RC, u32MustExt, MajOp>, AddrModeRel {
 
     string ImmOpStr = !cast<string>(ImmOp);
     let opExtentBits = !if (!eq(ImmOpStr, "u16_3Imm"), 19,
@@ -3676,10 +3676,11 @@ class T_LoadAbs <string mnemonic, RegisterClass RC, Operand ImmOp,
 // Template class for predicated load instructions with
 // absolute addressing mode.
 //===----------------------------------------------------------------------===//
-let isPredicated = 1, opExtentBits = 6, opExtendable = 2 in
+let isPredicated = 1, hasSideEffects = 0, hasNewValue = 1, opExtentBits = 6,
+    opExtendable = 2 in
 class T_LoadAbs_Pred <string mnemonic, RegisterClass RC, bits<3> MajOp,
                       bit isPredNot, bit isPredNew>
-  : LDInst <(outs RC:$dst), (ins PredRegs:$src1, u6Ext:$absaddr),
+  : LDInst <(outs RC:$dst), (ins PredRegs:$src1, u32MustExt:$absaddr),
   !if(isPredNot, "if (!$src1", "if ($src1")#!if(isPredNew, ".new) ",
   ") ")#"$dst = "#mnemonic#"(#$absaddr)">, AddrModeRel {
     bits<5> dst;
@@ -3753,7 +3754,7 @@ defm loadrd  : LD_Abs<"memd",  "LDrid", DoubleRegs, u16_3Imm, 0b110>;
 let isAsmParserOnly = 1 in
 class T_LoadGP <string mnemonic, string BaseOp, RegisterClass RC, Operand ImmOp,
                 bits<3> MajOp>
-  : T_LoadAbsGP <mnemonic, RC, ImmOp, MajOp, globaladdress, 0>, PredNewRel {
+  : T_LoadAbsGP <mnemonic, RC, ImmOp, MajOp>, PredNewRel {
     let BaseOpcode = BaseOp#_abs;
   }
 
index 1bec375f33ee045425d56dadfb8720f00f6a392b..1b09a36960d883d1e8560597364391b8d68fc1ea 100644 (file)
@@ -60,9 +60,9 @@ void HexagonMCELFStreamer::EmitInstruction(const MCInst &MCK,
     if (Extended) {
       if (HexagonMCInstrInfo::isDuplex(*MCII, *MCI)) {
         MCInst *SubInst = const_cast<MCInst *>(MCI->getOperand(1).getInst());
-        HexagonMCInstrInfo::clampExtended(*MCII, *SubInst);
+        HexagonMCInstrInfo::clampExtended(*MCII, getContext(), *SubInst);
       } else {
-        HexagonMCInstrInfo::clampExtended(*MCII, *MCI);
+        HexagonMCInstrInfo::clampExtended(*MCII, getContext(), *MCI);
       }
       Extended = false;
     } else {
index db338ab5e60fa2b6184374ab488f3131d87d1b86..2940612080344e407f6746d3f2ce32ed499da7a6 100644 (file)
@@ -87,7 +87,8 @@ bool HexagonMCInstrInfo::canonicalizePacket(MCInstrInfo const &MCII,
   return true;
 }
 
-void HexagonMCInstrInfo::clampExtended(MCInstrInfo const &MCII, MCInst &MCI) {
+void HexagonMCInstrInfo::clampExtended(MCInstrInfo const &MCII,
+                                       MCContext &Context, MCInst &MCI) {
   assert(HexagonMCInstrInfo::isExtendable(MCII, MCI) ||
          HexagonMCInstrInfo::isExtended(MCII, MCI));
   MCOperand &exOp =
@@ -95,10 +96,10 @@ void HexagonMCInstrInfo::clampExtended(MCInstrInfo const &MCII, MCInst &MCI) {
   // If the extended value is a constant, then use it for the extended and
   // for the extender instructions, masking off the lower 6 bits and
   // including the assumed bits.
-  if (exOp.isImm()) {
+  int64_t Value;
+  if (exOp.getExpr()->evaluateAsAbsolute(Value)) {
     unsigned Shift = HexagonMCInstrInfo::getExtentAlignment(MCII, MCI);
-    int64_t Bits = exOp.getImm();
-    exOp.setImm((Bits & 0x3f) << Shift);
+    exOp.setExpr(MCConstantExpr::create((Value & 0x3f) << Shift, Context));
   }
 }
 
index 452abebc9483672d211019fed4ec37b37b7d7932..a3230d2ae7305ba4ed1dd78da25fb91099fdd5c5 100644 (file)
@@ -67,7 +67,7 @@ bool canonicalizePacket(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
                         HexagonMCChecker *Checker);
 
 // Clamp off upper 26 bits of extendable operand for emission
-void clampExtended(MCInstrInfo const &MCII, MCInst &MCI);
+void clampExtended(MCInstrInfo const &MCII, MCContext &Context, MCInst &MCI);
 
 // Return the extender for instruction at Index or nullptr if none
 MCInst const *extenderForIndex(MCInst const &MCB, size_t Index);
index 761c1bd7ba12bf12d9ef1dc1096de321a72c5c41..3bf465b6a513a97a330f82182488b444425019f3 100644 (file)
@@ -1,5 +1,4 @@
 ; RUN: llc -march=hexagon < %s | FileCheck %s
-; XFAIL: *
 
 ; Check that we don't generate an invalid packet with too many instructions
 ; due to a store that has a must-extend operand.
index 6adfaaf139e6f52a349e18201eaf4974373e5b2b..760b8b559725548ad30f749d1dcf8368f01d54b5 100644 (file)
@@ -1,5 +1,4 @@
 ; RUN: llc -march=hexagon -mcpu=hexagonv4 -disable-dfa-sched -disable-hexagon-misched < %s | FileCheck %s
-; XFAIL: *
 
 @num = external global i32
 @acc = external global i32
index f4311570e40b2eb4d0230ef5b70b3e7bd5b5535a..56e00fd94f5629b3c56232d4db638740815054bb 100644 (file)
@@ -1,6 +1,5 @@
 # RUN: llvm-mc -triple hexagon -disassemble < %s | FileCheck %s
 # Hexagon Programmer's Reference Manual 11.5 LD
-# XFAIL: *
 
 # Load doubleword
 0x90 0xff 0xd5 0x3a
index cbfa7799f83b29c92da7d918c1ab0c760389dd35..2695999aa85fe15f041f7f4e65fbf004f9a508ea 100644 (file)
@@ -1,12 +1,6 @@
 # RUN: llvm-mc -triple hexagon -filetype=obj -o - %s | llvm-objdump -d - | FileCheck %s
 # Hexagon Programmer's Reference Manual 11.5 LD
-# XFAIL: *
 
-# Load doubleword
-# CHECK: 90 ff d5 3a
-r17:16 = memd(r21 + r31<<#3)
-# CHECK: b0 c2 c0 49
-r17:16 = memd(#168)
 # CHECK: 02 40 00 00
 # CHECK-NEXT: 10 c5 c0 49
 r17:16 = memd(##168)