-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AIX] Lower intrinsic __builtin_cpu_is into AIX platform-specific cod…
…e. (#80069) On AIX OS, __builtin_cpu_is() references the runtime external variable _system_configuration from /usr/include/sys/systemcfg.h. ref issue: #80042
- Loading branch information
Showing
8 changed files
with
206 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppc970\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppc-cell-be\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppca2\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppc405\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppc440\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppc464\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"ppc476\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power4\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power5\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power5+\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power6\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power6x\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power7\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=32768 \ | ||
// RUN: --check-prefix=CHECKOP | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power8\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=65536 \ | ||
// RUN: --check-prefix=CHECKOP | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power9\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=131072\ | ||
// RUN: --check-prefix=CHECKOP | ||
|
||
// RUN: echo "int main() { return __builtin_cpu_is(\"power10\");}" > %t.c | ||
// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=262144 \ | ||
// RUN: --check-prefix=CHECKOP | ||
|
||
// CHECK: define i32 @main() #0 { | ||
// CHECK-NEXT: entry: | ||
// CHECK-NEXT: %retval = alloca i32, align 4 | ||
// CHECK-NEXT: store i32 0, ptr %retval, align 4 | ||
// CHECK-NEXT: ret i32 0 | ||
// CHECK-NEXT: } | ||
|
||
// CHECKOP: @_system_configuration = external global { i32, i32, i32 } | ||
// CHECKOP: define i32 @main() #0 { | ||
// CHECKOP-NEXT: entry: | ||
// CHECKOP-NEXT: %retval = alloca i32, align 4 | ||
// CHECKOP-NEXT: store i32 0, ptr %retval, align 4 | ||
// CHECKOP-NEXT: %0 = load i32, ptr getelementptr inbounds ({ i32, i32, i32 }, ptr @_system_configuration, i32 0, i32 1), align 4 | ||
// CHECKOP-NEXT: %1 = icmp eq i32 %0, [[VALUE]] | ||
// CHECKOP-NEXT: %conv = zext i1 %1 to i32 | ||
// CHECKOP-NEXT: ret i32 %conv | ||
// CHECKOP-NEXT: } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -triple powerpc-ibm-aix7.1.0.0 -verify %s | ||
|
||
int main(void) { | ||
if (__builtin_cpu_is("power8")) // expected-error {{this builtin is available only on AIX 7.2 and later operating systems}} | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters