[flang] Add aarch64 processor defines (#142606)

This patch adds aarch64 specific processor defines when targeting
aarch64, similar to the ones for ppc64 and x86_64
This commit is contained in:
David Truby 2025-06-04 14:42:23 +01:00 committed by GitHub
parent fef5096a8a
commit b59c88835f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -1656,6 +1656,10 @@ void CompilerInvocation::setDefaultPredefinitions() {
fortranOptions.predefinitions.emplace_back("__64BIT__", "1");
}
break;
case llvm::Triple::ArchType::aarch64:
fortranOptions.predefinitions.emplace_back("__aarch64__", "1");
fortranOptions.predefinitions.emplace_back("__aarch64", "1");
break;
}
}

View File

@ -0,0 +1,16 @@
! Test predefined macro for AArch64
! REQUIRES: aarch64-registered-target
! RUN: %flang_fc1 -triple aarch64-unknown-linux-gnu -cpp -E %s | FileCheck %s
! CHECK: integer :: var1 = 1
! CHECK: integer :: var2 = 1
#if __aarch64__
integer :: var1 = __aarch64__
#endif
#if __aarch64
integer :: var2 = __aarch64
#endif
end program