[arm-fast-isel] Doublewords only require word-alignment.
authorChad Rosier <mcrosier@apple.com>
Tue, 6 Dec 2011 01:44:17 +0000 (01:44 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 6 Dec 2011 01:44:17 +0000 (01:44 +0000)
rdar://10528060

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

lib/Target/ARM/ARMFastISel.cpp
test/CodeGen/ARM/fast-isel.ll

index ea03fb7a6011dfd3318738459378b67a1721a01a..de366f7bc8f5c980531dc66fc466b0bd950956cc 100644 (file)
@@ -1106,7 +1106,7 @@ bool ARMFastISel::ARMEmitStore(EVT VT, unsigned SrcReg, Address &Addr,
     case MVT::f32:
       if (!Subtarget->hasVFP2()) return false;
       StrOpc = ARM::VSTRS;
-      // Unaligned stores need special handling.
+      // Unaligned stores need special handling. Floats require word-alignment.
       if (Alignment && Alignment < 4) {
         unsigned MoveReg = createResultReg(TLI.getRegClassFor(MVT::i32));
         AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
@@ -1119,8 +1119,9 @@ bool ARMFastISel::ARMEmitStore(EVT VT, unsigned SrcReg, Address &Addr,
       break;
     case MVT::f64:
       if (!Subtarget->hasVFP2()) return false;
-      // FIXME: Unaligned stores need special handling.
-      if (Alignment && Alignment < 8) {
+      // FIXME: Unaligned stores need special handling.  Doublewords require
+      // word-alignment.
+      if (Alignment && Alignment < 4) {
           return false;
       }
       StrOpc = ARM::VSTRD;
index f9c1a9d7d354c7201a2833ce2b3f54149392147d..0697460873874396a93a2e55c32109ad7af89e22 100644 (file)
@@ -180,3 +180,21 @@ entry:
   store float %add, float* %x1, align 1
   ret void
 }
+
+; Doublewords require only word-alignment.
+; rdar://10528060
+%struct.anon.0 = type { double }
+
+@foo_unpacked = common global %struct.anon.0 zeroinitializer, align 4
+
+define void @test5(double %a, double %b) nounwind {
+entry:
+; ARM: @test5
+; THUMB: @test5
+  %add = fadd double %a, %b
+  store double %add, double* getelementptr inbounds (%struct.anon.0* @foo_unpacked, i32 0, i32 0), align 4
+; ARM: vstr d16, [r0]
+; THUMB: vstr d16, [r0]
+  ret void
+}
+