[PATCH] [ARM64] Enable alignment control option in front-end for ARM64 - LLVM.

Kevin Qin kevinqindev at gmail.com
Wed Apr 23 20:03:30 PDT 2014


Add new run line to test "-arm64-no-strict-align".

http://reviews.llvm.org/D3467

Files:
  lib/Target/ARM64/ARM64ISelLowering.cpp
  test/CodeGen/ARM64/strict-align.ll

Index: lib/Target/ARM64/ARM64ISelLowering.cpp
===================================================================
--- lib/Target/ARM64/ARM64ISelLowering.cpp
+++ lib/Target/ARM64/ARM64ISelLowering.cpp
@@ -45,9 +45,20 @@
                      cl::desc("Generate ARM64 tail calls (TEMPORARY OPTION)."),
                      cl::init(true));
 
-static cl::opt<bool>
-StrictAlign("arm64-strict-align", cl::Hidden,
-            cl::desc("Disallow all unaligned memory accesses"));
+enum AlignMode {
+  StrictAlign,
+  NoStrictAlign
+};
+
+static cl::opt<AlignMode>
+Align(cl::desc("Load/store alignment support"),
+      cl::Hidden, cl::init(NoStrictAlign),
+      cl::values(
+          clEnumValN(StrictAlign,   "arm64-strict-align",
+                     "Disallow all unaligned memory accesses"),
+          clEnumValN(NoStrictAlign, "arm64-no-strict-align",
+                     "Allow unaligned memory accesses"),
+          clEnumValEnd));
 
 // Place holder until extr generation is tested fully.
 static cl::opt<bool>
@@ -372,7 +383,7 @@
 
   setDivIsWellDefined(true);
 
-  RequireStrictAlign = StrictAlign;
+  RequireStrictAlign = (Align == StrictAlign);
 
   setHasExtractBitsInsn(true);
 
Index: test/CodeGen/ARM64/strict-align.ll
===================================================================
--- test/CodeGen/ARM64/strict-align.ll
+++ test/CodeGen/ARM64/strict-align.ll
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-apple-darwin -arm64-no-strict-align | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-apple-darwin -arm64-strict-align | FileCheck %s --check-prefix=CHECK-STRICT
 
 define i32 @f0(i32* nocapture %p) nounwind {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3467.8786.patch
Type: text/x-patch
Size: 1701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140424/e0660d4a/attachment.bin>


More information about the llvm-commits mailing list