ARM64: mark x7 as used when an i128 gets shunted onto the stack.
authorTim Northover <tnorthover@apple.com>
Wed, 16 Apr 2014 09:03:25 +0000 (09:03 +0000)
committerTim Northover <tnorthover@apple.com>
Wed, 16 Apr 2014 09:03:25 +0000 (09:03 +0000)
The second half of a split i128 was ending up in x7, which is not a good thing.

This is another part of PR19432.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206366 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM64/ARM64CallingConvention.td
test/CodeGen/ARM64/aapcs.ll

index 9ac888ff242ed74d3a5ca7f3d5aaff7084530b74..f86c9c714aca743065b5123c0e78da7f5a568526 100644 (file)
@@ -36,7 +36,7 @@ def CC_ARM64_AAPCS : CallingConv<[
                                                     [X0, X1, X3, X5]>>>,
 
   // i128 is split to two i64s, and its stack alignment is 16 bytes.
-  CCIfType<[i64], CCIfSplit<CCAssignToStack<8, 16>>>,
+  CCIfType<[i64], CCIfSplit<CCAssignToStackWithShadow<8, 16, [X7]>>>,
 
   CCIfType<[i64], CCAssignToRegWithShadow<[X0, X1, X2, X3, X4, X5, X6, X7],
                                           [W0, W1, W2, W3, W4, W5, W6, W7]>>,
index 27d2aa7b77371ae72ef7a4db1768fd7f7ef3e2f8..fc1266ccfed714a3b1f0c3bd75729a9cd55e79c3 100644 (file)
@@ -84,3 +84,13 @@ define void @test_variadic() {
 ; CHECK: bl variadic
   ret void
 }
+
+; We weren't marking x7 as used after deciding that the i128 didn't fit into
+; registers and putting the first half on the stack, so the *second* half went
+; into x7. Yuck!
+define i128 @test_i128_shadow([7 x i64] %x0_x6, i128 %sp) {
+; CHECK-LABEL: test_i128_shadow:
+; CHECK: ldp x0, x1, [sp]
+
+  ret i128 %sp
+}