Commit 79cad86d by David S. Miller

More improvements to sparc VIS vec_init code generation.

gcc/

	* config/sparc/sparc.md (UNSPEC_SHORT_LOAD): New unspec.
	(zero-extend_v8qi_vis, zero_extend_v4hi_vis): New expanders.
	(*zero_extend_v8qi_<P:mode>_insn,
	*zero_extend_v4hi_<P:mode>_insn): New insns.
	* config/sparc/sparc.c (vector_init_move_words,
	vector_init_prepare_elts, sparc_expand_vector_init_vis2,
	sparc_expand_vector_init_vis1): New functions.
	(vector_init_bshuffle): Rewrite to handle more cases and make use
	of locs[] array prepared by vector_init_prepare_elts.
	(vector_init_fpmerge, vector_init_faligndata): Delete.
	(sparc_expand_vector_init): Rewrite using new infrastructure.

gcc/testsuite/

	* lib/test-supports.exp
	(check_effective_target_ultrasparc_vis2_hw): New proc.
	(check_effective_target_ultrasparc_vis3_hw): New proc.
	* gcc.target/sparc/vec-init-1.inc: New vector init common code.
	* gcc.target/sparc/vec-init-2.inc: Likewise.
	* gcc.target/sparc/vec-init-3.inc: Likewise.
	* gcc.target/sparc/vec-init-1-vis1.c: New test.
	* gcc.target/sparc/vec-init-1-vis2.c: New test.
	* gcc.target/sparc/vec-init-1-vis3.c: New test.
	* gcc.target/sparc/vec-init-2-vis1.c: New test.
	* gcc.target/sparc/vec-init-2-vis2.c: New test.
	* gcc.target/sparc/vec-init-2-vis3.c: New test.
	* gcc.target/sparc/vec-init-3-vis1.c: New test.
	* gcc.target/sparc/vec-init-3-vis2.c: New test.
	* gcc.target/sparc/vec-init-3-vis3.c: New test.

