File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
compiler-rt/test/orc/TestCases/Linux/ppc64 Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -fPIC -c -o %t %s
2
+ // RUN: %llvm_jitlink %t
3
+
4
+ #include < fstream>
5
+ #include < iostream>
6
+ #include < string>
7
+
8
+ thread_local int x = 0 ;
9
+ thread_local int y = 1 ;
10
+ thread_local int z = -1 ;
11
+
12
+ static int __attribute__ ((target(" arch=pwr10" ))) TestPOWER10() {
13
+ return x + y + z;
14
+ }
15
+
16
+ static int Test () { return x + y + z; }
17
+
18
+ static bool CPUModelIsPOWER10 () {
19
+ std::string line;
20
+ std::ifstream cpuinfo (" /proc/cpuinfo" , std::ios::in);
21
+ if (!cpuinfo.is_open ())
22
+ return false ;
23
+ while (std::getline (cpuinfo, line)) {
24
+ if (line.find (" cpu" ) != std::string::npos &&
25
+ line.find (" POWER10" ) != std::string::npos)
26
+ return true ;
27
+ }
28
+ return false ;
29
+ }
30
+
31
+ int main () {
32
+ if (CPUModelIsPOWER10 ())
33
+ return TestPOWER10 ();
34
+ return Test ();
35
+ }
You can’t perform that action at this time.
0 commit comments