add support for loading bools
authorDuraid Madina <duraid@octopus.com.au>
Fri, 4 Nov 2005 09:59:06 +0000 (09:59 +0000)
committerDuraid Madina <duraid@octopus.com.au>
Fri, 4 Nov 2005 09:59:06 +0000 (09:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24182 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/IA64/IA64ISelDAGToDAG.cpp

index 9b26a25e9a2d34760062139faf52e75a863bc94e..129d381636a138e91d9a71f7aeb4b8d6a1a974a5 100644 (file)
@@ -369,7 +369,13 @@ SDOperand IA64DAGToDAGISel::Select(SDOperand Op) {
     unsigned Opc;
     switch (TypeBeingLoaded) {
     default: N->dump(); assert(0 && "Cannot load this type!");
-    // FIXME: bools? case MVT::i1:
+    case MVT::i1: { // this is a bool
+      Opc = IA64::LD1; // first we load a byte, then compare for != 0
+      CurDAG->SelectNodeTo(N, IA64::CMPNE, MVT::i1, MVT::Other, 
+       CurDAG->getTargetNode(Opc, MVT::i64, Address),
+       CurDAG->getRegister(IA64::r0, MVT::i64), Chain);
+      return SDOperand(N, Op.ResNo); // XXX: early exit
+      }
     case MVT::i8:  Opc = IA64::LD1; break;
     case MVT::i16: Opc = IA64::LD2; break;
     case MVT::i32: Opc = IA64::LD4; break;