Skip to content

Commit 35cc949

Browse files
DavidTrubyrorth
authored andcommitted
[flang] Add aarch64 processor defines (llvm#142606)
This patch adds aarch64 specific processor defines when targeting aarch64, similar to the ones for ppc64 and x86_64
1 parent 7a01cc3 commit 35cc949

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,10 @@ void CompilerInvocation::setDefaultPredefinitions() {
16561656
fortranOptions.predefinitions.emplace_back("__64BIT__", "1");
16571657
}
16581658
break;
1659+
case llvm::Triple::ArchType::aarch64:
1660+
fortranOptions.predefinitions.emplace_back("__aarch64__", "1");
1661+
fortranOptions.predefinitions.emplace_back("__aarch64", "1");
1662+
break;
16591663
}
16601664
}
16611665

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
! Test predefined macro for AArch64
2+
3+
! REQUIRES: aarch64-registered-target
4+
5+
! RUN: %flang_fc1 -triple aarch64-unknown-linux-gnu -cpp -E %s | FileCheck %s
6+
7+
! CHECK: integer :: var1 = 1
8+
! CHECK: integer :: var2 = 1
9+
10+
#if __aarch64__
11+
integer :: var1 = __aarch64__
12+
#endif
13+
#if __aarch64
14+
integer :: var2 = __aarch64
15+
#endif
16+
end program

0 commit comments

Comments
 (0)