https://github.com/tomershafir updated 
https://github.com/llvm/llvm-project/pull/166416

>From f7a407e8b166f6b66eebb5c2b3fb3280fb4e6f60 Mon Sep 17 00:00:00 2001
From: tomershafir <[email protected]>
Date: Tue, 4 Nov 2025 21:06:57 +0200
Subject: [PATCH] [Clang][ARM] Fix tests using thumb instead arm arch on cc1

Currently, the ARM backend incorrectly parses every `arm` prefixed arch to be 
non-thumb, but `armv6m` is THUMB and doesnt have ARM ops causing the test to 
fail when compiling to assembly and not LLVM IR: `error: Function 'foo' uses 
ARM instructions, but the target does not support ARM mode execution.` This 
only happens when invoking cc1 directly and not the Clang driver.

As a quick triage, this patch changes the tests to use `thumb`.

Uncovered by https://github.com/llvm/llvm-project/pull/151404
---
 clang/test/AST/ast-dump-arm-attr.c            | 6 +++---
 clang/test/CodeGen/arm-acle-coproc.c          | 4 ++--
 clang/test/CodeGen/pr45476.cpp                | 2 +-
 clang/test/Sema/builtins-arm-exclusive-124.c  | 4 ++--
 clang/test/Sema/builtins-arm-exclusive-none.c | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/clang/test/AST/ast-dump-arm-attr.c 
b/clang/test/AST/ast-dump-arm-attr.c
index 78f557d4eb0b1..d26a77d067e97 100644
--- a/clang/test/AST/ast-dump-arm-attr.c
+++ b/clang/test/AST/ast-dump-arm-attr.c
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -triple arm-apple-darwin -ast-dump -ast-dump-filter Test %s 
\
 // RUN: | FileCheck --strict-whitespace %s
 //
-// RUN: %clang_cc1 -triple armv8m.base-none-eabi -mcmse -ast-dump 
-ast-dump-filter Test %s \
+// RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -ast-dump 
-ast-dump-filter Test %s \
 // RUN: | FileCheck --strict-whitespace %s --check-prefix=CHECK-CMSE
 //
 // Tests with serialization:
@@ -11,8 +11,8 @@
 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
 // RUN: | FileCheck --strict-whitespace %s
 //
-// RUN: %clang_cc1 -triple armv8m.base-none-eabi -mcmse -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c -triple armv8m.base-none-eabi -mcmse -include-pch %t 
-ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple thumbv8m.base-none-eabi -mcmse -include-pch %t 
-ast-dump-all -ast-dump-filter Test /dev/null \
 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
 // RUN: | FileCheck --strict-whitespace %s
 
diff --git a/clang/test/CodeGen/arm-acle-coproc.c 
b/clang/test/CodeGen/arm-acle-coproc.c
index 5acb9f65413a0..000fff632f0b7 100644
--- a/clang/test/CodeGen/arm-acle-coproc.c
+++ b/clang/test/CodeGen/arm-acle-coproc.c
@@ -4,10 +4,10 @@
 // RUN: %clang_cc1 -triple armv5te %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V5-TE %s
 // RUN: %clang_cc1 -triple armv5tej %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V5-TE %s
 // RUN: %clang_cc1 -triple armv6 %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V6 %s
-// RUN: %clang_cc1 -triple armv6m %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V6M %s
+// RUN: %clang_cc1 -triple thumbv6m %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V6M %s
 // RUN: %clang_cc1 -triple armv7a %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V7 %s
 // RUN: %clang_cc1 -triple armv7r %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V7 %s
-// RUN: %clang_cc1 -triple armv7m %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V7 %s
+// RUN: %clang_cc1 -triple thumbv7m %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V7 %s
 // RUN: %clang_cc1 -triple armv8a %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V8 %s
 // RUN: %clang_cc1 -triple armv8r %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V8 %s
 // RUN: %clang_cc1 -triple armv8.1a %s -E -dD -o - | FileCheck 
--check-prefix=CHECK-V8 %s
diff --git a/clang/test/CodeGen/pr45476.cpp b/clang/test/CodeGen/pr45476.cpp
index c95f7fb8cd9c3..3a67904a8e568 100644
--- a/clang/test/CodeGen/pr45476.cpp
+++ b/clang/test/CodeGen/pr45476.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv6m-eabi -emit-llvm %s -o - | FileCheck 
-check-prefix=LIBCALL %s
+// RUN: %clang_cc1 -triple thumbv6m-eabi -emit-llvm %s -o - | FileCheck 
-check-prefix=LIBCALL %s
 // RUN: %clang_cc1 -triple armv8-eabi -emit-llvm %s -o - | FileCheck 
-check-prefix=NATIVE %s
 // PR45476
 
diff --git a/clang/test/Sema/builtins-arm-exclusive-124.c 
b/clang/test/Sema/builtins-arm-exclusive-124.c
index b35ac181f0887..93540879a01ba 100644
--- a/clang/test/Sema/builtins-arm-exclusive-124.c
+++ b/clang/test/Sema/builtins-arm-exclusive-124.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple armv7m -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple armv8m.main -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple thumbv7m -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple thumbv8m.main -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple armv8.1m.main -fsyntax-only -verify %s
 
 // All these architecture versions provide 1-, 2- or 4-byte exclusive accesses,
diff --git a/clang/test/Sema/builtins-arm-exclusive-none.c 
b/clang/test/Sema/builtins-arm-exclusive-none.c
index 2ef910dd99aaf..25a71e18935a6 100644
--- a/clang/test/Sema/builtins-arm-exclusive-none.c
+++ b/clang/test/Sema/builtins-arm-exclusive-none.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv6m -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple thumbv6m -fsyntax-only -verify %s
 
 // Armv6-M does not support exclusive loads/stores at all, so all uses of
 // __builtin_arm_ldrex[d] and __builtin_arm_strex[d] is forbidden.

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to