From: Renlin Li Date: Wed, 19 Nov 2014 16:34:38 +0000 (+0000) Subject: [AArch64] Implement v2di3 pattern X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=da9c88d86d71721af15f9342a31e385e897fb643;p=gcc.git [AArch64] Implement v2di3 pattern gcc/: PR target/63424 * config/aarch64/aarch64-simd.md (v2di3): New. gcc/testsuite/: PR target/63424 * gcc.target/aarch64/pr63424.c: New test. From-SVN: r217786 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aeb8fadd946..d7a687a1eed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,11 @@ * config/rs6000/constraints.md: Avoid signed integer overflows. * config/rs6000/predicates.md: Likewise. +2014-11-19 Renlin Li + + PR target/63424 + * config/aarch64/aarch64-simd.md (v2di3): New. + 2014-11-19 Renlin Li PR middle-end/63762 diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 43bfec95702..2e71cb957d7 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -953,6 +953,39 @@ [(set_attr "type" "neon_minmax")] ) +(define_expand "v2di3" + [(set (match_operand:V2DI 0 "register_operand" "") + (MAXMIN:V2DI (match_operand:V2DI 1 "register_operand" "") + (match_operand:V2DI 2 "register_operand" "")))] + "TARGET_SIMD" +{ + enum rtx_code cmp_operator; + rtx cmp_fmt; + + switch () + { + case UMIN: + cmp_operator = LTU; + break; + case SMIN: + cmp_operator = LT; + break; + case UMAX: + cmp_operator = GTU; + break; + case SMAX: + cmp_operator = GT; + break; + default: + gcc_unreachable (); + } + + cmp_fmt = gen_rtx_fmt_ee (cmp_operator, V2DImode, operands[1], operands[2]); + emit_insn (gen_aarch64_vcond_internalv2div2di (operands[0], operands[1], + operands[2], cmp_fmt, operands[1], operands[2])); + DONE; +}) + ;; vec_concat gives a new vector with the low elements from operand 1, and ;; the high elements from operand 2. That is to say, given op1 = { a, b } ;; op2 = { c, d }, vec_concat (op1, op2) = { a, b, c, d }. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f5fb9db873f..840a1c14d14 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-11-19 Renlin Li + PR target/63424 + * gcc.target/aarch64/pr63424.c: New test. + 2014-11-19 Renlin Li PR middle-end/63762 diff --git a/gcc/testsuite/gcc.target/aarch64/pr63424.c b/gcc/testsuite/gcc.target/aarch64/pr63424.c new file mode 100644 index 00000000000..c6bd7626f82 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr63424.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#include + +uint32_t +truncate_int (const unsigned long long value) +{ + if ( value < 0 ) + { + return 0; + } + else if ( value > UINT32_MAX ) + { + return UINT32_MAX; + } + else + return (uint32_t)value; +} + +uint32_t +mul (const unsigned long long x, const unsigned long long y) +{ + uint32_t value = truncate_int (x * y); + return value; +} + +uint32_t * +test(unsigned size, uint32_t *a, uint32_t s) +{ + unsigned i; + + for (i = 0; i < size; i++) + { + a[i] = mul (a[i], s); + } + + return a; +}