[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-18 Thread Fangrui Song via cfe-commits

MaskRay wrote:

Thanks for the comment. I'll abandon this.

https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-18 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay closed 
https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-18 Thread Peter Smith via cfe-commits

smithp35 wrote:

> > If possible I would prefer to keep -m[no-]unaligned-access for AArch64.
> > The history of this option name derives from Arm's proprietary compiler 
> > [developer.arm.com/documentation/dui0472/m/Compiler-Command-line-Options/--unaligned-accessno-unaligned-access](https://developer.arm.com/documentation/dui0472/m/Compiler-Command-line-Options/--unaligned-accessno-unaligned-access)
> >  which has been carried forward for the LLVM based Arm Compiler 
> > [developer.arm.com/documentation/101754/0621/armclang-Reference/armclang-Command-line-Options/-munaligned-access---mno-unaligned-access?lang=en](https://developer.arm.com/documentation/101754/0621/armclang-Reference/armclang-Command-line-Options/-munaligned-access---mno-unaligned-access?lang=en)
> > Yes the proprietary compiler can always put this back as a downstream 
> > change. However we are trying to introduce more use of upstream clang and 
> > it would help migration of these projects if they didn't need to change.
> 
> Thanks for the comments. The first link gives `--unaligned_access, 
> --no_unaligned_access`, which Clang doesn't support.

Yes the first link is just showing the history of the name. The 
--unaligned_access became -munaligned-access in clang/gcc for Arm.

> Does the second link mean AArch32 or AArch64? 

It means both.

> I thinks there may be strong motivation to keep both `-m[no-]strict-align` 
> for AArch32 (`-mno-strict-align` was a recent introduction by LoongArch 
> folks) but very little for AArch64 (since GCC has always been rejecting 
> `-m[no-]unaligned-access`).
> 
> Part of the motivation behind the change and #85350 is to discourage future 
> ports (including existing RISC-V/LoongArch) to create aliases for 
> architectures that don't need the aliases.

I would just like to keep the `-mno-unaligned-access` alias for AArch64 if at 
all possible, I've no problem with it not aliasing for all targets. I think 
existing code coming from GCC or needing to be compatible with GCC will use 
`-mstrict-align` and `-mno-strict-align` and will be unaffected, however 
looking at the history this option has been supported in clang for AArch64 for 
almost 10 years. In our proprietary toolchain we've consistently used 
`-mno-unaligned-access` for AArch64. As mentioned previously we can always 
downstream patch that, although it adds yet another item to the migration guide 
to move people to upstream clang. 

Tracing the history back it looks like AArch64 -mno-unaligned-access support 
was added in 2014 with
```
commit e5cee260ce07f96a8bc8f82905bc319cc33106fe
Author: Kevin Qin 
Date:   Tue May 6 09:51:32 2014 +

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

This patch is to get "-mno-unaligned-access" and "-munaligned-access"
work in front-end for ARM64 target.

llvm-svn: 208075
```
Checking our own issue tracker I've found our own internal ticket. Which 
doesn't add much information, it does have:
```
ARM64 had one back-end option "arm64-strict-align" to enable strict align mode, 
but didn't support any command line option in front-end. This patch allows 
users use "-mno-unaligned-access" and "-munaligned-access" in front-end to 
directly control alignment settings.
```


https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-18 Thread Fangrui Song via cfe-commits

MaskRay wrote:

> If possible I would prefer to keep -m[no-]unaligned-access for AArch64.
> 
> The history of this option name derives from Arm's proprietary compiler 
> [developer.arm.com/documentation/dui0472/m/Compiler-Command-line-Options/--unaligned-accessno-unaligned-access](https://developer.arm.com/documentation/dui0472/m/Compiler-Command-line-Options/--unaligned-accessno-unaligned-access)
>  which has been carried forward for the LLVM based Arm Compiler 
> [developer.arm.com/documentation/101754/0621/armclang-Reference/armclang-Command-line-Options/-munaligned-access---mno-unaligned-access?lang=en](https://developer.arm.com/documentation/101754/0621/armclang-Reference/armclang-Command-line-Options/-munaligned-access---mno-unaligned-access?lang=en)
> 
> Yes the proprietary compiler can always put this back as a downstream change. 
> However we are trying to introduce more use of upstream clang and it would 
> help migration of these projects if they didn't need to change.

Thanks for the comments. The first link gives `--unaligned_access, 
--no_unaligned_access`, which Clang doesn't support.
Does the second link mean AArch32 or AArch64?  I thinks there may be strong 
motivation to keep both `-m[no-]strict-align` (`-mno-strict-align` was a recent 
introduction by LoongArch folks) but very little for AArch64 (since GCC has 
always been rejecting `-m[no-]unaligned-access`).

Part of the motivation behind the change and 
https://github.com/llvm/llvm-project/pull/85350 is to discourage future ports 
(including existing RISC-V/LoongArch) to create aliases for architectures that 
don't need the aliases.



https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-18 Thread Jon Roelofs via cfe-commits

jroelofs wrote:

> If Apple platforms need this option, I can keep it recognized but only for 
> Apple.

I don't see any projects that use `-m(no-)unaligned-access`, but it could be 
that I don't have permissions on ones that do. I'll give our qualification team 
a heads-up if/when you land it, and if we need to we can have an exception for 
`*-apple-*` triples or something. We'll let you know.

https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-18 Thread Peter Smith via cfe-commits

https://github.com/smithp35 commented:

If possible I would prefer to keep -m[no-]unaligned-access for AArch64.

The history of this option name derives from Arm's proprietary compiler 
https://developer.arm.com/documentation/dui0472/m/Compiler-Command-line-Options/--unaligned-accessno-unaligned-access
 which has been carried forward for the LLVM based Arm Compiler 
https://developer.arm.com/documentation/101754/0621/armclang-Reference/armclang-Command-line-Options/-munaligned-access---mno-unaligned-access?lang=en

Yes the proprietary compiler can always put this back as a downstream change. 
However we are trying to introduce more use of upstream clang and it would help 
migration of these projects if they didn't need to change.

https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-15 Thread Fangrui Song via cfe-commits

MaskRay wrote:

If Apple platforms need this option, I can keep it recognized but only for 
Apple.

For ELF platforms, we should remove the GCC-unsupported-and-rejected aliases.

https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-15 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-aarch64

Author: Fangrui Song (MaskRay)


Changes

Follow-up to #85350: GCC only supports -m[no-]strict-align for AArch64
and rejects adding -m[no-]unaligned-access aliases. We inapropriated
supported -m[no-]unaligned-access as aliases for non-AArch64 due to an
early design issue (a146a48349c965932dcf304ffb8155b25307f245).

Since the behavior has been longtime for ARM, keep ARM unchanged but
tighten up the behavior for AArch64.


---
Full diff: https://github.com/llvm/llvm-project/pull/85441.diff


3 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Arch/AArch64.cpp (+2-7) 
- (modified) clang/test/Driver/arm-alignment.c (+3-21) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e1743368b157e0..a9e3be617d0e74 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -191,7 +191,7 @@ Removed Compiler Flags
 -
 
 - The ``-freroll-loops`` flag has been removed. It had no effect since Clang 
13.
-- ``-m[no-]unaligned-access`` is removed for RISC-V and LoongArch.
+- ``-m[no-]unaligned-access`` is removed for AArch64, RISC-V, and LoongArch.
   ``-m[no-]strict-align``, also supported by GCC, should be used instead.
   (`#85350 `_.)
 
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 3e6e29584df3ac..cac5ab5f369e57 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -321,13 +321,8 @@ void aarch64::getAArch64TargetFeatures(const Driver ,
 }
   }
 
-  if (Arg *A = Args.getLastArg(
-  options::OPT_mstrict_align, options::OPT_mno_strict_align,
-  options::OPT_mno_unaligned_access, options::OPT_munaligned_access)) {
-if (A->getOption().matches(options::OPT_mstrict_align) ||
-A->getOption().matches(options::OPT_mno_unaligned_access))
-  Features.push_back("+strict-align");
-  } else if (Triple.isOSOpenBSD())
+  if (Args.hasFlag(options::OPT_mstrict_align, options::OPT_mno_strict_align,
+   Triple.isOSOpenBSD()))
 Features.push_back("+strict-align");
 
   if (Args.hasArg(options::OPT_ffixed_x1))
diff --git a/clang/test/Driver/arm-alignment.c 
b/clang/test/Driver/arm-alignment.c
index 8c915477af9aff..f7db966f9818ab 100644
--- a/clang/test/Driver/arm-alignment.c
+++ b/clang/test/Driver/arm-alignment.c
@@ -37,19 +37,13 @@
 // RUN: %clang -target thumbv8m.base-none-gnueabi -### %s 2> %t
 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
 
-// RUN: %clang --target=aarch64 -munaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mstrict-align -munaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mno-unaligned-access -munaligned-access -### 
%s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
+// RUN: not %clang --target=aarch64 -munaligned-access -mno-unaligned-access 
-### %s 2>&1 | FileCheck %s --check-prefix=ERR
+// ERR: error: unsupported option '-munaligned-access' for target 'aarch64'
+// ERR: error: unsupported option '-mno-unaligned-access' for target 'aarch64'
 
 // CHECK-UNALIGNED-ARM-NOT: "-target-feature" "+strict-align"
 // CHECK-UNALIGNED-AARCH64-NOT: "-target-feature" "+strict-align"
 
-
 // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
 
@@ -83,21 +77,9 @@
 // RUN: %clang -target armv6m-netbsd-eabi -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
 
-// RUN: %clang --target=aarch64 -mno-unaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
 // RUN: %clang --target=aarch64 -mstrict-align -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 
-// RUN: %clang --target=aarch64 -munaligned-access -mno-unaligned-access -### 
%s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -munaligned-access -mstrict-align -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mkernel -mno-unaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
 // RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 

``




https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-15 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Fangrui Song (MaskRay)


Changes

Follow-up to #85350: GCC only supports -m[no-]strict-align for AArch64
and rejects adding -m[no-]unaligned-access aliases. We inapropriated
supported -m[no-]unaligned-access as aliases for non-AArch64 due to an
early design issue (a146a48349c965932dcf304ffb8155b25307f245).

Since the behavior has been longtime for ARM, keep ARM unchanged but
tighten up the behavior for AArch64.


---
Full diff: https://github.com/llvm/llvm-project/pull/85441.diff


3 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Arch/AArch64.cpp (+2-7) 
- (modified) clang/test/Driver/arm-alignment.c (+3-21) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e1743368b157e0..a9e3be617d0e74 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -191,7 +191,7 @@ Removed Compiler Flags
 -
 
 - The ``-freroll-loops`` flag has been removed. It had no effect since Clang 
13.
-- ``-m[no-]unaligned-access`` is removed for RISC-V and LoongArch.
+- ``-m[no-]unaligned-access`` is removed for AArch64, RISC-V, and LoongArch.
   ``-m[no-]strict-align``, also supported by GCC, should be used instead.
   (`#85350 `_.)
 
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 3e6e29584df3ac..cac5ab5f369e57 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -321,13 +321,8 @@ void aarch64::getAArch64TargetFeatures(const Driver ,
 }
   }
 
-  if (Arg *A = Args.getLastArg(
-  options::OPT_mstrict_align, options::OPT_mno_strict_align,
-  options::OPT_mno_unaligned_access, options::OPT_munaligned_access)) {
-if (A->getOption().matches(options::OPT_mstrict_align) ||
-A->getOption().matches(options::OPT_mno_unaligned_access))
-  Features.push_back("+strict-align");
-  } else if (Triple.isOSOpenBSD())
+  if (Args.hasFlag(options::OPT_mstrict_align, options::OPT_mno_strict_align,
+   Triple.isOSOpenBSD()))
 Features.push_back("+strict-align");
 
   if (Args.hasArg(options::OPT_ffixed_x1))
diff --git a/clang/test/Driver/arm-alignment.c 
b/clang/test/Driver/arm-alignment.c
index 8c915477af9aff..f7db966f9818ab 100644
--- a/clang/test/Driver/arm-alignment.c
+++ b/clang/test/Driver/arm-alignment.c
@@ -37,19 +37,13 @@
 // RUN: %clang -target thumbv8m.base-none-gnueabi -### %s 2> %t
 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
 
-// RUN: %clang --target=aarch64 -munaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mstrict-align -munaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mno-unaligned-access -munaligned-access -### 
%s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
+// RUN: not %clang --target=aarch64 -munaligned-access -mno-unaligned-access 
-### %s 2>&1 | FileCheck %s --check-prefix=ERR
+// ERR: error: unsupported option '-munaligned-access' for target 'aarch64'
+// ERR: error: unsupported option '-mno-unaligned-access' for target 'aarch64'
 
 // CHECK-UNALIGNED-ARM-NOT: "-target-feature" "+strict-align"
 // CHECK-UNALIGNED-AARCH64-NOT: "-target-feature" "+strict-align"
 
-
 // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
 
@@ -83,21 +77,9 @@
 // RUN: %clang -target armv6m-netbsd-eabi -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
 
-// RUN: %clang --target=aarch64 -mno-unaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
 // RUN: %clang --target=aarch64 -mstrict-align -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 
-// RUN: %clang --target=aarch64 -munaligned-access -mno-unaligned-access -### 
%s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -munaligned-access -mstrict-align -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mkernel -mno-unaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
 // RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 

``




https://github.com/llvm/llvm-project/pull/85441
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver,AArch64] Remove AArch32-specific -m[no-]unaligned-access (PR #85441)

2024-03-15 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/85441

Follow-up to #85350: GCC only supports -m[no-]strict-align for AArch64
and rejects adding -m[no-]unaligned-access aliases. We inapropriated
supported -m[no-]unaligned-access as aliases for non-AArch64 due to an
early design issue (a146a48349c965932dcf304ffb8155b25307f245).

Since the behavior has been longtime for ARM, keep ARM unchanged but
tighten up the behavior for AArch64.


>From bf21dc24f5bfa8434198ec6bd65eec202811dc57 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Fri, 15 Mar 2024 11:06:42 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 clang/docs/ReleaseNotes.rst  |  2 +-
 clang/lib/Driver/ToolChains/Arch/AArch64.cpp |  9 ++--
 clang/test/Driver/arm-alignment.c| 24 +++-
 3 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e1743368b157e0..a9e3be617d0e74 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -191,7 +191,7 @@ Removed Compiler Flags
 -
 
 - The ``-freroll-loops`` flag has been removed. It had no effect since Clang 
13.
-- ``-m[no-]unaligned-access`` is removed for RISC-V and LoongArch.
+- ``-m[no-]unaligned-access`` is removed for AArch64, RISC-V, and LoongArch.
   ``-m[no-]strict-align``, also supported by GCC, should be used instead.
   (`#85350 `_.)
 
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 3e6e29584df3ac..cac5ab5f369e57 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -321,13 +321,8 @@ void aarch64::getAArch64TargetFeatures(const Driver ,
 }
   }
 
-  if (Arg *A = Args.getLastArg(
-  options::OPT_mstrict_align, options::OPT_mno_strict_align,
-  options::OPT_mno_unaligned_access, options::OPT_munaligned_access)) {
-if (A->getOption().matches(options::OPT_mstrict_align) ||
-A->getOption().matches(options::OPT_mno_unaligned_access))
-  Features.push_back("+strict-align");
-  } else if (Triple.isOSOpenBSD())
+  if (Args.hasFlag(options::OPT_mstrict_align, options::OPT_mno_strict_align,
+   Triple.isOSOpenBSD()))
 Features.push_back("+strict-align");
 
   if (Args.hasArg(options::OPT_ffixed_x1))
diff --git a/clang/test/Driver/arm-alignment.c 
b/clang/test/Driver/arm-alignment.c
index 8c915477af9aff..f7db966f9818ab 100644
--- a/clang/test/Driver/arm-alignment.c
+++ b/clang/test/Driver/arm-alignment.c
@@ -37,19 +37,13 @@
 // RUN: %clang -target thumbv8m.base-none-gnueabi -### %s 2> %t
 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
 
-// RUN: %clang --target=aarch64 -munaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mstrict-align -munaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mno-unaligned-access -munaligned-access -### 
%s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
+// RUN: not %clang --target=aarch64 -munaligned-access -mno-unaligned-access 
-### %s 2>&1 | FileCheck %s --check-prefix=ERR
+// ERR: error: unsupported option '-munaligned-access' for target 'aarch64'
+// ERR: error: unsupported option '-mno-unaligned-access' for target 'aarch64'
 
 // CHECK-UNALIGNED-ARM-NOT: "-target-feature" "+strict-align"
 // CHECK-UNALIGNED-AARCH64-NOT: "-target-feature" "+strict-align"
 
-
 // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
 
@@ -83,21 +77,9 @@
 // RUN: %clang -target armv6m-netbsd-eabi -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
 
-// RUN: %clang --target=aarch64 -mno-unaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
 // RUN: %clang --target=aarch64 -mstrict-align -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 
-// RUN: %clang --target=aarch64 -munaligned-access -mno-unaligned-access -### 
%s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -munaligned-access -mstrict-align -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
-// RUN: %clang --target=aarch64 -mkernel -mno-unaligned-access -### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
-
 // RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s