diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2013-10-31 19:37:29 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2013-10-31 19:37:29 +0100 |
commit | e5ccdfcd51ccbd0c9353f94f73bce18d42adbaac (patch) | |
tree | 3f4deea604524913db4766b044ac517245f03376 /gcc/config/i386/i386.c | |
parent | 5e5f34bf635888199217753e461cfea3bb8ab390 (diff) | |
download | gcc-e5ccdfcd51ccbd0c9353f94f73bce18d42adbaac.zip gcc-e5ccdfcd51ccbd0c9353f94f73bce18d42adbaac.tar.gz gcc-e5ccdfcd51ccbd0c9353f94f73bce18d42adbaac.tar.bz2 |
i386.c (ix86_expand_sse2_abs): Rename function arguments.
* config/i386/i386.c (ix86_expand_sse2_abs): Rename function arguments.
Use gcc_unreachable for unhandled modes. Do not check results of
expand_simple_binop. If not expanded to target, move the result.
From-SVN: r204271
Diffstat (limited to 'gcc/config/i386/i386.c')
-rw-r--r-- | gcc/config/i386/i386.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 3131efd..5a2597b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -42020,51 +42020,54 @@ ix86_bnd_prefixed_insn_p (rtx insn ATTRIBUTE_UNUSED) return false; } +/* Calculate integer abs() using only SSE2 instructions. */ + void -ix86_expand_sse2_abs (rtx op0, rtx op1) +ix86_expand_sse2_abs (rtx target, rtx input) { - enum machine_mode mode = GET_MODE (op0); - rtx tmp0, tmp1; + enum machine_mode mode = GET_MODE (target); + rtx tmp0, tmp1, x; switch (mode) { /* For 32-bit signed integer X, the best way to calculate the absolute value of X is (((signed) X >> (W-1)) ^ X) - ((signed) X >> (W-1)). */ case V4SImode: - tmp0 = expand_simple_binop (mode, ASHIFTRT, op1, + tmp0 = expand_simple_binop (mode, ASHIFTRT, input, GEN_INT (GET_MODE_BITSIZE - (GET_MODE_INNER (mode)) - 1), + (GET_MODE_INNER (mode)) - 1), NULL, 0, OPTAB_DIRECT); - if (tmp0) - tmp1 = expand_simple_binop (mode, XOR, op1, tmp0, - NULL, 0, OPTAB_DIRECT); - if (tmp0 && tmp1) - expand_simple_binop (mode, MINUS, tmp1, tmp0, - op0, 0, OPTAB_DIRECT); + tmp1 = expand_simple_binop (mode, XOR, tmp0, input, + NULL, 0, OPTAB_DIRECT); + x = expand_simple_binop (mode, MINUS, tmp1, tmp0, + target, 0, OPTAB_DIRECT); break; /* For 16-bit signed integer X, the best way to calculate the absolute value of X is max (X, -X), as SSE2 provides the PMAXSW insn. */ case V8HImode: - tmp0 = expand_unop (mode, neg_optab, op1, NULL_RTX, 0); - if (tmp0) - expand_simple_binop (mode, SMAX, op1, tmp0, op0, 0, - OPTAB_DIRECT); + tmp0 = expand_unop (mode, neg_optab, input, NULL_RTX, 0); + + x = expand_simple_binop (mode, SMAX, tmp0, input, + target, 0, OPTAB_DIRECT); break; /* For 8-bit signed integer X, the best way to calculate the absolute value of X is min ((unsigned char) X, (unsigned char) (-X)), as SSE2 provides the PMINUB insn. */ case V16QImode: - tmp0 = expand_unop (mode, neg_optab, op1, NULL_RTX, 0); - if (tmp0) - expand_simple_binop (V16QImode, UMIN, op1, tmp0, op0, 0, - OPTAB_DIRECT); + tmp0 = expand_unop (mode, neg_optab, input, NULL_RTX, 0); + + x = expand_simple_binop (V16QImode, UMIN, tmp0, input, + target, 0, OPTAB_DIRECT); break; default: - break; + gcc_unreachable (); } + + if (x != target) + emit_move_insn (target, x); } /* Expand an insert into a vector register through pinsr insn. |