Subversion Repositories HelenOS

Rev

Rev 295 | Rev 483 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 295 Rev 296
Line 42... Line 42...
42
#define ATTEMPTS        5
42
#define ATTEMPTS        5
43
 
43
 
44
static volatile int threads_ok;
44
static volatile int threads_ok;
45
static waitq_t can_start;
45
static waitq_t can_start;
46
 
46
 
47
static void testit(void *data)
47
static void testit1(void *data)
48
{
48
{
49
    int i;
49
    int i;
50
    volatile long long j;
50
    volatile long long j;
51
    double e,d,le,f;
51
    double e,d,le,f;
52
    int arg __attribute__((aligned(16))) = (int)((__native) data);
52
    int arg __attribute__((aligned(16))) = (int)((__native) data);
Line 72... Line 72...
72
    }
72
    }
73
 
73
 
74
    atomic_inc(&threads_ok);
74
    atomic_inc(&threads_ok);
75
}
75
}
76
 
76
 
-
 
77
static void testit2(void *data)
-
 
78
{
-
 
79
    int i;
-
 
80
    volatile long long j;
-
 
81
    double e,d,le,f;
-
 
82
    int arg __attribute__((aligned(16))) = (int)((__native) data);
-
 
83
    int after_arg __attribute__((aligned(16)));
-
 
84
   
-
 
85
    waitq_sleep(&can_start);
-
 
86
 
-
 
87
    for (i = 0; i<ATTEMPTS; i++) {
-
 
88
        __asm__ volatile (
-
 
89
            "movlpd %0, %%xmm2"
-
 
90
            :"=m"(arg)
-
 
91
            );
-
 
92
 
-
 
93
        scheduler();
-
 
94
        __asm__ volatile (
-
 
95
            "movlpd %%xmm2, %0"
-
 
96
            :"=m"(after_arg)
-
 
97
            );
-
 
98
       
-
 
99
        if(arg != after_arg)
-
 
100
            panic("tid%d: arg(%d) != %d\n",
-
 
101
                  THREAD->tid, arg, after_arg);
-
 
102
    }
-
 
103
 
-
 
104
    atomic_inc(&threads_ok);
-
 
105
}
-
 
106
 
77
 
107
 
78
void test(void)
108
void test(void)
79
{
109
{
80
    thread_t *t;
110
    thread_t *t;
81
    int i;
111
    int i;
Line 83... Line 113...
83
    waitq_initialize(&can_start);
113
    waitq_initialize(&can_start);
84
 
114
 
85
    printf("SSE test #1\n");
115
    printf("SSE test #1\n");
86
    printf("Creating %d threads... ", THREADS);
116
    printf("Creating %d threads... ", THREADS);
87
 
117
 
88
    for (i=0; i<THREADS; i++) {  
118
    for (i=0; i<THREADS/2; i++) {  
89
        if (!(t = thread_create(testit, (void *)((__native)i), TASK, 0)))
119
        if (!(t = thread_create(testit1, (void *)((__native)i*2), TASK, 0)))
-
 
120
            panic("could not create thread\n");
-
 
121
        thread_ready(t);
-
 
122
        if (!(t = thread_create(testit2, (void *)((__native)i*2+1), TASK, 0)))
90
            panic("could not create thread\n");
123
            panic("could not create thread\n");
91
        thread_ready(t);
124
        thread_ready(t);
92
    }
125
    }
-
 
126
 
93
    printf("ok\n");
127
    printf("ok\n");
94
   
128
   
95
    thread_sleep(1);
129
    thread_sleep(1);
96
    waitq_wakeup(&can_start, WAKEUP_ALL);
130
    waitq_wakeup(&can_start, WAKEUP_ALL);
97
 
131