Rev 2050 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2050 | Rev 2051 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | #define ATTEMPTS 5 |
43 | #define ATTEMPTS 5 |
| 44 | 44 | ||
| 45 | static atomic_t threads_ok; |
45 | static atomic_t threads_ok; |
| 46 | static atomic_t threads_fault; |
46 | static atomic_t threads_fault; |
| 47 | static waitq_t can_start; |
47 | static waitq_t can_start; |
| - | 48 | static bool sh_quiet; |
|
| - | 49 | ||
| 48 | 50 | ||
| 49 | static void testit1(void *data) |
51 | static void testit1(void *data) |
| 50 | { |
52 | { |
| 51 | int i; |
53 | int i; |
| 52 | int arg __attribute__((aligned(16))) = (int) ((unative_t) data); |
54 | int arg __attribute__((aligned(16))) = (int) ((unative_t) data); |
| Line 67... | Line 69... | ||
| 67 | "movlpd %%xmm2, %0\n" |
69 | "movlpd %%xmm2, %0\n" |
| 68 | : "=m" (after_arg) |
70 | : "=m" (after_arg) |
| 69 | ); |
71 | ); |
| 70 | 72 | ||
| 71 | if (arg != after_arg) { |
73 | if (arg != after_arg) { |
| - | 74 | if (!sh_quiet) |
|
| 72 | printf("tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
75 | printf("tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
| 73 | atomic_inc(&threads_fault); |
76 | atomic_inc(&threads_fault); |
| 74 | break; |
77 | break; |
| 75 | } |
78 | } |
| 76 | } |
79 | } |
| 77 | atomic_inc(&threads_ok); |
80 | atomic_inc(&threads_ok); |
| Line 98... | Line 101... | ||
| 98 | "movlpd %%xmm2, %0\n" |
101 | "movlpd %%xmm2, %0\n" |
| 99 | : "=m" (after_arg) |
102 | : "=m" (after_arg) |
| 100 | ); |
103 | ); |
| 101 | 104 | ||
| 102 | if (arg != after_arg) { |
105 | if (arg != after_arg) { |
| - | 106 | if (!sh_quiet) |
|
| 103 | printf("tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
107 | printf("tid%d: arg(%d) != %d\n", THREAD->tid, arg, after_arg); |
| 104 | atomic_inc(&threads_fault); |
108 | atomic_inc(&threads_fault); |
| 105 | break; |
109 | break; |
| 106 | } |
110 | } |
| 107 | } |
111 | } |
| 108 | atomic_inc(&threads_ok); |
112 | atomic_inc(&threads_ok); |
| Line 110... | Line 114... | ||
| 110 | 114 | ||
| 111 | 115 | ||
| 112 | char * test_sse1(bool quiet) |
116 | char * test_sse1(bool quiet) |
| 113 | { |
117 | { |
| 114 | unsigned int i, total = 0; |
118 | unsigned int i, total = 0; |
| - | 119 | sh_quiet = quiet; |
|
| 115 | 120 | ||
| 116 | waitq_initialize(&can_start); |
121 | waitq_initialize(&can_start); |
| 117 | atomic_set(&threads_ok, 0); |
122 | atomic_set(&threads_ok, 0); |
| 118 | atomic_set(&threads_fault, 0); |
123 | atomic_set(&threads_fault, 0); |
| - | 124 | ||
| - | 125 | if (!quiet) |
|
| 119 | printf("Creating %d threads... ", 2 * THREADS); |
126 | printf("Creating %d threads... ", 2 * THREADS); |
| 120 | 127 | ||
| 121 | for (i = 0; i < THREADS; i++) { |
128 | for (i = 0; i < THREADS; i++) { |
| 122 | thread_t *t; |
129 | thread_t *t; |
| 123 | 130 | ||
| 124 | if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
131 | if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) { |
| - | 132 | if (!quiet) |
|
| 125 | printf("could not create thread %d\n", 2 * i); |
133 | printf("could not create thread %d\n", 2 * i); |
| 126 | break; |
134 | break; |
| 127 | } |
135 | } |
| 128 | thread_ready(t); |
136 | thread_ready(t); |
| 129 | total++; |
137 | total++; |
| 130 | 138 | ||
| 131 | if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) { |
139 | if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) { |
| - | 140 | if (!quiet) |
|
| 132 | printf("could not create thread %d\n", 2 * i + 1); |
141 | printf("could not create thread %d\n", 2 * i + 1); |
| 133 | break; |
142 | break; |
| 134 | } |
143 | } |
| 135 | thread_ready(t); |
144 | thread_ready(t); |
| 136 | total++; |
145 | total++; |
| 137 | } |
146 | } |
| - | 147 | ||
| - | 148 | if (!quiet) |
|
| 138 | printf("ok\n"); |
149 | printf("ok\n"); |
| 139 | 150 | ||
| 140 | thread_sleep(1); |
151 | thread_sleep(1); |
| 141 | waitq_wakeup(&can_start, WAKEUP_ALL); |
152 | waitq_wakeup(&can_start, WAKEUP_ALL); |
| 142 | 153 | ||
| 143 | while (atomic_get(&threads_ok) != total) { |
154 | while (atomic_get(&threads_ok) != total) { |
| - | 155 | if (!quiet) |
|
| 144 | printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
156 | printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
| 145 | thread_sleep(1); |
157 | thread_sleep(1); |
| 146 | } |
158 | } |
| 147 | 159 | ||
| 148 | if (atomic_get(&threads_fault) == 0) |
160 | if (atomic_get(&threads_fault) == 0) |
| 149 | return NULL; |
161 | return NULL; |