Commit 84e77783 by Carl Love Committed by Carl Love

vsx.md (define_expand xl_len_r, [...]): Add match_dup argument.

gcc/ChangeLog:

2018-01-17 Carl Love  <cel@us.ibm.com>
	* config/rs6000/vsx.md (define_expand xl_len_r,
	define_expand stxvl, define_expand *stxvl): Add match_dup argument.
	(define_insn): Add, match_dup 1 argument to define_insn stxvll and
	lxvll.
	(define_expand, define_insn): Move the shift left from	the
	define_insn to the define_expand for lxvl and stxvl instructions.
	* config/rs6000/rs6000-builtin.def (BU_P9V_64BIT_VSX_2): Change LXVL
	and XL_LEN_R definitions to PURE.

gcc/testsuite/ChangeLog:

2018-01-17  Carl Love  <cel@us.ibm.com>
	* gcc.target/powerpc/builtins-6-p9-runnable.c: Add additional tests.
	Add debug print statements.
	* gcc.target/powerpc/builtins-5-p9-runnable.c: Add test to do
	16 byte vector load followed by a partial vector load.

From-SVN: r256798
parent a6574dbe
2018-01-17 Carl Love <cel@us.ibm.com>
* config/rs6000/vsx.md (define_expand xl_len_r,
define_expand stxvl, define_expand *stxvl): Add match_dup argument.
(define_insn): Add, match_dup 1 argument to define_insn stxvll and
lxvll.
(define_expand, define_insn): Move the shift left from the
define_insn to the define_expand for lxvl and stxvl instructions.
* config/rs6000/rs6000-builtin.def (BU_P9V_64BIT_VSX_2): Change LXVL
and XL_LEN_R definitions to PURE.
2018-01-17 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (indirect_thunk_name): Declare regno
......
......@@ -2212,8 +2212,8 @@ BU_P9V_OVERLOAD_2 (VIEDP, "insert_exp_dp")
BU_P9V_OVERLOAD_2 (VIESP, "insert_exp_sp")
/* 2 argument vector functions added in ISA 3.0 (power9). */
BU_P9V_64BIT_VSX_2 (LXVL, "lxvl", CONST, lxvl)
BU_P9V_64BIT_VSX_2 (XL_LEN_R, "xl_len_r", CONST, xl_len_r)
BU_P9V_64BIT_VSX_2 (LXVL, "lxvl", PURE, lxvl)
BU_P9V_64BIT_VSX_2 (XL_LEN_R, "xl_len_r", PURE, xl_len_r)
BU_P9V_AV_2 (VEXTUBLX, "vextublx", CONST, vextublx)
BU_P9V_AV_2 (VEXTUBRX, "vextubrx", CONST, vextubrx)
......
......@@ -4859,10 +4859,12 @@
;; Load VSX Vector with Length
(define_expand "lxvl"
[(set (match_dup 3)
(match_operand:DI 2 "register_operand"))
(ashift:DI (match_operand:DI 2 "register_operand")
(const_int 56)))
(set (match_operand:V16QI 0 "vsx_register_operand")
(unspec:V16QI
[(match_operand:DI 1 "gpc_reg_operand")
(mem:V16QI (match_dup 1))
(match_dup 3)]
UNSPEC_LXVL))]
"TARGET_P9_VECTOR && TARGET_64BIT"
......@@ -4874,16 +4876,17 @@
[(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
(unspec:V16QI
[(match_operand:DI 1 "gpc_reg_operand" "b")
(match_operand:DI 2 "register_operand" "+r")]
(mem:V16QI (match_dup 1))
(match_operand:DI 2 "register_operand" "r")]
UNSPEC_LXVL))]
"TARGET_P9_VECTOR && TARGET_64BIT"
"sldi %2,%2, 56\; lxvl %x0,%1,%2"
[(set_attr "length" "8")
(set_attr "type" "vecload")])
"lxvl %x0,%1,%2"
[(set_attr "type" "vecload")])
(define_insn "lxvll"
[(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
(unspec:V16QI [(match_operand:DI 1 "gpc_reg_operand" "b")
(mem:V16QI (match_dup 1))
(match_operand:DI 2 "register_operand" "r")]
UNSPEC_LXVLL))]
"TARGET_P9_VECTOR"
......@@ -4912,6 +4915,7 @@
(define_insn "stxvll"
[(set (mem:V16QI (match_operand:DI 1 "gpc_reg_operand" "b"))
(unspec:V16QI [(match_operand:V16QI 0 "vsx_register_operand" "wa")
(mem:V16QI (match_dup 1))
(match_operand:DI 2 "register_operand" "r")]
UNSPEC_STXVLL))]
"TARGET_P9_VECTOR"
......@@ -4921,10 +4925,12 @@
;; Store VSX Vector with Length
(define_expand "stxvl"
[(set (match_dup 3)
(match_operand:DI 2 "register_operand"))
(ashift:DI (match_operand:DI 2 "register_operand")
(const_int 56)))
(set (mem:V16QI (match_operand:DI 1 "gpc_reg_operand"))
(unspec:V16QI
[(match_operand:V16QI 0 "vsx_register_operand")
(mem:V16QI (match_dup 1))
(match_dup 3)]
UNSPEC_STXVL))]
"TARGET_P9_VECTOR && TARGET_64BIT"
......@@ -4936,12 +4942,12 @@
[(set (mem:V16QI (match_operand:DI 1 "gpc_reg_operand" "b"))
(unspec:V16QI
[(match_operand:V16QI 0 "vsx_register_operand" "wa")
(match_operand:DI 2 "register_operand" "+r")]
(mem:V16QI (match_dup 1))
(match_operand:DI 2 "register_operand" "r")]
UNSPEC_STXVL))]
"TARGET_P9_VECTOR && TARGET_64BIT"
"sldi %2,%2,56\;stxvl %x0,%1,%2"
[(set_attr "length" "8")
(set_attr "type" "vecstore")])
"stxvl %x0,%1,%2"
[(set_attr "type" "vecstore")])
;; Expand for builtin xst_len_r
(define_expand "xst_len_r"
......
2018-01-17 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-6-p9-runnable.c: Add additional tests.
Add debug print statements.
* gcc.target/powerpc/builtins-5-p9-runnable.c: Add test to do
16 byte vector load followed by a partial vector load.
2018-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/83799
......
......@@ -36,8 +36,7 @@ int main() {
unsigned char *address;
vector unsigned char *datap;
vector unsigned char vec_uc_expected1, vec_uc_expected2,
vec_uc_result1, vec_uc_result2;
vector unsigned char vec_uc_expected1, vec_uc_result1;
vector int data_int;
for (i=0; i<100; i++)
......@@ -77,26 +76,26 @@ int main() {
/* VEC_XL_LEN_R */
size = 8;
vec_uc_result2 = vec_xl_len_r(data_uc, size);
vec_uc_result1 = vec_xl_len_r(data_uc, size);
vec_uc_expected2 = (vector unsigned char){8, 7, 6, 5, 4, 3, 2, 1,
vec_uc_expected1 = (vector unsigned char){8, 7, 6, 5, 4, 3, 2, 1,
0, 0, 0, 0, 0, 0, 0, 0,};
if (result_wrong (vec_uc_expected2, vec_uc_result2))
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xl_len_r(%d): vec_uc_expected2[0] to vec_uc_expected2[15]\n",
printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected2[i]);
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xl_len_r(%d): vec_uc_result2[0] to vec_uc_result2[15]\n",
printf("\nvec_xl_len_r(%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result2[i]);
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
......@@ -106,26 +105,26 @@ int main() {
size = 4;
vec_uc_result2 = vec_xl_len_r(data_uc, size);
vec_uc_result1 = vec_xl_len_r(data_uc, size);
vec_uc_expected2 = (vector unsigned char){ 4, 3, 2, 1, 0, 0, 0, 0,
vec_uc_expected1 = (vector unsigned char){ 4, 3, 2, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
if (result_wrong (vec_uc_expected2, vec_uc_result2))
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xl_len_r(%d): vec_uc_expected2[0] to vec_uc_expected2[15]\n",
printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected2[i]);
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xl_len_r(%d): vec_uc_result2[0] to vec_uc_result2[15]\n",
printf("\nvec_xl_len_r(%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result2[i]);
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
......@@ -134,25 +133,25 @@ int main() {
}
size = 2;
vec_uc_result2 = vec_xl_len_r(data_uc, size);
vec_uc_result1 = vec_xl_len_r(data_uc, size);
vec_uc_expected2 = (vector unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
vec_uc_expected1 = (vector unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
if (result_wrong (vec_uc_expected2, vec_uc_result2))
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xl_len_r(%d): vec_uc_expected2[0] to vec_uc_expected2[15]\n",
printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected2[i]);
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xl_len_r(%d) vec_uc_result2[0] to vec_uc_result2[15]\n",
printf("\nvec_xl_len_r(%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result2[i]);
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
......@@ -162,33 +161,33 @@ int main() {
/* VEC_XST_LEN */
vec_uc_expected2 = (vector unsigned char){ 1, 2, 0, 0, 0, 0, 0, 0,
vec_uc_expected1 = (vector unsigned char){ 1, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
store_data_uc = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16 };
size = 2;
for (i=0; i<16; i++)
vec_uc_result2[i] = 0;
vec_uc_result1[i] = 0;
address = &vec_uc_result2[0];
address = &vec_uc_result1[0];
vec_xst_len (store_data_uc, address, size);
if (result_wrong (vec_uc_expected2, vec_uc_result2))
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xst_len (%d) vec_uc_result2[0] to vec_uc_result2[15]\n",
printf("vec_xst_len (%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected2[i]);
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xst_len (%d) store_data_uc[0] to store_data_uc[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result2[i]);
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
......@@ -196,34 +195,34 @@ int main() {
#endif
}
vec_uc_expected2 = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
vec_uc_expected1 = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 0, 0 };
store_data_uc = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16 };
size = 14;
for (i=0; i<16; i++)
vec_uc_result2[i] = 0;
vec_uc_result1[i] = 0;
address = &vec_uc_result2[0];
address = &vec_uc_result1[0];
vec_xst_len (store_data_uc, address, size);
if (result_wrong (vec_uc_expected2, vec_uc_result2))
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xst_len (%d) vec_uc_result2[0] to vec_uc_result2[15]\n",
printf("vec_xst_len (%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected2[i]);
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xst_len (%d) store_data_uc[0] to store_data_uc[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result2[i]);
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
......@@ -232,6 +231,40 @@ int main() {
}
/* VEC_XST_LEN_R */
vec_uc_expected1 = (vector unsigned char){ 16, 15, 14, 13, 12, 11, 10, 9,
8, 7, 6, 5, 4, 3, 2, 1 };
store_data_uc = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16 };
vec_uc_result1 = (vector unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
size = 16;
address = &vec_uc_result1[0];
vec_xst_len_r(store_data_uc, address, size);
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
abort();
#endif
}
vec_uc_expected1 = (vector unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
store_data_uc = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
......@@ -241,9 +274,6 @@ int main() {
size = 2;
for (i=0; i<16; i++)
vec_uc_result1[i] = 0;
address = &vec_uc_result1[0];
vec_xst_len_r(store_data_uc, address, size);
......@@ -269,6 +299,39 @@ int main() {
#endif
}
vec_uc_expected1 = (vector unsigned char){ 16, 15, 14, 13, 12, 11, 10, 9,
8, 7, 6, 5, 4, 3, 2, 1 };
store_data_uc = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16 };
vec_uc_result1 = (vector unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
size = 16;
address = &vec_uc_result1[0];
vec_xst_len_r(store_data_uc, address, size);
if (result_wrong (vec_uc_expected1, vec_uc_result1))
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_result1[i]);
printf("\n\n");
#else
abort();
#endif
}
vec_uc_expected1 = (vector unsigned char){ 14, 13, 12, 11, 10, 9, 8, 7,
6, 5, 4, 3, 2, 1, 0, 0 };
......@@ -279,9 +342,6 @@ int main() {
size = 14;
for (i=0; i<16; i++)
vec_uc_result1[i] = 0;
address = &vec_uc_result1[0];
vec_xst_len_r(store_data_uc, address, size);
......@@ -290,11 +350,11 @@ int main() {
{
#ifdef DEBUG
printf("Error: result does not match expected result\n");
printf("vec_xst_len_r(%d) vec_uc_expected2[0] to vec_uc_expected2[15]\n",
printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
size);
for (i=0; i<16; i++)
printf(" %d,", vec_uc_expected2[i]);
printf(" %d,", vec_uc_expected1[i]);
printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size);
......
......@@ -135,7 +135,7 @@ void foo (vector double *out, vector double *in, vector long *p_l, vector bool l
*in++ = vec_andc (inbl0, in1);
*in++ = vec_andc (in0, inbl1);
}
int main()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment