Commit 1262fd02 by Uros Bizjak

re PR target/41019 (Vector conditional move produces wrong code with -O3.)

	PR target/41019
	* config/i386/sse.md (SSEMODE124C8): New mode iterator.
	(vcond<SSEMODEF2P:mode>): Assert that operation is supported by
	ix86_expand_fp_vcond.
	(vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
	Assert that operation is supported by ix86_expand_int_vcond.
	(vcondu<SSEMODE124C8:mode>): Ditto.

testsuite/ChangeLog:

	PR target/41019
	* gcc.target/i386/pr41019.c: New test.

From-SVN: r150738
parent 34d35753
2009-08-14 Uros Bizjak <ubizjak@gmail.com>
PR target/41019
* config/i386/sse.md (SSEMODE124C8): New mode iterator.
(vcond<SSEMODEF2P:mode>): Assert that operation is supported by
ix86_expand_fp_vcond.
(vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
Assert that operation is supported by ix86_expand_int_vcond.
(vcondu<SSEMODE124C8:mode>): Ditto.
2009-08-13 DJ Delorie <dj@redhat.com> 2009-08-13 DJ Delorie <dj@redhat.com>
* config/i386/djgpp-stdint.h: New. * config/i386/djgpp-stdint.h: New.
...@@ -6,8 +16,7 @@ ...@@ -6,8 +16,7 @@
2009-08-13 Kaz Kojima <kkojima@gcc.gnu.org> 2009-08-13 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (sh_override_options): When flag_exceptions or * config/sh/sh.c (sh_override_options): When flag_exceptions or
flag_unwind_tables is on, turn flag_reorder_blocks_and_partition flag_unwind_tables is on, turn flag_reorder_blocks_and_partition off.
off.
2009-08-13 Ghassan Shobaki <ghassan.shobaki@amd.com> 2009-08-13 Ghassan Shobaki <ghassan.shobaki@amd.com>
...@@ -182,18 +191,19 @@ ...@@ -182,18 +191,19 @@
transform has been done. Call restore_scattering if the transform transform has been done. Call restore_scattering if the transform
is not legal. is not legal.
(graphite-interchange.c): Same. (graphite-interchange.c): Same.
* graphite-poly.c (print_scattering_function): Test for PBB_TRANSFORMED. * graphite-poly.c (print_scattering_function): Test for
PBB_TRANSFORMED.
(graphite_read_transforms): Initialize PBB_TRANSFORMED. (graphite_read_transforms): Initialize PBB_TRANSFORMED.
(apply_poly_transforms): Do not gcc_assert that (apply_poly_transforms): Do not gcc_assert that
the transform is legal. the transform is legal.
(new_poly_bb): Initialize PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL. (new_poly_bb): Initialize PBB_TRANSFORMED, PBB_SAVED and PBB_ORIGINAL.
Do not initialize PBB_NB_SCATTERING_TRANSFORM, PBB_NB_LOCAL_VARIABLES, Do not initialize PBB_NB_SCATTERING_TRANSFORM, PBB_NB_LOCAL_VARIABLES,
PBB_TRANSFORMED_SCATTERING, and PBB_ORIGINAL_SCATTERING. PBB_TRANSFORMED_SCATTERING, and PBB_ORIGINAL_SCATTERING.
(free_poly_dr): Free PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL. (free_poly_dr): Free PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL.
* graphite-poly.h (struct poly_scattering): New. * graphite-poly.h (struct poly_scattering): New.
(struct poly_bb): Add original, transformed, and saved fields. (struct poly_bb): Add original, transformed, and saved fields.
Remove transformed_scattering, original_scattering, nb_local_variables, Remove transformed_scattering, original_scattering,
and nb_scattering_transform fields. nb_local_variables and nb_scattering_transform fields.
(PBB_ORIGINAL, PBB_TRANSFORMED, PBB_SAVED): New. (PBB_ORIGINAL, PBB_TRANSFORMED, PBB_SAVED): New.
(poly_scattering_new): New. (poly_scattering_new): New.
(poly_scattering_free): New. (poly_scattering_free): New.
...@@ -248,8 +258,7 @@ ...@@ -248,8 +258,7 @@
* config/mips/mips-protos.h (and_operands_ok): Declare it. * config/mips/mips-protos.h (and_operands_ok): Declare it.
* config/mips/mips.md (move_type): Add ext_ins and logical. * config/mips/mips.md (move_type): Add ext_ins and logical.
(type): Handle them. (type): Handle them.
(and<mode>3): Use and_reg_operand as the second operand's (and<mode>3): Use and_reg_operand as the second operand's predicate.
predicate.
(*and<mode>3): Add alternatives for lbu, lhu, lwu, <d>ext and (*and<mode>3): Add alternatives for lbu, lhu, lwu, <d>ext and
shift_shift. Remove commutative constraint modifier. shift_shift. Remove commutative constraint modifier.
(*and<mode>3_mips16): Add alternatives for lbu, lhu, lwu and (*and<mode>3_mips16): Add alternatives for lbu, lhu, lwu and
...@@ -1396,9 +1405,9 @@ ...@@ -1396,9 +1405,9 @@
(vec_unpacks_hi_v4sf): Ditto. (vec_unpacks_hi_v4sf): Ditto.
(vec_unpacks_lo_v4sf): Ditto. (vec_unpacks_lo_v4sf): Ditto.
(vec_unpacks_float_hi_v4si): Ditto. (vec_unpacks_float_hi_v4si): Ditto.
(vec_unpacku_float_lo_v4si): Ditto.
(vec_unpacku_float_hi_v4si): Ditto.
(vec_unpacks_float_lo_v4si): Ditto. (vec_unpacks_float_lo_v4si): Ditto.
(vec_unpacku_float_hi_v4si): Ditto.
(vec_unpacku_float_lo_v4si): Ditto.
(movmisalign<mode>): Ditto. (movmisalign<mode>): Ditto.
(vector_ceil<mode>2): New patterns for vectorizing math library. (vector_ceil<mode>2): New patterns for vectorizing math library.
(vector_floor<mode>2): Ditto. (vector_floor<mode>2): Ditto.
......
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
(define_mode_iterator SSEMODE4S [V4SF V4SI]) (define_mode_iterator SSEMODE4S [V4SF V4SI])
(define_mode_iterator SSEMODE2D [V2DF V2DI]) (define_mode_iterator SSEMODE2D [V2DF V2DI])
;; Modes handled by integer vcond pattern
(define_mode_iterator SSEMODE124C8 [V16QI V8HI V4SI
(V2DI "TARGET_SSE4_2 || TARGET_SSE5")])
;; Mapping from float mode to required SSE level ;; Mapping from float mode to required SSE level
(define_mode_attr sse [(SF "sse") (DF "sse2") (V4SF "sse") (V2DF "sse2")]) (define_mode_attr sse [(SF "sse") (DF "sse2") (V4SF "sse") (V2DF "sse2")])
...@@ -1520,10 +1524,9 @@ ...@@ -1520,10 +1524,9 @@
(match_operand:SSEMODEF2P 2 "general_operand" "")))] (match_operand:SSEMODEF2P 2 "general_operand" "")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)" "SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
{ {
if (ix86_expand_fp_vcond (operands)) bool ok = ix86_expand_fp_vcond (operands);
gcc_assert (ok);
DONE; DONE;
else
FAIL;
}) })
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
...@@ -6071,35 +6074,33 @@ ...@@ -6071,35 +6074,33 @@
(set_attr "mode" "TI")]) (set_attr "mode" "TI")])
(define_expand "vcond<mode>" (define_expand "vcond<mode>"
[(set (match_operand:SSEMODEI 0 "register_operand" "") [(set (match_operand:SSEMODE124C8 0 "register_operand" "")
(if_then_else:SSEMODEI (if_then_else:SSEMODE124C8
(match_operator 3 "" (match_operator 3 ""
[(match_operand:SSEMODEI 4 "nonimmediate_operand" "") [(match_operand:SSEMODE124C8 4 "nonimmediate_operand" "")
(match_operand:SSEMODEI 5 "nonimmediate_operand" "")]) (match_operand:SSEMODE124C8 5 "nonimmediate_operand" "")])
(match_operand:SSEMODEI 1 "general_operand" "") (match_operand:SSEMODE124C8 1 "general_operand" "")
(match_operand:SSEMODEI 2 "general_operand" "")))] (match_operand:SSEMODE124C8 2 "general_operand" "")))]
"TARGET_SSE2" "TARGET_SSE2"
{ {
if (ix86_expand_int_vcond (operands)) bool ok = ix86_expand_int_vcond (operands);
gcc_assert (ok);
DONE; DONE;
else
FAIL;
}) })
(define_expand "vcondu<mode>" (define_expand "vcondu<mode>"
[(set (match_operand:SSEMODEI 0 "register_operand" "") [(set (match_operand:SSEMODE124C8 0 "register_operand" "")
(if_then_else:SSEMODEI (if_then_else:SSEMODE124C8
(match_operator 3 "" (match_operator 3 ""
[(match_operand:SSEMODEI 4 "nonimmediate_operand" "") [(match_operand:SSEMODE124C8 4 "nonimmediate_operand" "")
(match_operand:SSEMODEI 5 "nonimmediate_operand" "")]) (match_operand:SSEMODE124C8 5 "nonimmediate_operand" "")])
(match_operand:SSEMODEI 1 "general_operand" "") (match_operand:SSEMODE124C8 1 "general_operand" "")
(match_operand:SSEMODEI 2 "general_operand" "")))] (match_operand:SSEMODE124C8 2 "general_operand" "")))]
"TARGET_SSE2" "TARGET_SSE2"
{ {
if (ix86_expand_int_vcond (operands)) bool ok = ix86_expand_int_vcond (operands);
gcc_assert (ok);
DONE; DONE;
else
FAIL;
}) })
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
......
2009-08-14 Uros Bizjak <ubizjak@gmail.com>
PR target/41019
* gcc.target/i386/pr41019.c: New test.
2009-08-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2009-08-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/40955 PR fortran/40955
......
/* { dg-do run } */
/* { dg-options "-O2 -msse2 -ftree-vectorize" } */
#include "sse2-check.h"
long long int a[64];
void
sse2_test (void)
{
int k;
for (k = 0; k < 64; k++)
a[k] = a[k] != 5 ? 12 : 10;
for (k = 0; k < 64; k++)
if (a[k] != 12)
abort ();
}
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