From-SVN: r181024
parent e940f96f
2011-11-05 David S. Miller <davem@davemloft.net>
* config/sparc/sparc.md (UNSPEC_SHORT_LOAD): New unspec.
(zero-extend_v8qi_vis, zero_extend_v4hi_vis): New expanders.
(*zero_extend_v8qi_<P:mode>_insn,
*zero_extend_v4hi_<P:mode>_insn): New insns.
* config/sparc/sparc.c (vector_init_move_words,
vector_init_prepare_elts, sparc_expand_vector_init_vis2,
sparc_expand_vector_init_vis1): New functions.
(vector_init_bshuffle): Rewrite to handle more cases and make use
of locs[] array prepared by vector_init_prepare_elts.
(vector_init_fpmerge, vector_init_faligndata): Delete.
(sparc_expand_vector_init): Rewrite using new infrastructure.
2011-11-05 Joern Rennecke <joern.rennecke@embecosm.com>
* config.gcc (epiphany-*-*): New architecture.
......@@ -56,7 +70,7 @@
Remove -mcpu=601 multilib.
Remove -Dmpc8260 multilib.
* config/rs6000/rtems.h: Allow --float-gprs=... to override grps
on E500 targets.
on E500 targets.
2011-11-05 Quentin Neill <quentin.neill@amd.com>
......@@ -92,6 +92,7 @@
(UNSPEC_MUL8 86)
(UNSPEC_MUL8SU 87)
(UNSPEC_MULDSU 88)
(UNSPEC_SHORT_LOAD 89)
])
(define_constants
......@@ -7830,6 +7831,48 @@
DONE;
})
(define_expand "zero_extend_v8qi_vis"
[(set (match_operand:V8QI 0 "register_operand" "")
(unspec:V8QI [(match_operand:QI 1 "memory_operand" "")]
UNSPEC_SHORT_LOAD))]
"TARGET_VIS"
{
if (! REG_P (XEXP (operands[1], 0)))
{
rtx addr = force_reg (Pmode, XEXP (operands[1], 0));
operands[1] = replace_equiv_address (operands[1], addr);
}
})
(define_expand "zero_extend_v4hi_vis"
[(set (match_operand:V4HI 0 "register_operand" "")
(unspec:V4HI [(match_operand:HI 1 "memory_operand" "")]
UNSPEC_SHORT_LOAD))]
"TARGET_VIS"
{
if (! REG_P (XEXP (operands[1], 0)))
{
rtx addr = force_reg (Pmode, XEXP (operands[1], 0));
operands[1] = replace_equiv_address (operands[1], addr);
}
})
(define_insn "*zero_extend_v8qi_<P:mode>_insn"
[(set (match_operand:V8QI 0 "register_operand" "=e")
(unspec:V8QI [(mem:QI
(match_operand:P 1 "register_operand" "r"))]
UNSPEC_SHORT_LOAD))]
"TARGET_VIS"
"ldda\t[%1] 0xd0, %0")
(define_insn "*zero_extend_v4hi_<P:mode>_insn"
[(set (match_operand:V4HI 0 "register_operand" "=e")
(unspec:V4HI [(mem:HI
(match_operand:P 1 "register_operand" "r"))]
UNSPEC_SHORT_LOAD))]
"TARGET_VIS"
"ldda\t[%1] 0xd2, %0")
(define_expand "vec_init<mode>"
[(match_operand:VMALL 0 "register_operand" "")
(match_operand:VMALL 1 "" "")]
......
2011-11-05 David S. Miller <davem@davemloft.net>
* lib/test-supports.exp
(check_effective_target_ultrasparc_vis2_hw): New proc.
(check_effective_target_ultrasparc_vis3_hw): New proc.
* gcc.target/sparc/vec-init-1.inc: New vector init common code.
* gcc.target/sparc/vec-init-2.inc: Likewise.
* gcc.target/sparc/vec-init-3.inc: Likewise.
* gcc.target/sparc/vec-init-1-vis1.c: New test.
* gcc.target/sparc/vec-init-1-vis2.c: New test.
* gcc.target/sparc/vec-init-1-vis3.c: New test.
* gcc.target/sparc/vec-init-2-vis1.c: New test.
* gcc.target/sparc/vec-init-2-vis2.c: New test.
* gcc.target/sparc/vec-init-2-vis3.c: New test.
* gcc.target/sparc/vec-init-3-vis1.c: New test.
* gcc.target/sparc/vec-init-3-vis2.c: New test.
* gcc.target/sparc/vec-init-3-vis3.c: New test.
2011-11-05 Joern Rennecke <joern.rennecke@embecosm.com>
* gcc.c-torture/execute/ieee/mul-subnormal-single-1.x:
......
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_hw } */
/* { dg-options "-mcpu=ultrasparc -mvis -O2" } */
#include "vec-init-1.inc"
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis2_hw } */
/* { dg-options "-mcpu=ultrasparc3 -O2" } */
#include "vec-init-1.inc"
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis3_hw } */
/* { dg-options "-mcpu=niagara3 -O2" } */
#include "vec-init-1.inc"
typedef int __v1si __attribute__ ((__vector_size__ (4)));
typedef int __v2si __attribute__ ((__vector_size__ (8)));
typedef short __v2hi __attribute__ ((__vector_size__ (4)));
typedef short __v4hi __attribute__ ((__vector_size__ (8)));
typedef unsigned char __v4qi __attribute__ ((__vector_size__ (4)));
typedef unsigned char __v8qi __attribute__ ((__vector_size__ (8)));
extern void abort (void);
static void
compare64 (void *p, unsigned long long val)
{
if (*(unsigned long long *)p != val)
abort();
}
static void
compare32 (void *p, unsigned int val)
{
if (*(unsigned int *)p != val)
abort();
}
static void
test_v8qi (unsigned char x)
{
__v8qi v = { x, x, x, x, x, x, x, x };
compare64(&v, 0x4444444444444444ULL);
}
static void
test_v4qi (unsigned char x)
{
__v4qi v = { x, x, x, x };
compare32(&v, 0x44444444);
}
static void
test_v4hi (unsigned short x)
{
__v4hi v = { x, x, x, x, };
compare64(&v, 0x3344334433443344ULL);
}
static void
test_v2hi (unsigned short x)
{
__v2hi v = { x, x, };
compare32(&v, 0x33443344);
}
static void
test_v2si (unsigned int x)
{
__v2si v = { x, x, };
compare64(&v, 0x1122334411223344ULL);
}
static void
test_v1si (unsigned int x)
{
__v1si v = { x };
compare32(&v, 0x11223344);
}
unsigned char x8 = 0x44;
unsigned short x16 = 0x3344;
unsigned int x32 = 0x11223344;
int main(void)
{
test_v8qi (x8);
test_v4qi (x8);
test_v4hi (x16);
test_v2hi (x16);
test_v2si (x32);
test_v1si (x32);
return 0;
}
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_hw } */
/* { dg-options "-mcpu=ultrasparc -mvis -O2" } */
#include "vec-init-2.inc"
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis2_hw } */
/* { dg-options "-mcpu=ultrasparc3 -O2" } */
#include "vec-init-2.inc"
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis3_hw } */
/* { dg-options "-mcpu=niagara3 -O2" } */
#include "vec-init-2.inc"
typedef short __v2hi __attribute__ ((__vector_size__ (4)));
typedef short __v4hi __attribute__ ((__vector_size__ (8)));
extern void abort (void);
static void
compare64 (int n, void *p, unsigned long long val)
{
unsigned long long *x = (unsigned long long *) p;
if (*x != val)
abort();
}
static void
compare32 (int n, void *p, unsigned int val)
{
unsigned int *x = (unsigned int *) p;
if (*x != val)
abort();
}
#define V2HI_TEST(N, elt0, elt1) \
static void \
test_v2hi_##N (unsigned short x, unsigned short y) \
{ \
__v2hi v = { (elt0), (elt1) }; \
compare32(N, &v, ((int)(elt0) << 16) | (elt1)); \
}
V2HI_TEST(1, x, y)
V2HI_TEST(2, y, x)
V2HI_TEST(3, x, x)
V2HI_TEST(4, x, 0)
V2HI_TEST(5, 0, x)
V2HI_TEST(6, y, 1)
V2HI_TEST(7, 1, y)
V2HI_TEST(8, 2, 3)
V2HI_TEST(9, 0x400, x)
V2HI_TEST(10, y, 0x8000)
#define V4HI_TEST(N, elt0, elt1, elt2, elt3) \
static void \
test_v4hi_##N (unsigned short a, unsigned short b, unsigned short c, unsigned short d) \
{ \
__v4hi v = { (elt0), (elt1), (elt2), (elt3) }; \
compare64(N, &v, \
((long long)(elt0) << 48) | \
((long long)(elt1) << 32) | \
((long long)(elt2) << 16) | \
((long long)(elt3))); \
}
V4HI_TEST(1, a, a, a, a)
V4HI_TEST(2, a, b, c, d)
V4HI_TEST(3, a, a, b, b)
V4HI_TEST(4, d, c, b, a)
V4HI_TEST(5, a, 0, 0, 0)
V4HI_TEST(6, a, 0, b, 0)
V4HI_TEST(7, c, 5, 5, 5)
V4HI_TEST(8, d, 6, a, 6)
V4HI_TEST(9, 0x200, 0x300, 0x500, 0x8800)
V4HI_TEST(10, 0x600, a, a, a)
unsigned short a16 = 0x3344;
unsigned short b16 = 0x5566;
unsigned short c16 = 0x7788;
unsigned short d16 = 0x9911;
int main(void)
{
test_v2hi_1 (a16, b16);
test_v2hi_2 (a16, b16);
test_v2hi_3 (a16, b16);
test_v2hi_4 (a16, b16);
test_v2hi_5 (a16, b16);
test_v2hi_6 (a16, b16);
test_v2hi_7 (a16, b16);
test_v2hi_8 (a16, b16);
test_v2hi_9 (a16, b16);
test_v2hi_10 (a16, b16);
test_v4hi_1 (a16, b16, c16, d16);
test_v4hi_2 (a16, b16, c16, d16);
test_v4hi_3 (a16, b16, c16, d16);
test_v4hi_4 (a16, b16, c16, d16);
test_v4hi_5 (a16, b16, c16, d16);
test_v4hi_6 (a16, b16, c16, d16);
test_v4hi_7 (a16, b16, c16, d16);
test_v4hi_8 (a16, b16, c16, d16);
test_v4hi_9 (a16, b16, c16, d16);
test_v4hi_10 (a16, b16, c16, d16);
return 0;
}
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_hw } */
/* { dg-options "-mcpu=ultrasparc -mvis -O2" } */
#include "vec-init-3.inc"
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis2_hw } */
/* { dg-options "-mcpu=ultrasparc3 -O2" } */
#include "vec-init-3.inc"
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis3_hw } */
/* { dg-options "-mcpu=niagara3 -O2" } */
#include "vec-init-3.inc"
typedef unsigned char __v4qi __attribute__ ((__vector_size__ (4)));
typedef unsigned char __v8qi __attribute__ ((__vector_size__ (8)));
extern void abort (void);
static void
compare64 (int n, void *p, unsigned long long val)
{
unsigned long long *x = (unsigned long long *) p;
if (*x != val)
abort();
}
static void
compare32 (int n, void *p, unsigned int val)
{
unsigned int *x = (unsigned int *) p;
if (*x != val)
abort();
}
#define V4QI_TEST(N, elt0, elt1, elt2, elt3) \
static void \
test_v4qi_##N (unsigned char a, unsigned char b, unsigned char c, unsigned char d) \
{ \
__v4qi v = { (elt0), (elt1), (elt2), (elt3) }; \
compare32(N, &v, ((int)(elt0) << 24) | \
((int)(elt1) << 16) | \
((int)(elt2) << 8) | ((int)(elt3))); \
}
V4QI_TEST(1, a, a, a, a)
V4QI_TEST(2, b, b, b, b)
V4QI_TEST(3, a, b, c, d)
V4QI_TEST(4, d, c, b, a)
V4QI_TEST(5, a, 0, 0, 0)
V4QI_TEST(6, b, 1, 1, b)
V4QI_TEST(7, c, 5, d, 5)
V4QI_TEST(8, 0x20, 0x30, b, a)
V4QI_TEST(9, 0x40, 0x50, 0x60, 0x70)
V4QI_TEST(10, 0x40, 0x50, 0x60, c)
#define V8QI_TEST(N, elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7) \
static void \
test_v8qi_##N (unsigned char a, unsigned char b, unsigned char c, unsigned char d, \
unsigned char e, unsigned char f, unsigned char g, unsigned char h) \
{ \
__v8qi v = { (elt0), (elt1), (elt2), (elt3), \
(elt4), (elt5), (elt6), (elt7) }; \
compare64(N, &v, ((long long)(elt0) << 56) | \
((long long)(elt1) << 48) | \
((long long)(elt2) << 40) | \
((long long)(elt3) << 32) | \
((long long)(elt4) << 24) | \
((long long)(elt5) << 16) | \
((long long)(elt6) << 8) | \
((long long)(elt7) << 0)); \
}
V8QI_TEST(1, a, a, a, a, a, a, a, a)
V8QI_TEST(2, a, b, c, d, e, f, g, h)
V8QI_TEST(3, h, g, f, e, d, c, b, a)
V8QI_TEST(4, a, b, a, b, a, b, a, b)
V8QI_TEST(5, c, b, c, b, c, b, c, a)
V8QI_TEST(6, a, 0, 0, 0, 0, 0, 0, 0)
V8QI_TEST(7, b, 1, b, 1, b, 1, b, 1)
V8QI_TEST(8, c, d, 0x20, a, 0x21, b, 0x23, c)
V8QI_TEST(9, 1, 2, 3, 4, 5, 6, 7, 8)
V8QI_TEST(10, a, a, b, b, c, c, d, d)
unsigned char a8 = 0x33;
unsigned char b8 = 0x55;
unsigned char c8 = 0x77;
unsigned char d8 = 0x99;
unsigned char e8 = 0x11;
unsigned char f8 = 0x22;
unsigned char g8 = 0x44;
unsigned char h8 = 0x66;
int main(void)
{
test_v4qi_1 (a8, b8, c8, d8);
test_v4qi_2 (a8, b8, c8, d8);
test_v4qi_3 (a8, b8, c8, d8);
test_v4qi_4 (a8, b8, c8, d8);
test_v4qi_5 (a8, b8, c8, d8);
test_v4qi_6 (a8, b8, c8, d8);
test_v4qi_7 (a8, b8, c8, d8);
test_v4qi_8 (a8, b8, c8, d8);
test_v4qi_9 (a8, b8, c8, d8);
test_v4qi_10 (a8, b8, c8, d8);
test_v8qi_1 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_2 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_3 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_4 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_5 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_6 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_7 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_8 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_9 (a8, b8, c8, d8, e8, f8, g8, h8);
test_v8qi_10 (a8, b8, c8, d8, e8, f8, g8, h8);
return 0;
}
......@@ -2449,6 +2449,24 @@ proc check_effective_target_ultrasparc_hw { } {
} "-mcpu=ultrasparc"]
}
# Return 1 if the test environment supports executing UltraSPARC VIS2
# instructions. We check this by attempting: "bmask %g0, %g0, %g0"
proc check_effective_target_ultrasparc_vis2_hw { } {
return [check_runtime ultrasparc_hw {
int main() { __asm__(".word 0x81b00320"); return 0; }
} "-mcpu=ultrasparc3"]
}
# Return 1 if the test environment supports executing UltraSPARC VIS3
# instructions. We check this by attempting: "addxc %g0, %g0, %g0"
proc check_effective_target_ultrasparc_vis3_hw { } {
return [check_runtime ultrasparc_hw {
int main() { __asm__(".word 0x81b00220"); return 0; }
} "-mcpu=niagara3"]
}
# Return 1 if the target supports hardware vector shift operation.
proc check_effective_target_vect_shift { } {
......
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