GlobalISel: translate constants larger than 64 bits.
authorTim Northover <tnorthover@apple.com>
Mon, 5 Dec 2016 21:54:17 +0000 (21:54 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 5 Dec 2016 21:54:17 +0000 (21:54 +0000)
llvm-svn: 288713

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll

index b84bd64..1c0020e 100644 (file)
@@ -697,7 +697,7 @@ bool IRTranslator::translate(const Instruction &Inst) {
 
 bool IRTranslator::translate(const Constant &C, unsigned Reg) {
   if (auto CI = dyn_cast<ConstantInt>(&C))
-    EntryBuilder.buildConstant(Reg, CI->getZExtValue());
+    EntryBuilder.buildConstant(Reg, *CI);
   else if (auto CF = dyn_cast<ConstantFP>(&C))
     EntryBuilder.buildFConstant(Reg, *CF);
   else if (isa<UndefValue>(C))
index 58d35e0..0413d08 100644 (file)
@@ -906,3 +906,12 @@ define void @test_objectsize(i8* %addr0, i8* %addr1) {
   %size32.intmin = call i32 @llvm.objectsize.i32(i8* %addr0, i1 1)
   ret void
 }
+
+define void @test_large_const(i128* %addr) {
+; CHECK-LABEL: name: test_large_const
+; CHECK: [[ADDR:%[0-9]+]](p0) = COPY %x0
+; CHECK: [[VAL:%[0-9]+]](s128) = G_CONSTANT i128 42
+; CHECK: G_STORE [[VAL]](s128), [[ADDR]](p0)
+  store i128 42, i128* %addr
+  ret void
+}