Instructions for Book E PPC should be word aligned, set function alignment to reflect...
authorHal Finkel <hfinkel@anl.gov>
Mon, 17 Oct 2011 17:01:41 +0000 (17:01 +0000)
committerHal Finkel <hfinkel@anl.gov>
Mon, 17 Oct 2011 17:01:41 +0000 (17:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142194 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelLowering.cpp

index d6b8a9ee93c7a89ddff3c3edd3325b691d064e99..dcc056836829f45d65430af69c9e8a15f6b98518 100644 (file)
@@ -402,9 +402,16 @@ PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM)
     setLibcallName(RTLIB::EXP2_PPCF128, "exp2l$LDBL128");
   }
 
-  setMinFunctionAlignment(2);
-  if (PPCSubTarget.isDarwin())
-    setPrefFunctionAlignment(4);
+  if (PPCSubTarget.isBookE()) {
+    // Book E: Instructions are always four bytes long and word-aligned.
+    setMinFunctionAlignment(4);
+    setPrefFunctionAlignment(8);
+  }
+  else {
+    setMinFunctionAlignment(2);
+    if (PPCSubTarget.isDarwin())
+      setPrefFunctionAlignment(4);
+  }
 
   setInsertFencesForAtomic(true);