[llvm] r212492 - Allow AArch64FastISel to degrade graceully in the presence of an MVT::i128

Louis Gerbarg lgg at apple.com
Mon Jul 7 14:37:52 PDT 2014


Author: louis
Date: Mon Jul  7 16:37:51 2014
New Revision: 212492

URL: http://llvm.org/viewvc/llvm-project?rev=212492&view=rev
Log:
Allow AArch64FastISel to degrade graceully in the presence of an MVT::i128

Currently AArch64FastISel crashes if it tries to extend an integer into an
MVT::i128. This can happen by creating 128 bit integers like so:

  typedef unsigned int uint128_t __attribute__((mode(TI)));
  typedef int sint128_t __attribute__((mode(TI)));

This patch makes EmitIntExt check for their presence and then falls back to
SelectionDAG.

Tests included.

rdar://17516686

Added:
    llvm/trunk/test/CodeGen/AArch64/i128-fast-isel-fallback.ll
Modified:
    llvm/trunk/lib/Target/AArch64/AArch64FastISel.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64FastISel.cpp?rev=212492&r1=212491&r2=212492&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64FastISel.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64FastISel.cpp Mon Jul  7 16:37:51 2014
@@ -1750,6 +1750,12 @@ unsigned AArch64FastISel::Emiti1Ext(unsi
 unsigned AArch64FastISel::EmitIntExt(MVT SrcVT, unsigned SrcReg, MVT DestVT,
                                      bool isZExt) {
   assert(DestVT != MVT::i1 && "ZeroExt/SignExt an i1?");
+
+  // FastISel does not have plumbing to deal with an MVT::i128, if we see one
+  // so rather than return one we need to bail out to SelectionDAG.
+  if (DestVT == MVT::i128)
+    return 0;
+
   unsigned Opc;
   unsigned Imm = 0;
 

Added: llvm/trunk/test/CodeGen/AArch64/i128-fast-isel-fallback.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/i128-fast-isel-fallback.ll?rev=212492&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/i128-fast-isel-fallback.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/i128-fast-isel-fallback.ll Mon Jul  7 16:37:51 2014
@@ -0,0 +1,18 @@
+; RUN: llc -O0 -mtriple=arm64-apple-ios7.0 -mcpu=generic < %s | FileCheck %s
+
+; Function Attrs: nounwind ssp
+define void @test1() {
+  %1 = sext i32 0 to i128
+  call void  @test2(i128 %1)
+  ret void
+
+; The i128 is 0 so the we can test to make sure it is propogated into the x
+; registers that make up the i128 pair
+
+; CHECK:  mov  x0, xzr
+; CHECK:  mov  x1, x0
+; CHECK:  bl  _test2
+
+}
+
+declare void @test2(i128)





More information about the llvm-commits mailing list