Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
9974107a
Commit
9974107a
authored
Oct 05, 2011
by
Richard Henderson
Committed by
Richard Henderson
Oct 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vect-shuffle-* test cases.
From-SVN: r179566
parent
ed378230
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
475 additions
and
207 deletions
+475
-207
gcc/testsuite/ChangeLog
+11
-0
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-1.c
+59
-37
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-2.c
+59
-35
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-3.c
+54
-32
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-4.c
+48
-47
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-5.c
+55
-56
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-6.c
+64
-0
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-7.c
+70
-0
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-8.c
+55
-0
No files found.
gcc/testsuite/ChangeLog
View file @
9974107a
2011-10-05 Richard Henderson <rth@redhat.com>
* gcc.c-torture/execute/vect-shuffle-1.c: Rewrite.
* gcc.c-torture/execute/vect-shuffle-2.c: Rewrite.
* gcc.c-torture/execute/vect-shuffle-3.c: Rewrite.
* gcc.c-torture/execute/vect-shuffle-4.c: Rewrite.
* gcc.c-torture/execute/vect-shuffle-5.c: Rewrite.
* gcc.c-torture/execute/vect-shuffle-6.c: New test.
* gcc.c-torture/execute/vect-shuffle-7.c: New test.
* gcc.c-torture/execute/vect-shuffle-8.c: New test.
2011-10-05 Uros Bizjak <ubizjak@gmail.com>
2011-10-05 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/vect/vect.exp (VEC_CFLAGS): Move initialization after
* gcc.dg/vect/vect.exp (VEC_CFLAGS): Move initialization after
...
...
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-1.c
View file @
9974107a
#
define vector(elcount, type) \
#
if __SIZEOF_INT__ == 4
__attribute__((vector_size((elcount)*sizeof(type)))) type
typedef
unsigned
int
V
__attribute__
((
vector_size
(
16
),
may_alias
));
#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
struct
S
{
V
in
,
mask
,
out
;
};
#define shufcompare(type, count, vres, v0, mask) \
struct
S
tests
[]
=
{
do { \
{
int __i; \
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
for (__i = 0; __i < count; __i++) { \
{
0
,
1
,
2
,
3
},
if (vidx(type, vres, __i) != vidx(type, v0, vidx(type, mask, __i))) \
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
__builtin_abort (); \
},
} \
{
} while (0)
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0
+
1
*
4
,
1
+
2
*
4
,
2
+
3
*
4
,
3
+
4
*
4
},
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
3
,
2
,
1
,
0
},
{
0x44444444
,
0x33333333
,
0x22222222
,
0x11111111
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0
,
3
,
2
,
1
},
{
0x11111111
,
0x44444444
,
0x33333333
,
0x22222222
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0
,
2
,
1
,
3
},
{
0x11111111
,
0x33333333
,
0x22222222
,
0x44444444
},
},
{
{
0x11223344
,
0x55667788
,
0x99aabbcc
,
0xddeeff00
},
{
3
,
1
,
2
,
0
},
{
0xddeeff00
,
0x55667788
,
0x99aabbcc
,
0x11223344
},
},
{
{
0x11223344
,
0x55667788
,
0x99aabbcc
,
0xddeeff00
},
{
0
,
0
,
0
,
0
},
{
0x11223344
,
0x11223344
,
0x11223344
,
0x11223344
},
},
{
{
0x11223344
,
0x55667788
,
0x99aabbcc
,
0xddeeff00
},
{
1
,
2
,
1
,
2
},
{
0x55667788
,
0x99aabbcc
,
0x55667788
,
0x99aabbcc
},
}
};
extern
void
abort
(
void
);
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
()
/*vector (8, short) v0 = {argc, 1,2,3,4,5,6,7};
{
vector (8, short) v1 = {argc, 1,argc,3,4,5,argc,7};
int
i
;
vector (8, short) v2;
vector (8, short) smask = {0,0,1,2,3,4,5,6};
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
v2 = __builtin_shuffle (v0, smask);
V
r
=
__builtin_shuffle
(
tests
[
i
].
in
,
tests
[
i
].
mask
);
shufcompare (short, 8, v2, v0, smask);
if
(
__builtin_memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
v2 = __builtin_shuffle (v0, v1);
abort
();
shufcompare (short, 8, v2, v0, v1);
}
v2 = __builtin_shuffle (smask, v0);
shufcompare (short, 8, v2, smask, v0);*/
vector
(
4
,
int
)
i0
=
{
argc
,
1
,
2
,
3
};
vector
(
4
,
int
)
i1
=
{
argc
,
1
,
argc
,
3
};
vector
(
4
,
int
)
i2
;
vector
(
4
,
int
)
imask
=
{
0
,
3
,
2
,
1
};
/*i2 = __builtin_shuffle (i0, imask);
shufcompare (int, 4, i2, i0, imask);*/
i2
=
__builtin_shuffle
(
i0
,
i1
);
shufcompare
(
int
,
4
,
i2
,
i0
,
i1
);
i2
=
__builtin_shuffle
(
imask
,
i0
);
shufcompare
(
int
,
4
,
i2
,
imask
,
i0
);
return
0
;
return
0
;
}
}
#endif
/* SIZEOF_INT */
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-2.c
View file @
9974107a
#
define vector(elcount, type) \
#
if __SIZEOF_SHORT__ == 2
__attribute__((vector_size((elcount)*sizeof(type)))) type
typedef
unsigned
short
V
__attribute__
((
vector_size
(
16
),
may_alias
));
#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
struct
S
{
V
in
,
mask
,
out
;
};
#define shuf2compare(type, count, vres, v0, v1, mask) \
struct
S
tests
[]
=
{
do { \
{
int __i; \
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
for (__i = 0; __i < count; __i++) { \
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
},
if (vidx(type, vres, __i) != ((vidx(type, mask, __i) < count) ? \
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
vidx(type, v0, vidx(type, mask, __i)) : \
},
vidx(type, v1, (vidx(type, mask, __i) - count)))) \
{
__builtin_abort (); \
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
} \
{
0x10
,
0x21
,
0x32
,
0x43
,
0x54
,
0x65
,
0x76
,
0x87
},
} while (0)
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
},
{
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
{
7
,
6
,
5
,
4
,
3
,
2
,
1
,
0
},
{
0x8888
,
0x7777
,
0x6666
,
0x5555
,
0x4444
,
0x3333
,
0x2222
,
0x1111
},
},
{
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
{
7
,
0
,
5
,
3
,
2
,
4
,
1
,
6
},
{
0x8888
,
0x1111
,
0x6666
,
0x4444
,
0x3333
,
0x5555
,
0x2222
,
0x7777
},
},
{
{
0x1111
,
0x2222
,
0x3333
,
0x4444
,
0x5555
,
0x6666
,
0x7777
,
0x8888
},
{
0
,
2
,
1
,
3
,
4
,
6
,
5
,
7
},
{
0x1111
,
0x3333
,
0x2222
,
0x4444
,
0x5555
,
0x7777
,
0x6666
,
0x8888
},
},
{
{
0x1122
,
0x3344
,
0x5566
,
0x7788
,
0x99aa
,
0xbbcc
,
0xddee
,
0xff00
},
{
3
,
1
,
2
,
0
,
7
,
5
,
6
,
4
},
{
0x7788
,
0x3344
,
0x5566
,
0x1122
,
0xff00
,
0xbbcc
,
0xddee
,
0x99aa
},
},
{
{
0x1122
,
0x3344
,
0x5566
,
0x7788
,
0x99aa
,
0xbbcc
,
0xddee
,
0xff00
},
{
0
,
0
,
0
,
0
},
{
0x1122
,
0x1122
,
0x1122
,
0x1122
,
0x1122
,
0x1122
,
0x1122
,
0x1122
},
},
{
{
0x1122
,
0x3344
,
0x5566
,
0x7788
,
0x99aa
,
0xbbcc
,
0xddee
,
0xff00
},
{
1
,
6
,
1
,
6
,
1
,
6
,
1
,
6
},
{
0x3344
,
0xddee
,
0x3344
,
0xddee
,
0x3344
,
0xddee
,
0x3344
,
0xddee
},
}
};
extern
void
abort
(
void
);
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
()
vector
(
8
,
short
)
v0
=
{
5
,
5
,
5
,
5
,
5
,
5
,
argc
,
7
};
{
vector
(
8
,
short
)
v1
=
{
argc
,
1
,
8
,
8
,
4
,
9
,
argc
,
4
};
int
i
;
vector
(
8
,
short
)
v2
;
//vector (8, short) mask = {1,2,5,4,3,6,7};
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
vector
(
8
,
short
)
mask0
=
{
0
,
2
,
3
,
1
,
4
,
5
,
6
,
7
};
V
r
=
__builtin_shuffle
(
tests
[
i
].
in
,
tests
[
i
].
mask
);
vector
(
8
,
short
)
mask1
=
{
0
,
12
,
3
,
4
,
3
,
0
,
10
,
9
};
if
(
memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
vector
(
8
,
short
)
mask2
=
{
0
,
8
,
1
,
9
,
2
,
10
,
3
,
11
};
}
v2
=
__builtin_shuffle
(
v0
,
v1
,
mask0
);
shuf2compare
(
short
,
8
,
v2
,
v0
,
v1
,
mask0
);
v2
=
__builtin_shuffle
(
v0
,
v1
,
mask1
);
shuf2compare
(
short
,
8
,
v2
,
v0
,
v1
,
mask1
);
v2
=
__builtin_shuffle
(
v0
,
v1
,
mask2
);
shuf2compare
(
short
,
8
,
v2
,
v0
,
v1
,
mask2
);
v2
=
__builtin_shuffle
(
mask0
,
mask0
,
v0
);
shuf2compare
(
short
,
8
,
v2
,
mask0
,
mask0
,
v0
);
return
0
;
return
0
;
}
}
#endif
/* SIZEOF_SHORT */
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-3.c
View file @
9974107a
#define vector(elcount, type) \
#if __SIZEOF_LONG_LONG__ == 8
__attribute__((vector_size((elcount)*sizeof(type)))) type
typedef
unsigned
long
long
V
__attribute__
((
vector_size
(
16
),
may_alias
));
#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
struct
S
{
#define shufcompare(type, count, vres, v0, mask) \
V
in
,
mask
,
out
;
do { \
};
int __i; \
for (__i = 0; __i < count; __i++) { \
struct
S
tests
[]
=
{
if (vidx(type, vres, __i) != vidx(type, v0, vidx(type, mask, __i))) \
{
__builtin_abort (); \
{
0x1111111111111111
,
0x2222222222222222
},
} \
{
0
,
1
},
} while (0)
{
0x1111111111111111
,
0x2222222222222222
},
},
vector
(
8
,
short
)
__attribute__
((
noinline
))
{
f
(
vector
(
8
,
short
)
x
,
vector
(
8
,
short
)
mask
)
{
{
0x1111111111111111
,
0x2222222222222222
},
return
__builtin_shuffle
(
x
,
mask
);
{
0x0102030405060700
,
0xffeeddccbbaa99f1
},
}
{
0x1111111111111111
,
0x2222222222222222
},
},
{
int
main
(
int
argc
,
char
*
argv
[])
{
{
0x1111111111111111
,
0x2222222222222222
},
vector
(
8
,
short
)
v0
=
{
argc
,
1
,
2
,
3
,
4
,
5
,
6
,
7
};
{
1
,
0
},
vector
(
8
,
short
)
v1
=
{
argc
,
1
,
argc
,
3
,
4
,
5
,
argc
,
7
};
{
0x2222222222222222
,
0x1111111111111111
},
vector
(
8
,
short
)
v2
;
},
{
vector
(
8
,
short
)
mask
=
{
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
};
{
0x1111111111111111
,
0x2222222222222222
},
{
0
,
0
},
v2
=
f
(
v0
,
mask
);
{
0x1111111111111111
,
0x1111111111111111
},
shufcompare
(
short
,
8
,
v2
,
v0
,
mask
);
},
{
v2
=
f
(
v0
,
v1
);
{
0x1122334455667788
,
0x99aabbccddeeff00
},
shufcompare
(
short
,
8
,
v2
,
v0
,
v1
);
{
1
,
1
},
{
0x99aabbccddeeff00
,
0x99aabbccddeeff00
},
},
{
{
0x1122334455667788
,
0x99aabbccddeeff00
},
{
1
,
0
},
{
0x99aabbccddeeff00
,
0x1122334455667788
},
},
};
extern
void
abort
(
void
);
int
main
()
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
V
r
=
__builtin_shuffle
(
tests
[
i
].
in
,
tests
[
i
].
mask
);
if
(
__builtin_memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
}
return
0
;
return
0
;
}
}
#endif
/* SIZEOF_LONG_LONG */
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-4.c
View file @
9974107a
#define vector(elcount, type) \
typedef
unsigned
char
V
__attribute__
((
vector_size
(
16
),
may_alias
));
__attribute__((vector_size((elcount)*sizeof(type)))) type
struct
S
#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
{
V
in
,
mask
,
out
;
#define shuf2compare(type, count, vres, v0, v1, mask) \
};
do { \
int __i; \
struct
S
tests
[]
=
{
for (__i = 0; __i < count; __i++) { \
{
if (vidx(type, vres, __i) != ((vidx(type, mask, __i) < count) ? \
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
vidx(type, v0, vidx(type, mask, __i)) : \
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
},
vidx(type, v1, (vidx(type, mask, __i) - count)))) \
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
__builtin_abort (); \
},
} \
{
} while (0)
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
{
0x10
,
0x21
,
0x32
,
0x43
,
0x54
,
0x65
,
0x76
,
0x87
,
0x98
,
0xa9
,
0xba
,
0xcb
,
0xdc
,
0xed
,
0xfe
,
0xff
},
vector
(
8
,
short
)
__attribute__
((
noinline
))
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
f
(
vector
(
8
,
short
)
x
,
vector
(
8
,
short
)
y
,
vector
(
8
,
short
)
mask
)
{
},
return
__builtin_shuffle
(
x
,
y
,
mask
);
{
}
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
{
15
,
14
,
13
,
12
,
11
,
10
,
9
,
8
,
7
,
6
,
5
,
4
,
3
,
2
,
1
,
0
},
{
16
,
15
,
14
,
13
,
12
,
11
,
10
,
9
,
8
,
7
,
6
,
5
,
4
,
3
,
2
,
1
},
},
int
main
(
int
argc
,
char
*
argv
[])
{
{
vector
(
8
,
short
)
v0
=
{
argc
,
1
,
2
,
3
,
4
,
5
,
6
,
7
};
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
vector
(
8
,
short
)
v1
=
{
argc
,
1
,
argc
,
3
,
4
,
5
,
argc
,
7
};
{
0
,
2
,
4
,
6
,
8
,
10
,
12
,
14
,
1
,
3
,
5
,
7
,
9
,
11
,
13
,
15
},
vector
(
8
,
short
)
v2
;
{
1
,
3
,
5
,
7
,
9
,
11
,
13
,
15
,
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
},
},
//vector (8, short) mask = {1,2,5,4,3,6,7};
{
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
},
vector
(
8
,
short
)
mask0
=
{
0
,
2
,
3
,
1
,
4
,
5
,
6
,
7
};
{
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
},
vector
(
8
,
short
)
mask1
=
{
0
,
12
,
3
,
4
,
3
,
0
,
10
,
9
};
{
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
},
vector
(
8
,
short
)
mask2
=
{
0
,
8
,
1
,
9
,
2
,
10
,
3
,
11
};
},
};
v2
=
f
(
v0
,
v1
,
mask0
);
shuf2compare
(
short
,
8
,
v2
,
v0
,
v1
,
mask0
);
extern
void
abort
(
void
);
v2
=
f
(
v0
,
v1
,
mask1
);
int
main
()
shuf2compare
(
short
,
8
,
v2
,
v0
,
v1
,
mask1
);
{
int
i
;
v2
=
f
(
v0
,
v1
,
mask2
);
shuf2compare
(
short
,
8
,
v2
,
v0
,
v1
,
mask2
);
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
v2
=
f
(
mask0
,
mask0
,
v0
);
V
r
=
__builtin_shuffle
(
tests
[
i
].
in
,
tests
[
i
].
mask
);
shuf2compare
(
short
,
8
,
v2
,
mask0
,
mask0
,
v0
);
if
(
memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
}
return
0
;
return
0
;
}
}
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-5.c
View file @
9974107a
/* Test that different type variants are compatible within
#if __SIZEOF_INT__ == 4
vector shuffling. */
typedef
unsigned
int
V
__attribute__
((
vector_size
(
16
),
may_alias
));
#define vector(elcount, type) \
struct
S
__attribute__((vector_size((elcount)*sizeof(type)))) type
{
V
in1
,
in2
,
mask
,
out
;
};
#define shufcompare(count, vres, v0, mask) \
struct
S
tests
[]
=
{
do { \
{
int __i; \
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
for (__i = 0; __i < count; __i++) { \
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
if (vres[__i] != v0[mask[__i]]) \
{
0
,
1
,
2
,
3
},
__builtin_abort (); \
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
} \
},
} while (0)
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
{
4
,
5
,
6
,
7
},
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
{
0
,
4
,
1
,
5
},
{
0x11111111
,
0x55555555
,
0x22222222
,
0x66666666
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
{
0
,
7
,
4
,
3
},
{
0x11111111
,
0x88888888
,
0x55555555
,
0x44444444
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
{
0
,
0
,
0
,
0
},
{
0x11111111
,
0x11111111
,
0x11111111
,
0x11111111
},
},
{
{
0x11111111
,
0x22222222
,
0x33333333
,
0x44444444
},
{
0x55555555
,
0x66666666
,
0x77777777
,
0x88888888
},
{
7
,
7
,
7
,
7
},
{
0x88888888
,
0x88888888
,
0x88888888
,
0x88888888
},
},
};
#define test_compat_mask(res, vec, mask) \
extern
void
abort
(
void
);
res = __builtin_shuffle (vec, mask); \
shufcompare(4, res, vec, mask); \
res = __builtin_shuffle (vec, c ## mask); \
shufcompare(4, res, vec, c ## mask); \
res = __builtin_shuffle (vec, r ## mask); \
shufcompare(4, res, vec, r ## mask); \
res = __builtin_shuffle (vec, d ## mask); \
shufcompare(4, res, vec, d ## mask); \
res = __builtin_shuffle (vec, dc ## mask); \
shufcompare(4, res, vec, dc ## mask); \
#define test_compat_vec(res, vec, mask) \
int
main
()
test_compat_mask (res, vec, mask); \
{
test_compat_mask (res, c ## vec, mask); \
int
i
;
test_compat_mask (res, r ## vec, mask); \
test_compat_mask (res, d ## vec, mask); \
test_compat_mask (res, dc ## vec, mask);
#define test_compat(res, vec, mask) \
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
test_compat_vec (res, vec, mask); \
{
test_compat_vec (d ## res, vec, mask); \
V
r
=
__builtin_shuffle
(
tests
[
i
].
in1
,
tests
[
i
].
in2
,
tests
[
i
].
mask
);
test_compat_vec (r ## res, vec, mask);
if
(
__builtin_memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
typedef
vector
(
4
,
int
)
v4si
;
}
typedef
const
vector
(
4
,
int
)
v4sicst
;
int
main
(
int
argc
,
char
*
argv
[])
{
vector
(
4
,
int
)
vec
=
{
argc
,
1
,
2
,
3
};
const
vector
(
4
,
int
)
cvec
=
{
argc
,
1
,
2
,
3
};
register
vector
(
4
,
int
)
rvec
=
{
argc
,
1
,
2
,
3
};
v4si
dvec
=
{
argc
,
1
,
2
,
3
};
v4sicst
dcvec
=
{
argc
,
1
,
2
,
3
};
vector
(
4
,
int
)
res
;
v4si
dres
;
register
vector
(
4
,
int
)
rres
;
vector
(
4
,
int
)
mask
=
{
0
,
3
,
2
,
1
};
const
vector
(
4
,
int
)
cmask
=
{
0
,
3
,
2
,
1
};
register
vector
(
4
,
int
)
rmask
=
{
0
,
3
,
2
,
1
};
v4si
dmask
=
{
0
,
3
,
2
,
1
};
v4sicst
dcmask
=
{
0
,
3
,
2
,
1
};
test_compat
(
res
,
vec
,
mask
);
return
0
;
return
0
;
}
}
#endif
/* SIZEOF_INT */
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-6.c
0 → 100644
View file @
9974107a
#if __SIZEOF_SHORT__ == 2
typedef
unsigned
short
V
__attribute__
((
vector_size
(
16
),
may_alias
));
struct
S
{
V
in1
,
in2
,
mask
,
out
;
};
struct
S
tests
[]
=
{
{
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
},
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
},
{
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
{
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
},
{
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
{
0
,
8
,
1
,
9
,
2
,
10
,
3
,
11
},
{
0x1010
,
0x9898
,
0x2121
,
0xa9a9
,
0x3232
,
0xbaba
,
0x4343
,
0xcbcb
},
},
{
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
{
0
,
15
,
4
,
11
,
12
,
3
,
7
,
8
},
{
0x1010
,
0x0f0f
,
0x5454
,
0xcbcb
,
0xdcdc
,
0x4343
,
0x8787
,
0x9898
},
},
{
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0x1010
,
0x1010
,
0x1010
,
0x1010
,
0x1010
,
0x1010
,
0x1010
,
0x1010
},
},
{
{
0x1010
,
0x2121
,
0x3232
,
0x4343
,
0x5454
,
0x6565
,
0x7676
,
0x8787
},
{
0x9898
,
0xa9a9
,
0xbaba
,
0xcbcb
,
0xdcdc
,
0xeded
,
0xfefe
,
0x0f0f
},
{
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
},
{
0xfefe
,
0xfefe
,
0xfefe
,
0xfefe
,
0xfefe
,
0xfefe
,
0xfefe
,
0xfefe
},
},
};
extern
void
abort
(
void
);
int
main
()
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
V
r
=
__builtin_shuffle
(
tests
[
i
].
in1
,
tests
[
i
].
in2
,
tests
[
i
].
mask
);
if
(
__builtin_memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
}
return
0
;
}
#endif
/* SIZEOF_SHORT */
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-7.c
0 → 100644
View file @
9974107a
#if __SIZEOF_LONG_LONG__ == 8
typedef
unsigned
long
long
V
__attribute__
((
vector_size
(
16
),
may_alias
));
struct
S
{
V
in1
,
in2
,
mask
,
out
;
};
struct
S
tests
[]
=
{
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
0
,
1
},
{
0x1112131415161718
,
0x2122232425262728
},
},
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
2
,
3
},
{
0x3132333435363738
,
0x4142434445464748
},
},
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
0
,
2
},
{
0x1112131415161718
,
0x3132333435363738
},
},
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
2
,
1
},
{
0x3132333435363738
,
0x2122232425262728
},
},
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
3
,
0
},
{
0x4142434445464748
,
0x1112131415161718
},
},
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
0
,
0
},
{
0x1112131415161718
,
0x1112131415161718
},
},
{
{
0x1112131415161718
,
0x2122232425262728
},
{
0x3132333435363738
,
0x4142434445464748
},
{
3
,
3
},
{
0x4142434445464748
,
0x4142434445464748
},
},
};
extern
void
abort
(
void
);
int
main
()
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
V
r
=
__builtin_shuffle
(
tests
[
i
].
in1
,
tests
[
i
].
in2
,
tests
[
i
].
mask
);
if
(
__builtin_memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
}
return
0
;
}
#endif
/* SIZEOF_LONG_LONG */
gcc/testsuite/gcc.c-torture/execute/vect-shuffle-8.c
0 → 100644
View file @
9974107a
typedef
unsigned
char
V
__attribute__
((
vector_size
(
16
),
may_alias
));
struct
S
{
V
in1
,
in2
,
mask
,
out
;
};
struct
S
tests
[]
=
{
{
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
},
{
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
},
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
},
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
},
},
{
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
},
{
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
},
{
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
31
},
{
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
},
},
{
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
},
{
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
},
{
7
,
6
,
5
,
4
,
16
,
17
,
18
,
19
,
31
,
30
,
29
,
28
,
3
,
2
,
1
,
0
},
{
17
,
16
,
15
,
14
,
30
,
31
,
32
,
33
,
45
,
44
,
43
,
42
,
13
,
12
,
11
,
10
},
},
{
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
},
{
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
},
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
},
{
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
},
},
{
{
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
},
{
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
},
{
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
},
{
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
,
45
},
},
};
extern
void
abort
(
void
);
int
main
()
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
++
i
)
{
V
r
=
__builtin_shuffle
(
tests
[
i
].
in1
,
tests
[
i
].
in2
,
tests
[
i
].
mask
);
if
(
__builtin_memcmp
(
&
r
,
&
tests
[
i
].
out
,
sizeof
(
V
))
!=
0
)
abort
();
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment