[PATCH] [UBSan][MIPS] Adding support for MIPS64

Daniel Sanders daniel.sanders at imgtec.com
Thu Nov 20 02:17:29 PST 2014


Sagar has shown me the error he gets and (if it's as easy to fix as it looks) I'd rather fix the 'Cannot select ... i64,glue = addc ...' error by adding the necessary Pat's than remove the __SIZEOF_INT128__ macro.

In MipsInstrInfo.td there's this code to support 64-bit ints on MIPS32:
  def : MipsPat<(subc GPR32:$lhs, GPR32:$rhs),
                 (SUBu GPR32:$lhs, GPR32:$rhs)>;
  let AdditionalPredicates = [NotDSP] in {
     def : MipsPat<(addc GPR32:$lhs, GPR32:$rhs),
                   (ADDu GPR32:$lhs, GPR32:$rhs)>;
     def : MipsPat<(addc  GPR32:$src, immSExt16:$imm),
                   (ADDiu GPR32:$src, imm:$imm)>;
  }
We don't seem to have a GPR64 version of these three Pat's. I think it might be as simple as copying this into Mips64InstrInfo.td and changing the new copy from GPR32, ADD, and SUB, to GPR64, DADD, and DSUB respectively but I haven't had chance to try this change yet.

For the sake of completeness, the test case he showed me was:
  int main ()
  {
    __int128 a, b;
    a = 10;
    b = 20;
    a = a + b;
    return 0;
  }
and the full error is:
  fatal error: error in backend: Cannot select: 0x489e630: i64,glue = addc 0x489e510, 0x489bf98 [ORD=10] [ID=22]
      0x489e510: i64,ch = load 0x489cda8, 0x489cc88, 0x489c028<LD8[%a+8]> [ORD=8] [ID=20]
        0x489cc88: i64 = or 0x489c1d8, 0x489c9b8 [ORD=6] [ID=12]
          0x489c1d8: i64 = FrameIndex<1> [ID=4]
          0x489c9b8: i64 = Constant<8> [ID=10]
        0x489c028: i64 = undef [ID=3]
      0x489bf98: i64 = Constant<20> [ID=7]

http://reviews.llvm.org/D6320






More information about the llvm-commits mailing list