Deleted Added
full compact
tree-vect-analyze.c (169690) tree-vect-analyze.c (220150)
1/* Analysis Utilities for Loop Vectorization.
2 Copyright (C) 2003,2004,2005,2006 Free Software Foundation, Inc.
3 Contributed by Dorit Naishlos <dorit@il.ibm.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 11 unchanged lines hidden (view full) ---

2002110-1301, USA. */
21
22#include "config.h"
23#include "system.h"
24#include "coretypes.h"
25#include "tm.h"
26#include "ggc.h"
27#include "tree.h"
1/* Analysis Utilities for Loop Vectorization.
2 Copyright (C) 2003,2004,2005,2006 Free Software Foundation, Inc.
3 Contributed by Dorit Naishlos <dorit@il.ibm.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 11 unchanged lines hidden (view full) ---

2002110-1301, USA. */
21
22#include "config.h"
23#include "system.h"
24#include "coretypes.h"
25#include "tm.h"
26#include "ggc.h"
27#include "tree.h"
28#include "target.h"
28#include "basic-block.h"
29#include "diagnostic.h"
30#include "tree-flow.h"
31#include "tree-dump.h"
32#include "timevar.h"
33#include "cfgloop.h"
34#include "expr.h"
35#include "optabs.h"

--- 870 unchanged lines hidden (view full) ---

906 if (supportable_dr_alignment != dr_aligned
907 && vect_print_dump_info (REPORT_ALIGNMENT))
908 fprintf (vect_dump, "Vectorizing an unaligned access.");
909 }
910 return true;
911}
912
913
29#include "basic-block.h"
30#include "diagnostic.h"
31#include "tree-flow.h"
32#include "tree-dump.h"
33#include "timevar.h"
34#include "cfgloop.h"
35#include "expr.h"
36#include "optabs.h"

--- 870 unchanged lines hidden (view full) ---

907 if (supportable_dr_alignment != dr_aligned
908 && vect_print_dump_info (REPORT_ALIGNMENT))
909 fprintf (vect_dump, "Vectorizing an unaligned access.");
910 }
911 return true;
912}
913
914
915/* Function vector_alignment_reachable_p
916
917 Return true if vector alignment for DR is reachable by peeling
918 a few loop iterations. Return false otherwise. */
919
920static bool
921vector_alignment_reachable_p (struct data_reference *dr)
922{
923 tree stmt = DR_STMT (dr);
924 stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
925 tree vectype = STMT_VINFO_VECTYPE (stmt_info);
926
927 /* If misalignment is known at the compile time then allow peeling
928 only if natural alignment is reachable through peeling. */
929 if (known_alignment_for_access_p (dr) && !aligned_access_p (dr))
930 {
931 HOST_WIDE_INT elmsize =
932 int_cst_value (TYPE_SIZE_UNIT (TREE_TYPE (vectype)));
933 if (vect_print_dump_info (REPORT_DETAILS))
934 {
935 fprintf (vect_dump, "data size =" HOST_WIDE_INT_PRINT_DEC, elmsize);
936 fprintf (vect_dump, ". misalignment = %d. ", DR_MISALIGNMENT (dr));
937 }
938 if (DR_MISALIGNMENT (dr) % elmsize)
939 {
940 if (vect_print_dump_info (REPORT_DETAILS))
941 fprintf (vect_dump, "data size does not divide the misalignment.\n");
942 return false;
943 }
944 }
945
946 if (!known_alignment_for_access_p (dr))
947 {
948 tree type = (TREE_TYPE (DR_REF (dr)));
949 tree ba = DR_BASE_OBJECT (dr);
950 bool is_packed = false;
951
952 if (ba)
953 is_packed = contains_packed_reference (ba);
954
955 if (vect_print_dump_info (REPORT_DETAILS))
956 fprintf (vect_dump, "Unknown misalignment, is_packed = %d",is_packed);
957 if (targetm.vectorize.vector_alignment_reachable (type, is_packed))
958 return true;
959 else
960 return false;
961 }
962
963 return true;
964}
965
914/* Function vect_enhance_data_refs_alignment
915
916 This pass will use loop versioning and loop peeling in order to enhance
917 the alignment of data references in the loop.
918
919 FOR NOW: we assume that whatever versioning/peeling takes place, only the
920 original loop is to be vectorized; Any other loops that are created by
921 the transformations performed in this pass - are not supposed to be

--- 129 unchanged lines hidden (view full) ---

1051 misaligned store in the loop.
1052 Rationale: misaligned stores are not yet supported.
1053
1054 TODO: Use a cost model. */
1055
1056 for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
1057 if (!DR_IS_READ (dr) && !aligned_access_p (dr))
1058 {
966/* Function vect_enhance_data_refs_alignment
967
968 This pass will use loop versioning and loop peeling in order to enhance
969 the alignment of data references in the loop.
970
971 FOR NOW: we assume that whatever versioning/peeling takes place, only the
972 original loop is to be vectorized; Any other loops that are created by
973 the transformations performed in this pass - are not supposed to be

--- 129 unchanged lines hidden (view full) ---

1103 misaligned store in the loop.
1104 Rationale: misaligned stores are not yet supported.
1105
1106 TODO: Use a cost model. */
1107
1108 for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
1109 if (!DR_IS_READ (dr) && !aligned_access_p (dr))
1110 {
1059 dr0 = dr;
1060 do_peeling = true;
1111 do_peeling = vector_alignment_reachable_p (dr);
1112 if (do_peeling)
1113 dr0 = dr;
1114 if (!do_peeling && vect_print_dump_info (REPORT_DETAILS))
1115 fprintf (vect_dump, "vector alignment may not be reachable");
1061 break;
1062 }
1063
1064 /* Often peeling for alignment will require peeling for loop-bound, which in
1065 turn requires that we know how to adjust the loop ivs after the loop. */
1066 if (!vect_can_advance_ivs_p (loop_vinfo))
1067 do_peeling = false;
1068

--- 1034 unchanged lines hidden ---
1116 break;
1117 }
1118
1119 /* Often peeling for alignment will require peeling for loop-bound, which in
1120 turn requires that we know how to adjust the loop ivs after the loop. */
1121 if (!vect_can_advance_ivs_p (loop_vinfo))
1122 do_peeling = false;
1123

--- 1034 unchanged lines hidden ---