Skip to content

[PowerPC] Add builtin_cpu_is P11 support #99550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

azhan92
Copy link
Contributor

@azhan92 azhan92 commented Jul 18, 2024

This PR adds support for __builtin_cpu_is ("power11")

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 18, 2024

@llvm/pr-subscribers-clang

Author: None (azhan92)

Changes

This PR adds power11 as a target for __builtin_cpu_is.


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

2 Files Affected:

  • (modified) clang/test/CodeGen/aix-builtin-cpu-is.c (+4)
  • (modified) llvm/include/llvm/TargetParser/PPCTargetParser.def (+3)
diff --git a/clang/test/CodeGen/aix-builtin-cpu-is.c b/clang/test/CodeGen/aix-builtin-cpu-is.c
index e17cf7353511a..04644dd7020e0 100644
--- a/clang/test/CodeGen/aix-builtin-cpu-is.c
+++ b/clang/test/CodeGen/aix-builtin-cpu-is.c
@@ -50,6 +50,10 @@
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=262144 \
 // RUN:   --check-prefix=CHECKOP
 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power11\");}" > %t.c
+// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=524288 \
+// RUN:   --check-prefix=CHECKOP
+
 // CHECK:     define i32 @main() #0 {
 // CHECK-NEXT: entry:
 // CHECK-NEXT:   %retval = alloca i32, align 4
diff --git a/llvm/include/llvm/TargetParser/PPCTargetParser.def b/llvm/include/llvm/TargetParser/PPCTargetParser.def
index 44e97d56a059c..df956a68d75d6 100644
--- a/llvm/include/llvm/TargetParser/PPCTargetParser.def
+++ b/llvm/include/llvm/TargetParser/PPCTargetParser.def
@@ -40,6 +40,7 @@
 #undef AIX_PPC8_VALUE
 #undef AIX_PPC9_VALUE
 #undef AIX_PPC10_VALUE
+#undef AIX_PPC11_VALUE
 #else
 #ifndef PPC_LNX_FEATURE
 #define PPC_LNX_FEATURE(NAME, DESC, ENUMNAME, ENUMVAL, HWCAPN)
@@ -84,6 +85,7 @@
 #define AIX_PPC8_VALUE 0x00010000
 #define AIX_PPC9_VALUE 0x00020000
 #define AIX_PPC10_VALUE 0x00040000
+#define AIX_PPC11_VALUE 0x00080000
 
 // __builtin_cpu_is() and __builtin_cpu_supports() are supported only on Power7 and up on AIX.
 // PPC_CPU(Name, Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID)
@@ -103,6 +105,7 @@ PPC_CPU("ppc476",SYS_CALL,44,BUILTIN_PPC_FALSE,0)
 PPC_CPU("power8",SYS_CALL,45,USE_SYS_CONF,AIX_PPC8_VALUE)
 PPC_CPU("power9",SYS_CALL,46,USE_SYS_CONF,AIX_PPC9_VALUE)
 PPC_CPU("power10",SYS_CALL,47,USE_SYS_CONF,AIX_PPC10_VALUE)
+PPC_CPU("power11",SYS_CALL,48,USE_SYS_CONF,AIX_PPC11_VALUE)
 #undef PPC_CPU
 
 // PPC features on Linux:

@daltenty daltenty requested a review from diggerlin July 18, 2024 19:50
@azhan92 azhan92 requested a review from chenzheng1030 July 22, 2024 03:26
Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a lit test for the linux part as well?

@azhan92
Copy link
Contributor Author

azhan92 commented Jul 22, 2024

Should there be a lit test for the linux part as well?

Is there a pre-existing test already, or should I add a new one? I can't seem to find an equivalent to clang/test/CodeGen/aix-builtin-cpu-is.c

@daltenty
Copy link
Member

Should there be a lit test for the linux part as well?

Is there a pre-existing test already, or should I add a new one? I can't seem to find an equivalent to clang/test/CodeGen/aix-builtin-cpu-is.c

There's an existing ppc64le block in clang/test/CodeGen/builtin-cpu-supports.c, I think we should just add the missing cases for Power8+ there.

@azhan92 azhan92 requested a review from daltenty July 22, 2024 20:49
Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@daltenty daltenty merged commit 63b382b into llvm:main Jul 23, 2024
7 checks passed
@daltenty
Copy link
Member

/cherry-pick 63b382b

@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

/cherry-pick 63b382b

Error: Command failed due to missing milestone.

@azhan92
Copy link
Contributor Author

azhan92 commented Jul 23, 2024

/cherry-pick 63b382b

@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

/cherry-pick 63b382b

Error: Command failed due to missing milestone.

1 similar comment
@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

/cherry-pick 63b382b

Error: Command failed due to missing milestone.

@jakeegan jakeegan added this to the LLVM 19.X Release milestone Jul 23, 2024
@azhan92
Copy link
Contributor Author

azhan92 commented Jul 23, 2024

/cherry-pick 63b382b

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 23, 2024
This PR adds support for __builtin_cpu_is ("power11")

(cherry picked from commit 63b382b)
@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

/pull-request #100207

tru pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 24, 2024
This PR adds support for __builtin_cpu_is ("power11")

(cherry picked from commit 63b382b)
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
This PR adds support for __builtin_cpu_is ("power11")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
Development

Successfully merging this pull request may close these issues.

6 participants